SDKs
Mailrith ships official TypeScript and Python SDKs generated from the same public contract that drives the OpenAPI document and capability map.
4 min read
TypeScript SDK
The official TypeScript SDK wraps the versioned public API and exposes stable resource namespaces like client.subscribers, client.broadcasts, and client.webhookSubscriptions.
Use it when you want Mailrith's REST surface with typed operation metadata, a shared fetch layer, and predictable request construction.
- Install
@mailrith/sdkin any Node.js or edge runtime that already supportsfetch. - Create one client per API key or clone a client with
withApiKey()when you rotate credentials.
import { createMailrithClient } from "@mailrith/sdk";
const client = createMailrithClient({
apiKey: process.env.MAILRITH_API_KEY,
});
const capabilities = await client.discovery.getCapabilities();
const subscriber = await client.subscribers.upsert({
body: {
email: "ada@example.com",
name: "Ada Lovelace",
new_tags: ["Website Signup"],
},
});
const draft = await client.broadcasts.create({
body: {
subject: "Welcome to Mailrith",
preview_text: "A quick hello from the team",
body: "<p>Hello {{ subscriber.name }}</p>",
status: "draft",
},
}); Python SDK
The official Python SDK is generated from the same Mailrith SDK manifest and exposes snake_case namespaces and methods that fit Python callers naturally.
It ships with a stdlib transport by default, so you can use it in simple scripts and automation workers without another HTTP dependency.
- Install
mailrith-sdkin Python 3.10+ environments. - Pass
api_keyonce when you construct the client, then call resource methods withpath=,query=, andbody=dictionaries.
import os
from mailrith_sdk import MailrithClient
client = MailrithClient(api_key=os.environ["MAILRITH_API_KEY"])
capabilities = client.discovery.get_capabilities()
subscribers = client.subscribers.list(query={"limit": 25})
broadcast = client.broadcasts.create(
body={
"subject": "Welcome to Mailrith",
"preview_text": "A quick hello from the team",
"body": "<p>Hello {{ subscriber.name }}</p>",
"status": "draft",
}
) Generated from the public contract
Both SDKs are generated from Mailrith's versioned public API contract so the SDK surface stays aligned with the served OpenAPI document and authenticated capability model.
When the public contract changes in this repo, regenerate the shared SDK artifacts before you ship or test the updated packages.
pnpm generate:agent-artifacts Need help shipping an integration?
Reach the Mailrith team if you need help planning a sync, validating a webhook flow, or troubleshooting a request.
Related guides
Discover Mailrith from agent runtimes with llms files, API metadata, OpenAPI, and authenticated capability discovery.
Connect Mailrith to agent runtimes through the official remote MCP server and streamable HTTP transport.
Create a workspace key and make the first authenticated request against Mailrith's public API.