Moving in

TypeScript SDK

A typed client over the whole API. Node 18 or newer; ESM and CommonJS both work.

Installnpm install transmitdev
Sendimport { Transmit } from "transmitdev";

const transmit = new Transmit({ apiKey: process.env.TRANSMIT_API_KEY });

const { id } = await transmit.emails.send({
  from: "hello@yourdomain.com",
  to: "you@example.com",
  subject: "It arrived.",
  text: "Nobody noticed. That is the job.",
});

apiKey falls back to TRANSMIT_API_KEY and baseUrl to TRANSMIT_BASE_URL, so a deployment can be configured entirely from the environment.

What it reaches

FieldTypeNotes
emailssendQueue a message.
smssend, list, getTransactional SMS and its history.
templateslist, create, get, update, deleteReusable subject and body.
contactslist, upsertPeople, matched on email.
audienceslist, createNamed sets of contacts.
campaignslist, createA template to an audience.
webhookslist, create, update, deleteEndpoints and their events.
analyticsgetDaily delivery totals.

Idempotency and retries

Sends carry a generated idempotency key, which is also what makes the client's automatic retries safe. Pass { idempotencyKey } to make retries from your side safe too. Rate limits and 5xx are retried with backoff, honouring Retry-After; a create the server cannot recognise as a repeat is never retried.

Errors

Catching what you meanimport { RateLimitError, ValidationError } from "transmitdev";

try {
  await transmit.emails.send(message);
} catch (error) {
  if (error instanceof ValidationError) return fix(error.details);
  if (error instanceof RateLimitError) return retryIn(error.retryAfterSeconds);
  throw error;
}

Every failure is a TransmitError carrying status, code and details. See errors for what each status means.

Every method is checked against the published spec in our CI, so the client cannot name an endpoint the API does not serve.