# SDKs

Mailset has an official SDK for each language below. Every one builds the message, signs each request with your key and checks the answer, and has a typed method for every command of the API.

- [TypeScript](https://mailset.app/docs/sdk/typescript): and JavaScript · Node.js 20+, Bun 1.4+, Deno 2.9+, Cloudflare Workers
- [Python](https://mailset.app/docs/sdk/python): Python 3.9+
- [Go](https://mailset.app/docs/sdk/go): Go 1.22+
- [Ruby](https://mailset.app/docs/sdk/ruby): Ruby 3.0+
- [PHP](https://mailset.app/docs/sdk/php): PHP 8.1+
- [Java](https://mailset.app/docs/sdk/java): Java 17+
- [Rust](https://mailset.app/docs/sdk/rust): Rust 1.88+
- [CLI](https://mailset.app/docs/cli): macOS, Linux
- [HTTP API](https://mailset.app/docs/authentication/http): Any language

Or start from your framework. Each guide runs from install to webhooks.

- [Next.js](https://mailset.app/send-email/nextjs): TypeScript · send and webhooks
- [Express](https://mailset.app/send-email/express): TypeScript · send and webhooks
- [NestJS](https://mailset.app/send-email/nestjs): TypeScript · send and webhooks
- [Cloudflare Workers](https://mailset.app/send-email/cloudflare-workers): TypeScript · send and webhooks
- [FastAPI](https://mailset.app/send-email/fastapi): Python · send and webhooks
- [Django](https://mailset.app/send-email/django): Python · send and webhooks
- [Flask](https://mailset.app/send-email/flask): Python · send and webhooks
- [Rails](https://mailset.app/send-email/rails): Ruby · send and webhooks
- [Laravel](https://mailset.app/send-email/laravel): PHP · send and webhooks
- [Symfony](https://mailset.app/send-email/symfony): PHP · send and webhooks
- [Spring Boot](https://mailset.app/send-email/spring-boot): Java · send and webhooks

## What every SDK does the same

The SDKs are written to one contract, so what you learn in one language holds in the next.

- **Every public command**: 238 commands, each a typed method
- **Retries built in**: Two more tries, and a send never doubles
- **Timeouts per try**: 30 seconds a try, then tried again
- **Idempotency keys**: A send repeated with its key goes once
- **Webhook verification**: Signatures checked, every event typed
- **Credential check**: Refused before sending if your key can’t

### Credentials

A client made with no arguments reads `MAILSET_KEY` from the environment, and `MAILSET_TOKEN` when there is no key. A key or a token you pass in wins over both: [Use it](https://mailset.app/docs/authentication#use-it) shows the client both ways. [Authentication](https://mailset.app/docs/authentication) says how to make each.

An app key sends as the mailboxes it was approved for. An API token is a person's, for the commands no app key can run, such as adding a domain. A command the client's credential can't run is refused before any request leaves, with an error that names the credential it needs.

### Retries and timeouts

A call that gets no answer, or a 5xx one, is tried again: twice unless you set otherwise, waiting longer each time. A refusal is never tried again, since the same request gets the same answer. One try may take 30 seconds unless you set another limit, for the client or for one call.

A send is safe to try again. It keeps its Message-ID, so Mailset never sends it twice.

### Errors

Every refusal is one kind of error, with the same fields in every language: `code`, which never changes and is what your code branches on, `message` for people, the HTTP `status`, and on some codes `refusal`, `retryAt` and `issues`. Each error also carries a link to its code in [Errors and limits](https://mailset.app/docs/errors).

### Idempotency

Give a send an `idempotencyKey`, and sending it again after a timeout or a crash sends nothing new: the same key from the same address answers the first receipt. [Retry without sending twice](https://mailset.app/docs/recipes/retries) has the rules.

### The Mailset-Client header

Every request carries a `Mailset-Client` header: the SDK's language and version, then the framework, the runtime and the operating system it found. It tells Mailset which SDKs are in use. It names no host, path, user or app.

Mailset keeps the SDK's name and version with each message it sends, and your organization sees them as `client` on every delivery line of that message.

### Versions

Every Mailset SDK ships under the same version number.

### Names

A field keeps its name in every SDK, in each language's own case.

| Language | `idempotencyKey` is written |
| --- | --- |
| [TypeScript](https://mailset.app/docs/sdk/typescript) | `idempotencyKey` |
| [Python](https://mailset.app/docs/sdk/python) | `idempotency_key` |
| [Go](https://mailset.app/docs/sdk/go) | `IdempotencyKey` |
| [Ruby](https://mailset.app/docs/sdk/ruby) | `idempotency_key` |
| [PHP](https://mailset.app/docs/sdk/php) | `idempotencyKey` |
| [Java](https://mailset.app/docs/sdk/java) | `idempotencyKey` |
| [Rust](https://mailset.app/docs/sdk/rust) | `idempotency_key` |

A method is named for its command, as `domains.add` is. Where a language can't spell one, the method gets a name that says what it does.

| Language | Command | Its method | Why |
| --- | --- | --- | --- |
| [Python](https://mailset.app/docs/sdk/python#names) | [`contacts.import`](https://mailset.app/docs/api/contacts#contacts.import) | `import_contacts` | `import` is a hard keyword in Python: `contacts.import(…)` doesn’t parse. |
| [Python](https://mailset.app/docs/sdk/python#names) | [`rules.import`](https://mailset.app/docs/api/rules#rules.import) | `import_rules` | `import` is a hard keyword in Python. |
| [Ruby](https://mailset.app/docs/sdk/ruby#names) | [`messages.send`](https://mailset.app/docs/api/messages#messages.send) | `send_message` | `send` is `Object#send`, which Ruby itself and many libraries call. |
| [Java](https://mailset.app/docs/sdk/java#names) | [`billing.switch`](https://mailset.app/docs/api/billing#billing.switch) | `switchPlan` | `switch` is a Java keyword. |
| [Java](https://mailset.app/docs/sdk/java#names) | [`addresses.default`](https://mailset.app/docs/api/addresses#addresses.default) | `setDefault` | `default` is a Java keyword. |
| [Java](https://mailset.app/docs/sdk/java#names) | [`contacts.import`](https://mailset.app/docs/api/contacts#contacts.import) | `importContacts` | `import` is a Java keyword. |
| [Java](https://mailset.app/docs/sdk/java#names) | [`rules.import`](https://mailset.app/docs/api/rules#rules.import) | `importRules` | `import` is a Java keyword. |

Mascots: [Duke](https://github.com/openjdk/duke) by Joe Palrang for Sun Microsystems, [BSD](https://opensource.org/license/bsd-3-clause); [the Go gopher](https://go.dev/blog/gopher) by Renée French, [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); [Ferris](https://rustacean.net) by Karen Rustad Tölva, [CC0](https://creativecommons.org/publicdomain/zero/1.0/). Each is simplified here to read at a small size.

---

© 2026 Intenseloop, Inc. Mailset’s site, docs and guides are copyrighted. You may read them and use their code to build with Mailset. Don’t republish them or use them to build a copy of Mailset. Terms: https://mailset.app/terms#content