# Switching providers

If your code was written for an email API with the same paths as ours, most of it keeps working once you change the base URL and the key. Here is what to change, what works as it is, and what behaves differently.

## What to change

- **The base URL** becomes `https://api.rasket.com`, with nothing after it: paths such as `/emails` go straight after the host. A trailing slash, or plain HTTP instead of HTTPS, is answered with a redirect, which some clients do not follow for a `POST`.
- **The key** becomes a Rasket key, which starts with `rk_`. It is sent the same way, as `Authorization: Bearer`. Make one on the dashboard's API keys page; the [authentication](https://www.rasket.com/docs/authentication) page says which kind.
- **Your sending domain** is added and verified again here. Its records are our own, including the DKIM record at `rasket._domainkey`, so both providers can send from it while you move. See [domains](https://www.rasket.com/docs/domains).

With a client library, set the base URL where the library takes it, usually an option when you create the client or an environment variable it reads, and leave every call as it is. Each [comparison](https://www.rasket.com/compare) says what that setting is called for that provider. Keep the key in an environment variable such as `RASKET_API_KEY`.

> Writing new code instead? Every request is plain HTTPS, and [send from any language](https://www.rasket.com/docs/any-language) has a tested program in eight languages.

## What stays the same

- Requests and answers are JSON with the same field names, and a refusal carries `statusCode`, `name` and `message`, with the same names for the same problems. One exception: a key we do not recognise is `401 invalid_api_key`, not a 403.
- Lists use `limit`, `after` and `before`, and answer `has_more` and `data`.
- `Idempotency-Key` on a send works as you expect, remembered for 24 hours.
- Every request needs a `User-Agent`. Client libraries send one; a request without one is refused with `403`.

Two things to check in your code: every time is ISO 8601 in UTC, such as `2026-09-08T20:41:00.000Z`, so code that compares times as strings in another format will not match; and the limit is 10 requests a second for the whole team, across all its keys ([rate limits](https://www.rasket.com/docs/rate-limits)).

## Calls that work unchanged

| Resource | Endpoints |
| --- | --- |
| Emails | `POST /emails/batch` |
| Received emails | `GET /emails/receiving/{email_id}`, `GET /emails/receiving/{email_id}/attachments` |
| Domains | `POST /domains/claim`, `GET /domains/{domain_id}/claim`, `POST /domains/{domain_id}/claim/verify`, `POST /domains/{domain_id}/verify`, `GET /domains/{domain_id}`, `GET /domains`, `DELETE /domains/{domain_id}` |
| API keys | `DELETE /api-keys/{api_key_id}` |
| Webhooks | `POST /webhooks`, `GET /webhooks`, `PATCH /webhooks/{webhook_id}`, `DELETE /webhooks/{webhook_id}`, `GET /webhooks/{webhook_id}/events/{event_id}`, `GET /webhooks/{webhook_id}/events/{event_id}/attempts`, `POST /webhooks/{webhook_id}/events/{event_id}/replay` |
| Suppressions | `POST /suppressions`, `POST /suppressions/batch/add`, `POST /suppressions/batch/remove`, `GET /suppressions/{suppression}`, `DELETE /suppressions/{suppression}` |
| Templates | `PATCH /templates/{id}`, `DELETE /templates/{id}`, `POST /templates/{id}/publish`, `POST /templates/{id}/duplicate` |
| Contacts | `DELETE /contacts/{id}`, `GET /contacts/{contact_id}/segments`, `POST /contacts/{contact_id}/segments/{segment_id}`, `DELETE /contacts/{contact_id}/segments/{segment_id}`, `GET /contacts/{contact_id}/topics`, `PATCH /contacts/{contact_id}/topics`, `POST /contact-properties`, `GET /contact-properties`, `GET /contact-properties/{id}`, `PATCH /contact-properties/{id}`, `DELETE /contact-properties/{id}`, `GET /contacts/imports`, `GET /contacts/imports/{id}` |
| Segments and topics | `POST /segments`, `GET /segments`, `GET /segments/{id}`, `DELETE /segments/{id}`, `POST /topics`, `GET /topics`, `GET /topics/{id}`, `PATCH /topics/{id}`, `DELETE /topics/{id}` |
| Broadcasts | `GET /broadcasts/{id}`, `PATCH /broadcasts/{id}`, `DELETE /broadcasts/{id}`, `POST /broadcasts/{id}/cancel`, `GET /broadcasts/{id}/recipients`, `GET /broadcasts/{id}/clicked-links` |
| Automations and events | `POST /automations`, `GET /automations/{automation_id}`, `PATCH /automations/{automation_id}`, `DELETE /automations/{automation_id}`, `POST /automations/{automation_id}/duplicate`, `POST /automations/{automation_id}/stop`, `POST /events`, `POST /events/send`, `GET /events/{identifier}`, `PATCH /events/{identifier}`, `DELETE /events/{identifier}` |
| Connected apps | `GET /oauth/grants`, `DELETE /oauth/grants/{oauth_grant_id}` |

## Calls that work, with a difference

These take the same request and answer the same shape. Each has one difference your code might notice; most only add fields or filters it can ignore.

| Endpoint | What is different |
| --- | --- |
| `POST /emails` | scheduled_at takes an ISO 8601 time or a short phrase such as in 2 hours or tomorrow at 9am; other phrases are refused with 422. Custom headers cannot replace From, To, Cc, Bcc, Subject, Message-ID or Date. |
| `GET /emails/{email_id}` | html and text are null once the email's body has passed its retention period. Adds tags and scheduled_at. |
| `GET /emails` | Adds optional filters. Leave them out and the list behaves as your client expects. |
| `PATCH /emails/{email_id}` | Answers object and id only, not the whole email. |
| `POST /emails/{email_id}/cancel` | Answers object and id only, not the whole email. |
| `POST /emails/{email_id}/share` | expires_in is a duration such as 10m or 2 hours, 48 hours at most. Adds expires_at. |
| `GET /emails/{email_id}/attachments` | download_url is our own link, valid for 15 minutes, that downloads the file. Fetch it before it expires. |
| `GET /emails/{email_id}/attachments/{attachment_id}` | download_url is our own link, valid for 15 minutes, that downloads the file. Fetch it before it expires. |
| `GET /emails/metrics` | unsubscribed and unsubscribe_rate are refused, as are the email and broadcast filters and dimensions and any time zone but UTC. Adds attempted and data_as_of. |
| `GET /emails/receiving` | Adds dropped_reason and optional filters. |
| `GET /emails/receiving/{email_id}/attachments/{attachment_id}` | download_url is our own link, valid for 15 minutes, that downloads the file. Fetch it before it expires. A part we did not store has no download_url. |
| `POST /domains` | The DKIM record is named rasket._domainkey and holds a 2048-bit key split into two strings. |
| `PATCH /domains/{domain_id}` | Turning off a domain's last capability is refused with 400. |
| `POST /api-keys` | The token starts with rk_. Adds optional Inbox and SMS access fields. |
| `GET /api-keys` | Adds optional fields. A client that ignores them is unaffected. |
| `PATCH /api-keys/{api_key_id}` | Adds optional fields. A client that ignores them is unaffected. |
| `GET /webhooks/{webhook_id}` | signing_secret is masked. Keep it from the create response, or reveal it in the dashboard. |
| `GET /webhooks/{webhook_id}/events` | Adds optional filters. Leave them out and the list behaves as your client expects. before works as well as after. |
| `GET /suppressions` | Adds optional filters. Leave them out and the list behaves as your client expects. |
| `GET /logs` | Needs a full-access key: a sending-only key is refused with 401 restricted_api_key. Adds optional fields and filters. |
| `GET /logs/{log_id}` | Needs a full-access key. request_body is redacted, and response_body is kept only for a refusal. |
| `POST /templates` | An alias is lower-case letters, digits, - and _, up to 63 characters, and cannot look like an id. Variables are typed. |
| `GET /templates/{id}` | Adds optional fields. A client that ignores them is unaffected. |
| `GET /templates` | Adds optional filters. Leave them out and the list behaves as your client expects. |
| `POST /contacts` | Segments and topics can be set on create. Adds subscription_status. |
| `GET /contacts` | Adds optional fields. A client that ignores them is unaffected. |
| `GET /contacts/{id}` | Adds subscription_status. unsubscribed is true both for someone who left and for someone who never subscribed. |
| `PATCH /contacts/{id}` | Setting unsubscribed unsubscribes the person from everything and records their consent change. |
| `POST /contacts/imports` | A multipart upload of up to 50 MB, imported in the background. |
| `PATCH /segments/{id}` | Adds an optional filter. Changing the rule is refused while a campaign to the segment is sending. |
| `POST /broadcasts` | With send set to true, the campaign is checked before it goes. A failed content check is refused with 422 and the checks in details. |
| `GET /broadcasts` | Adds optional filters. Leave them out and the list behaves as your client expects. |
| `POST /broadcasts/{id}/send` | Needs a verified domain, your postal address and a segment that resolves. A failed content check is refused with 422. |
| `GET /automations` | Adds optional filters. Leave them out and the list behaves as your client expects. |
| `GET /automations/{automation_id}/runs` | Adds optional filters. Leave them out and the list behaves as your client expects. A run that is waiting shows as running. |
| `GET /automations/{automation_id}/runs/{run_id}` | A step that is waiting shows as running. |
| `GET /events` | Adds optional filters. Leave them out and the list behaves as your client expects. |

## Calls that are not available

`POST /audiences`, `GET /audiences`, `GET /audiences/{id}`, `DELETE /audiences/{id}` answer `404 not_found`. Use [segments](https://www.rasket.com/docs/api-reference/segments) to group contacts instead.

## Webhooks

Events arrive with the same envelope, `type`, `created_at` and `data`, and the same event names, and they are signed the same way. Your verification code keeps working once it has the new signing secret, which starts with `whsec_` and is shown once when you create the endpoint. Recreate each endpoint here; see [events](https://www.rasket.com/docs/events) for every payload.

- Email events always carry `message_id`, even on `email.sent` and `email.failed`.
- Emails sent by an automation carry `automation_run_id`; other emails leave the field out.
- Open events keep the real user agent, mail-provider image proxies included.

## Moving an SMTP mailer

An app that sends over SMTP changes its settings and nothing else. Each message becomes one send through the API, so domains, suppressions and webhooks apply as they do to the API.

| Setting | Value |
| --- | --- |
| Host | `smtp.rasket.com` |
| Port | `465` (TLS from the start) or `587` (STARTTLS); `2465` and `2587` where a network blocks those |
| Username | `rasket` |
| Password | An API key that starts with rk_ |

| Moving from | What changes |
| --- | --- |
| [SendGrid](https://www.rasket.com/migrate/sendgrid) | The username `apikey` becomes `rasket`, and the password becomes a Rasket key. |
| Postmark | The server token you sign in with becomes the username `rasket` and a Rasket key as the password. |
| Mailgun | The `postmaster@` login becomes the username `rasket`, and the password becomes a Rasket key. |

Every move points the host at `smtp.rasket.com`. Port 25 is not offered, so a mailer set to it, or to 2525, moves to one of the ports above. The relay also accepts the username and idempotency header of the API that shares our paths, so a mailer set up for it changes only the host and the password.

- **Idempotency.** Put an `X-Rasket-Idempotency-Key` header on the message to make a retry safe. Without one, the relay makes a key from the message's `Message-ID` and envelope, so the same message sent twice is sent once. SendGrid, Postmark and Mailgun have no SMTP header the relay reads.
- **Provider headers.** Remove headers meant for your old provider, such as `X-SMTPAPI`: the relay passes `X-` headers on, so the recipient would see them.
- **Size.** A message over SMTP can be about 4 MB with its attachments. Send anything bigger through the API.

Every setting, refusal code and setup guide is on the [SMTP relay](https://www.rasket.com/docs/smtp) page.

## Contacts, lists and templates

Moving your audience is a separate step that never sends anything: [migrating to Rasket](https://www.rasket.com/docs/migrating) brings contacts, unsubscribes, lists, segments and templates from your old platform.
