SDK
The API as a typed TypeScript client: every method, with the same names and the same input.
Get it
It runs wherever fetch does: Node.js 20 or newer, Bun, Deno and edge runtimes. It has no dependencies. This is version 0.1.0.
Make a client
With nothing given, the client reads the key from OPENSEND_API_KEY and calls our cloud, at https://api.opensend.sh. Set OPENSEND_API_URL to reach a server of your own.
import { OpenSend } from '@open-send/opensend' export const opensend = new OpenSend()Or give them yourself.
import { OpenSend } from '@open-send/opensend' export const opensend = new OpenSend(process.env.OPENSEND_API_KEY, { baseUrl: 'http://localhost:2222', timeoutMs: 10_000,})- Option
baseUrl- Meaning
- The address of the API. Without it the client reads
OPENSEND_API_URL, and without that it calls our cloud.
- Option
timeoutMs- Meaning
- How long to wait for an answer. Without it the client waits 30 seconds.
- Option
fetch- Meaning
- A
fetchof your own, for a proxy or a test.
createOpenSend(key, options) makes the same client without new.
Call a method
A method is opensend.<resource>.<method>(input), and it answers with what the API answers. A method that acts on one thing also takes the id first.
import { OpenSend } from '@open-send/opensend' const opensend = new OpenSend() const list = await opensend.emails.list({ status: 'bounced', limit: 20 }) const email = await opensend.emails.get('em_02') const moved = await opensend.emails.update('em_09', { scheduledAt: '2026-12-05T09:00:00Z' }) const stopper = new AbortController()const sent = await opensend.emails.send( { from: 'Acme <hello@mail.example.com>', to: 'ada@example.com', subject: 'Your receipt for November', text: 'Thanks for your order.', }, { idempotencyKey: 'receipt-2026-11-ada', signal: stopper.signal },) console.log(list.total, email.status, moved.scheduledAt, sent.id)The last argument holds what belongs to this one call.
- Option
idempotencyKey- Meaning
- Sent as the
idempotency-keyheader, so a retry sends nothing twice.
- Option
signal- Meaning
- An
AbortSignalthat gives the call up early.
The input and the answer of every method are typed, from the same schemas the API checks them with.
Errors
A call that fails throws OpenSendError. Its code is the one to branch on, status is the HTTP status, message says what is wrong, and requestId finds the request in the logs.
import { OpenSend, OpenSendError } from '@open-send/opensend' const opensend = new OpenSend() try { await opensend.domains.create({ name: 'mail.example.com' })} catch (error) { if (!(error instanceof OpenSendError)) throw error if (error.code === 'domain_taken') { console.log(error.message, error.status, error.requestId) }}The API has its own error codes. The client adds these for what goes wrong before or without an answer, with status set to null.
- Code
missing_api_key- Meaning
- No key was given to the client, and none is in the environment.
- Code
missing_parameter- Meaning
- A value the request needs, such as an id, was not given.
- Code
network_error- Meaning
- The API could not be reached.
- Code
timeout- Meaning
- The API did not answer in time.
- Code
unexpected_response- Meaning
- The API answered with something that is not JSON.
- Code
invalid_signature- Meaning
- The signature of a webhook is missing, too old or wrong.
Webhooks
verifyWebhook checks the signature of a request to your endpoint and returns the event. Webhooks shows a whole handler. The name of the header, opensend-signature, is exported too, as OPENSEND_SIGNATURE_HEADER.
Other languages
TypeScript is the only SDK there is. From any other language, call the API over HTTP: the reference shows every request as cURL, and GET /v1/openapi.json is an OpenAPI document that a generator can turn into a client.
Every method
Emails
- Method
opensend.emails.send()- What it does
- Send email
- Method
opensend.emails.batch()- What it does
- Send emails in a batch
- Method
opensend.emails.update()- What it does
- Reschedule email
- Method
opensend.emails.cancel()- What it does
- Cancel email
- Method
opensend.emails.get()- What it does
- Retrieve email
- Method
opensend.emails.list()- What it does
- List emails
Received emails
- Method
opensend.inbound.list()- What it does
- List received emails
- Method
opensend.inbound.get()- What it does
- Retrieve received email
Domains
- What it does
- Add domain
- What it does
- Verify domain
- Method
opensend.domains.get()- What it does
- Retrieve domain
- Method
opensend.domains.list()- What it does
- List domains
- What it does
- Update domain
- What it does
- Delete domain
Templates
- What it does
- Create template
- Method
opensend.templates.get()- What it does
- Get template
- What it does
- List templates
- What it does
- Update template
- What it does
- Edit template design
- What it does
- Publish template
- What it does
- Send test of template
- What it does
- Render template design
- What it does
- Duplicate template
- What it does
- List template versions
- What it does
- Get template version
- What it does
- Restore template version
- What it does
- Delete template
- What it does
- List template starters
- What it does
- Get template starter
Images
- Method
opensend.images.add()- What it does
- Add image
- Method
opensend.images.upload()- What it does
- Upload image
- Method
opensend.images.list()- What it does
- List images
- Method
opensend.images.get()- What it does
- Retrieve image
- Method
opensend.images.remove()- What it does
- Delete image
Broadcasts
- What it does
- Create broadcast
- What it does
- Update broadcast
- What it does
- Send broadcast
- What it does
- Send test of broadcast
- What it does
- Duplicate broadcast
- What it does
- Retrieve broadcast
- What it does
- List broadcasts
- What it does
- Delete broadcast
Audiences
- What it does
- Create audience
- What it does
- List audiences
- Method
opensend.audiences.get()- What it does
- Retrieve audience
- What it does
- Rename audience
- What it does
- Delete audience
- What it does
- Add contact to audience
- What it does
- Remove contact from audience
Contacts
- What it does
- Add contact
- Method
opensend.contacts.list()- What it does
- List contacts
- Method
opensend.contacts.get()- What it does
- Retrieve contact
- What it does
- Update contact
- What it does
- Delete contact
Contact properties
- What it does
- Create contact property
- What it does
- List contact properties
- What it does
- Retrieve contact property
- What it does
- Update contact property
- What it does
- Delete contact property
Topics
- Method
opensend.topics.create()- What it does
- Create topic
- Method
opensend.topics.list()- What it does
- List topics
- Method
opensend.topics.get()- What it does
- Retrieve topic
- Method
opensend.topics.update()- What it does
- Update topic
- Method
opensend.topics.remove()- What it does
- Delete topic
Suppressions
- What it does
- Suppress an address
- What it does
- List suppressed addresses
- What it does
- Remove a suppressed address
Automations
- What it does
- Create automation
- What it does
- Update automation
- What it does
- Publish automation
- What it does
- Pause automation
- What it does
- Resume automation
- What it does
- Test automation
- What it does
- Enrol in automation
- What it does
- Duplicate automation
- What it does
- Retrieve automation
- What it does
- List automations
- What it does
- Delete automation
Runs
- Method
opensend.runs.list()- What it does
- List runs
- Method
opensend.runs.get()- What it does
- Retrieve run
- Method
opensend.runs.cancel()- What it does
- Cancel run
- Method
opensend.runs.retry()- What it does
- Retry run
Events
- Method
opensend.events.send()- What it does
- Send event
- Method
opensend.events.create()- What it does
- Define event
- Method
opensend.events.list()- What it does
- List events
- Method
opensend.events.get()- What it does
- Retrieve event
- Method
opensend.events.update()- What it does
- Update event
- Method
opensend.events.remove()- What it does
- Delete event
Webhooks
- What it does
- Add webhook
- Method
opensend.webhooks.list()- What it does
- List webhooks
- What it does
- Update webhook
- What it does
- Delete webhook
- Method
opensend.webhooks.test()- What it does
- Send test event
- What it does
- List webhook deliveries
Metrics
- Method
opensend.metrics.get()- What it does
- Retrieve metrics
Logs
- Method
opensend.logs.list()- What it does
- List logs
- Method
opensend.logs.get()- What it does
- Retrieve log
API keys
- What it does
- Create API key
- What it does
- Enroll existing API key
- Method
opensend.apiKeys.list()- What it does
- List API keys
- What it does
- Revoke API key
Imports
- What it does
- Look into another account
- What it does
- Start import
- Method
opensend.imports.get()- What it does
- Retrieve import
- Method
opensend.imports.list()- What it does
- List imports
- What it does
- Cancel import
Workspace
- Method
opensend.workspace.get()- What it does
- Retrieve workspace
- What it does
- Update workspace
- What it does
- Close workspace
Members
- What it does
- Invite member
- Method
opensend.members.list()- What it does
- List members
- What it does
- Update member
- What it does
- Remove member
Billing
- Method
opensend.billing.plans()- What it does
- List plans
- What it does
- Start checkout
- What it does
- Open billing portal
- What it does
- List invoices
Server
- Method
opensend.server.get()- What it does
- Retrieve server settings
- Method
opensend.server.update()- What it does
- Update server settings
Account
- Method
opensend.account.get()- What it does
- Retrieve account
Methods
- Method
opensend.methods.list()- What it does
- List methods
Assistant
- Method
opensend.ask.send()- What it does
- Ask the assistant
- Method
opensend.ask.chats()- What it does
- List chats
- Method
opensend.ask.chat()- What it does
- Retrieve chat
- Method
opensend.ask.save()- What it does
- Keep chat
- Method
opensend.ask.forget()- What it does
- Forget chat