Skip to Content
Pouch
Keys

Create a key

POST
/v1/keys

Auth: Bearer key with no domain scope.

The secret is in this response and nowhere else. A test-mode key can only create test-mode keys, and a key limited to domains can't manage keys at all.

Authorization

bearer
headerAuthorizationBearer <token>

An API key in the Authorization header.

Request Body

application/json
  1. body
name*string

Name for the key. Letters, digits and hyphens, unique among the organization's live keys.

Match^[a-zA-Z0-9-]+$
Length1 <= length <= 64
mode?string

live sends real mail; test routes every send to the mock provider. A test key can only create test keys.

Default"live"
Value in"live""test"
domain_ids?array<>

Domains this key may send from. Empty means every domain in the organization.

Default[]
rate_limit?integer

Requests a minute this key is allowed, 1-10000. The install's default for new keys when absent: 3000 unless an admin changed it.

Range1 <= value <= 10000

Response Body

The created key, with its secret.

application/json
  1. response
id?string

Opaque id, prefixed key_.

name?string

Name the key was created with.

mode?string

test routes every send to the mock provider.

Value in"live""test"
secret_prefix?string

Leading characters of the secret, enough to tell two keys apart. Never the secret.

domain_ids?array<string>

Domains the key may send from. Empty means every domain in the organization.

rate_limit?integer

Requests a minute this key is allowed.

last_used_at?|

ISO 8601 timestamp of the last request that authenticated with it, over HTTP or SMTP, written at most once a minute. Null until the key's first request.

revoked_at?|

ISO 8601 timestamp, or null while the key works.

created_at?string

ISO 8601 timestamp.

secret?string

The full key. Returned by this call only — it's stored as a hash and can't be read back.

Example Request
curl -X POST 'https://pouch.example.com/v1/keys' \  -H 'Content-Type: application/json' \  -d '{  "name": "string"}'
Example Response
{  "id": "string",  "name": "string",  "mode": "live",  "secret_prefix": "string",  "domain_ids": [    "string"  ],  "rate_limit": 0,  "last_used_at": "string",  "revoked_at": "string",  "created_at": "string",  "secret": "string"}