Account
More ways to use this page
Keys
Every request carries an API key as a bearer token. There are two kinds, and an operation takes only one of them. A missing, malformed or revoked key fails with 401 unauthorized, and the response includes the header WWW-Authenticate: Bearer.
Two kinds of key
| Server key | Account key | |
|---|---|---|
| Starts with | sk_, or sk_ on a test server | ak_ |
| Belongs to | One server | The account |
| Does | Sends, reads the message log, and manages the server’s streams, suppressions, webhooks and its own keys. An SMTP client signs in with it. | Creates, renames and deletes servers, manages every server’s keys, and manages the sending and tracking domains. |
| Never | Manages the account’s servers or domains | Sends or reads mail |
| Made | With its server, or by the server’s own key or the account key | By an administrator in the dashboard, under Account › Account keys. The API cannot make one. |
Your application holds a server key. Keys have no narrower scopes: every key of a server can do all that a server key does. A key of the wrong kind fails with 403 wrong_, and the message names the kind the operation needs.
The SDK has a client for each: Sendora takes a server key, and SendoraAccount an account key. Keep both in the environment on the server, as SENDORA_ and SENDORA_. Never ship either to a browser.
The SDK has a client for each: Sendora takes a server key, and SendoraAccount an account key. Keep both in the environment on the server, as SENDORA_ and SENDORA_. Each client reads its own variable when you give it no key.
The SDK has a client for each: Sendora takes a server key, and SendoraAccount an account key. Keep both in the environment on the server, as SENDORA_ and SENDORA_. Each client reads its own variable when you give it no key, from $_SERVER, $_ENV or getenv(), so a framework’s .env loader works.
The SDK has a client for each: Sendora takes a server key, and SendoraAccount an account key. Keep both in the environment on the server, as SENDORA_ and SENDORA_. Sendora and SendoraAccount each read their own variable. Build each client once and share it, since it is safe to use from many threads.
A server comes with its first key
A new server comes with a default transactional stream and its first key, whether you create it in the dashboard or with the account key. The response shows the key’s value, and only this once:
POST /v1/serverscurl -X POST https://api.sendora.se/v1/servers \
-H "Authorization: Bearer $SENDORA_ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Invoicing"
}'import { SendoraAccount } from '@sendora/sdk';
const account = new SendoraAccount({
token: process.env.SENDORA_ACCOUNT_TOKEN,
});
const server = await account.servers.create({
name: 'Invoicing',
});
console.log(server.serverId);
console.log(server.token.token);import os
from sendora import SendoraAccount
account = SendoraAccount(
os.environ["SENDORA_ACCOUNT_TOKEN"]
)
server = account.servers.create(name="Invoicing")
print(server.server_id)
print(server.token.token)<?php
use Sendora\SendoraAccount;
// The key comes from SENDORA_ACCOUNT_TOKEN.
$account = new SendoraAccount();
$server = $account->servers->create(name: 'Invoicing');
echo $server->serverId, "\n";
echo $server->token->token, "\n";import se.sendora.SendoraAccount;
import se.sendora.model.CreateServerRequest;
import se.sendora.model.CreatedServer;
class CreateServer {
public static void main(String[] args) {
CreateServerRequest request =
CreateServerRequest.builder()
.name("Invoicing")
.build();
// The account key comes from SENDORA_ACCOUNT_TOKEN.
try (var account = SendoraAccount.fromEnv()) {
CreatedServer server =
account.servers().create(request);
System.out.println(server.serverId());
System.out.println(server.token().token());
}
}
}Response
{
"serverId": "7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70",
"name": "Invoicing",
"mode": "live",
"createdAt": "2026-09-20T12:00:00.000Z",
"token": {
"tokenId": "3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40",
"name": "default",
"prefix": "sk_a1b2c3d4e5",
"createdAt": "2026-09-20T12:00:00.000Z",
"revokedAt": null,
"token": "sk_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v"
}
}Store token in your secret store. It is never shown again.
Create and list keys
A server holds at most two live keys: the one in use and the one being rotated in. The account holds at most two live account keys the same way. A third fails with 409 token_. A key’s name only helps people tell the keys apart.
Create a key:
POST /v1/servers/{serverId}/tokenscurl -X POST https://api.sendora.se/v1/servers/{serverId}/tokens \
-H "Authorization: Bearer $SENDORA_ACCOUNT_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Invoicing system"
}'import { SendoraAccount } from '@sendora/sdk';
const account = new SendoraAccount({
token: process.env.SENDORA_ACCOUNT_TOKEN,
});
const key = await account.servers.tokens.create(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
{ name: 'Invoicing system' },
);
console.log(key.token);import os
from sendora import SendoraAccount
account = SendoraAccount(
os.environ["SENDORA_ACCOUNT_TOKEN"]
)
key = account.servers.tokens.create(
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70",
name="Invoicing system",
)
print(key.token)<?php
use Sendora\SendoraAccount;
// The key comes from SENDORA_ACCOUNT_TOKEN.
$account = new SendoraAccount();
$key = $account->servers->tokens->create(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
name: 'Invoicing system',
);
echo $key->token, "\n";import se.sendora.SendoraAccount;
import se.sendora.model.CreatedToken;
class CreateKey {
public static void main(String[] args) {
String serverId =
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70";
// The account key comes from SENDORA_ACCOUNT_TOKEN.
try (var account = SendoraAccount.fromEnv()) {
var tokens = account.servers().tokens();
CreatedToken key =
tokens.create(serverId, "Invoicing system");
System.out.println(key.token());
}
}
}Response
{
"tokenId": "9f2d7e6c-5b40-4e8b-8a1c-3b0c9e2f6d4a",
"name": "Invoicing system",
"prefix": "sk_c3d4e5f6g7",
"createdAt": "2026-09-20T12:05:00.000Z",
"revokedAt": null,
"token": "sk_c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0u1v2w3x"
}List a server’s keys:
GET /v1/servers/{serverId}/tokenscurl https://api.sendora.se/v1/servers/{serverId}/tokens \
-H "Authorization: Bearer $SENDORA_ACCOUNT_TOKEN"import { SendoraAccount } from '@sendora/sdk';
const account = new SendoraAccount({
token: process.env.SENDORA_ACCOUNT_TOKEN,
});
const { tokens } = await account.servers.tokens.list(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
);
for (const key of tokens) {
console.log(
key.name,
key.prefix,
key.revokedAt ? 'revoked' : 'live',
);
}import os
from sendora import SendoraAccount
account = SendoraAccount(
os.environ["SENDORA_ACCOUNT_TOKEN"]
)
listed = account.servers.tokens.list(
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70"
)
for key in listed.tokens:
print(
key.name,
key.prefix,
"revoked" if key.revoked_at else "live",
)<?php
use Sendora\SendoraAccount;
// The key comes from SENDORA_ACCOUNT_TOKEN.
$account = new SendoraAccount();
$listed = $account->servers->tokens->list(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
);
foreach ($listed->tokens as $key) {
printf(
"%s %s %s\n",
$key->name,
$key->prefix,
$key->revokedAt === null ? 'live' : 'revoked',
);
}import se.sendora.SendoraAccount;
import se.sendora.model.TokenList;
class ListKeys {
public static void main(String[] args) {
String serverId =
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70";
// The account key comes from SENDORA_ACCOUNT_TOKEN.
try (var account = SendoraAccount.fromEnv()) {
var tokens = account.servers().tokens();
TokenList listed = tokens.list(serverId);
for (var key : listed.tokens()) {
System.out.printf(
"%s %s %s%n",
key.name(),
key.prefix(),
key.revokedAt().isEmpty()
? "live"
: "revoked");
}
}
}
}Response
{
"tokens": [
{
"tokenId": "3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40",
"name": "default",
"prefix": "sk_a1b2c3d4e5",
"createdAt": "2026-09-20T12:00:00.000Z",
"revokedAt": null
},
{
"tokenId": "9f2d7e6c-5b40-4e8b-8a1c-3b0c9e2f6d4a",
"name": "Invoicing system",
"prefix": "sk_c3d4e5f6g7",
"createdAt": "2026-09-20T12:05:00.000Z",
"revokedAt": null
}
]
}These samples use the account key. A server key manages its own server’s keys the same way:
| Key | Manages the keys of | Path |
|---|---|---|
| Server key | Its own server | /v1/ |
| Account key | Any server of the account | /v1/ |
With a server key, sendora, sendora and sendora manage the server’s own keys.
With a server key, sendora, sendora and sendora manage the server’s own keys.
With a server key, $sendora->tokens->create(, $sendora->tokens->list() and $sendora->tokens->revoke( manage the server’s own keys.
With a server key, sendora, sendora and sendora manage the server’s own keys.
Rotation is create, switch, revoke
- Create the new key.
- Move your systems to it; both keys work meanwhile.
- Revoke the old one. It stops working at once.
DELETE /v1/servers/{serverId}/tokens/{tokenId}curl -X DELETE https://api.sendora.se/v1/servers/{serverId}/tokens/{tokenId} \
-H "Authorization: Bearer $SENDORA_ACCOUNT_TOKEN"import { SendoraAccount } from '@sendora/sdk';
const account = new SendoraAccount({
token: process.env.SENDORA_ACCOUNT_TOKEN,
});
await account.servers.tokens.revoke(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
'3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40',
);import os
from sendora import SendoraAccount
account = SendoraAccount(
os.environ["SENDORA_ACCOUNT_TOKEN"]
)
account.servers.tokens.revoke(
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70",
"3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40",
)<?php
use Sendora\SendoraAccount;
// The key comes from SENDORA_ACCOUNT_TOKEN.
$account = new SendoraAccount();
$account->servers->tokens->revoke(
'7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70',
'3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40',
);import se.sendora.SendoraAccount;
class RevokeKey {
public static void main(String[] args) {
String serverId =
"7c1e4d2a-0b9f-4a3e-8d6c-5e2f1a9b8c70";
String tokenId =
"3b0c9e2f-6d4a-4e8b-8a1c-9f2d7e6c5b40";
// The account key comes from SENDORA_ACCOUNT_TOKEN.
try (var account = SendoraAccount.fromEnv()) {
var tokens = account.servers().tokens();
tokens.revoke(serverId, tokenId);
}
}
}The last live key of a server or of the account cannot be revoked (409 last_), so nothing is ever locked out by mistake. A revoked key stays in the list with its revokedAt, so the history is visible.
If a key leaks, rotate it at once. You cannot revoke a server’s only key, so create the new key first. For an account key, an administrator does the same under Account › Account keys. Keys are stored hashed and never shown again, so revoke any key you cannot account for.