Skip to content
Esc
  • OverviewGuidesWhat exists today, and where to start.
  • QuickstartGuidesKey, domain, first send — in that order.
  • AuthenticationGuidesBearer keys, the mandatory User-Agent, and what each refusal means.
  • ErrorsGuidesThe whole vocabulary, with the status each name carries.
  • IdempotencyGuidesRetry a send without sending it twice.
  • PaginationGuidesCursors are item IDs, not page numbers.
  • Rate limitsGuidesTen a second per team, and the headers that tell you where you are.
  • EventsGuidesEvery event a webhook can carry, with one real payload each.
  • DomainsGuidesThe records, where they go at each registrar, and what the page does while you wait.
  • TrackingGuidesOpens and clicks: one record, two toggles, and what an open really means.
  • ReceivingGuidesInbound mail, and the Inbox: a webhook fires, you read it, you answer it.
  • InboxGuidesChannels, personal mailboxes and seats: who sees what, and where a reply goes.
  • Node SDKGuidesThe rasket package: typed from the API's own document, retries only what is safe.
  • Python SDKGuidesThe rasket package on PyPI: the Node client's methods, in snake_case, over httpx.
  • MCP serverGuidesConnect Claude, ChatGPT or any MCP client: your scopes, no key.
  • AI assistGuidesSubject lines, drafts and diagnosis — in the dashboard and over the API, off until you allow it.
  • AgentsGuidesLet an AI agent set Rasket up: the skill, the rules file, MCP, and the recipe they share.
  • OAuthGuidesLet another app act for a team: register, authorize with PKCE, exchange, refresh.
  • Single sign-onGuidesOIDC login for your team, a domain proved by DNS, enforcement and break-glass.
  • IntegrationsGuidesVercel, Netlify and Cloudflare, plus Zapier and n8n for workflows without code.
  • SMTPGuidesSend from anything that speaks SMTP: settings, setup guides, limits and replies.
  • ZapierGuidesSend email, add contacts and react to email events from a Zap, with no code.
  • n8nGuidesThe Rasket node and trigger for n8n workflows: install, connect, every operation.
  • VercelGuidesAdd Rasket on Vercel: a Sending key in each project as RASKET_API_KEY, no copying.
  • EmailsAPI referenceSend, batch, retrieve, list, reschedule, cancel, attachments.
  • DomainsAPI referenceAdd a domain, publish its records, verify it.
  • API keysAPI referenceCreate, list, rename and revoke credentials.
  • WebhooksAPI referencePayloads, signature verification, retries and replay.
  • SuppressionsAPI referenceAddresses we will not send to, and why.
  • LogsAPI referenceEvery request made with this team's credentials.
  • MetricsAPI referenceDelivery, bounce, complaint and engagement counts.
  • TemplatesAPI referenceVersioned email content with typed variables, addressed by ID or alias.
  • ContactsAPI referenceYour audience: contacts, their typed properties, segments and topic choices.
  • SegmentsAPI referenceAudiences defined by a filter, by hand, or both.
  • TopicsAPI referenceWhat contacts subscribe to, and the preference page's list.
  • CampaignsAPI referenceCampaigns, at /broadcasts: one message to a segment, from draft to results.
  • ImportsAPI referenceCSV uploads: column mapping, conflicts and counts.
  • AutomationsAPI referenceWorkflows that run per contact: the graph, its versions, and every run.
  • Custom eventsAPI referenceThe names your product fires, and what starts a workflow.
  • ReceivingAPI referenceMail sent to you: the message, its attachments, its raw source.
  • OAuthAPI referenceClient registration, the token endpoint, and the grants a team has given.
  • TeamAPI referenceThe team a credential belongs to: its plan, sender identity, AI flag and members.
  • BillingAPI referencePlan, usage, invoices and add-ons, and the hosted pages where a customer pays.
  • AI helpersAPI referenceSubject lines, a first draft, and why an email did what it did.

GuidesPython SDK

Python SDK

The rasket package: a typed client for Python 3.10+, built on httpx. Its request and response types are generated from the same document the API is validated against, and its methods from the Node client's own route map, so the two cannot drift apart.

Coming soon: the rasket package is not published yet. It is not on PyPI, so there is nothing to install today. Until it is, call the REST API with requests or any HTTP client, as below, or connect an agent over MCP. The rest of this page describes the client as it will ship, so you know what to expect.

Today: the REST API

Every endpoint in the API reference has a Python tab that uses requests. This is the first send:

curl -X POST "https://api.rasket.com/emails" \
  -H "Authorization: Bearer $RASKET_API_KEY" \
  -H "User-Agent: acme-billing/1.0" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: order-1042" \
  -d '{
  "from": "Acme <orders@send.acme.example>",
  "to": ["ronald.williams@example.com"],
  "subject": "Your order has shipped",
  "html": "<p>Order 1042 left the warehouse this morning.</p>"
}'

The first send

import os

from rasket import Rasket

rasket = Rasket(
    api_key=os.environ["RASKET_API_KEY"],
    user_agent="acme-billing/1.0",
)

result = rasket.emails.send(
    {
        "from": "Acme <billing@acme.example>",
        "to": ["ronald.williams@example.com"],
        "subject": "Your receipt",
        "html": "<p>Thanks.</p>",
    },
    idempotency_key="receipt-1042",
)

print(result.body["id"])

The client sends a User-Agent of its own on every request, because a request without one is refused; whatever you pass as user_agent is appended to it, never substituted. Keys start with rk_, and an OAuth access token works wherever a key does. On a deployment host, pass base_url="https://<deployment-host>/api/v1".

What every call returns

result = rasket.emails.get(email_id)

result.body                 # the parsed body, typed per route
result.rate_limit           # RateLimit(limit=10, remaining=..., reset_seconds=...)
result.request_id           # the x-request-id to quote
result.idempotent_replayed  # True on a replay of an earlier keyed request

One shape for every method. For a list route, body is the { object, has_more, data } envelope described under pagination.

The same methods as the Node SDK

Every method of the Node SDK exists here under the same path, each segment in snake_case. Path parameters come first, then body or query as a dict; idempotency_key is a keyword.

Method names in both clients
NodePython
emails.sendrasket.emails.send(body, idempotency_key=...)
apiKeys.createrasket.api_keys.create(body)
webhooks.rotateSecretrasket.webhooks.rotate_secret(webhook_id)
templates.getrasket.templates.get(template_id)
emails.receiving.attachments.listrasket.emails.receiving.attachments.list(email_id, query)

Received mail

page = rasket.emails.receiving.list({"limit": 20}).body
message = rasket.emails.receiving.get(page["data"][0]["id"]).body

files = rasket.emails.receiving.attachments.list(message["id"]).body
for file in files["data"]:
    # A part we would not store is listed without a link; check before you follow it.
    if "download_url" not in file:
        continue
    download(file["download_url"])

rasket.emails.receiving.remove(message["id"])

emails.receiving is its own resource, not a filter over the mail you sent: a received message is never an emails row, and neither read accepts the other's IDs. The two download routes are deliberately not on this client — they answer bytes rather than JSON, so follow download_url with any HTTP client.

Idempotency

Pass idempotency_key to emails.send or batch.send — the two routes that take one. The client sends it verbatim and never generates a key of its own: a key it invented would make a retry look idempotent when you never asked for that.

  • 1–256 characters. A key outside that range is refused before any request is sent, as the same 400 invalid_idempotency_key the API would answer, with error.source == "client".
  • Scoped to your team, remembered for 24 hours.
  • A replay of a finished request returns the original response with idempotent_replayed set to True; a different payload under the same key is 409 invalid_idempotent_request.

Errors

from rasket import RasketApiError, RasketConnectionError

try:
    rasket.emails.send(message)
except RasketApiError as error:
    if error.name == "validation_error":
        reject(error.errors)  # (ValidationIssue(path=..., message=...), ...)
    elif error.name == "rate_limit_exceeded" and error.rate_limit:
        later(error.rate_limit.retry_after_seconds)
    else:
        raise  # error.status_code, error.message, error.request_id
except RasketConnectionError as error:
    ...  # error.reason: "network" or "timeout" -- no answer arrived

error.name is the API's stable vocabulary, not a class name — the same names the errors page lists. The one value outside it is unknown_error: the response carried no error body of ours, and status_code is whatever came back.

Retries

What is retried
RequestRetried on a 429 or 5xx?
GETAlways
emails.send and batch.send with an idempotency_keyYes: the key is what makes a repeat a replay
emails.send and batch.send without oneNever: at-most-once matters more than a saved round trip
Every other writeNever

retry-after is honoured when present, and a value above max_delay is not waited for — the error is raised at once with the header on it. Otherwise the wait is exponential with full jitter. A quota 429 is never retried, and neither is a 501; a 409 concurrent_idempotent_requests on a keyed send is, because it means your earlier attempt is landing.

from rasket import Rasket, RetryOptions

rasket = Rasket(
    api_key=api_key,
    timeout=30.0,
    retry=RetryOptions(attempts=3, min_delay=0.5, max_delay=8.0),
)

attempts=1 turns retrying off. timeout and both delays are in seconds, and the timeout applies per attempt.

Verifying a webhook

rasket.webhooks.verify checks a delivery's signature and returns the parsed event, or raises WebhookVerificationError with a reason. The same function is reachable from a client as client.webhooks.verify.

import os

from flask import Flask, request
from rasket import WebhookVerificationError, webhooks

app = Flask(__name__)


@app.post("/webhooks/rasket")
def receive():
    raw_body = request.get_data()  # the bytes, never request.json
    try:
        event = webhooks.verify(raw_body, request.headers, os.environ["RASKET_WEBHOOK_SECRET"])
    except WebhookVerificationError:
        return "invalid signature", 400
    handle(event)
    return "", 200

The signature covers the raw request body. A framework that parses JSON before your handler has already destroyed what was signed — read the bytes first: request.get_data() in Flask, await request.body() in FastAPI.

Worth knowing

  • The client is synchronous. Close its connection pool with rasket.close(), or use it as a context manager; pass http_client= to bring your own httpx.Client.
  • Timestamps are ISO 8601 UTC with milliseconds, everywhere.
  • scheduled_at takes an ISO 8601 instant or a phrase such as "in 2 hours", read as UTC. Anything the grammar does not cover is a 422.
  • webhooks.get returns the signing secret masked. It is in the create and rotate_secret responses and nowhere else.