Skip to content
On this site

API keys

A key is a bearer credential scoped to one team. It is shown once, stored as a hash, and can be narrowed to a single domain.

Permissions

The two key permissions
PermissionReachesUse it for
full_accessEvery endpoint, including creating and revoking other keys.Your server, when it genuinely needs to manage domains and keys.
sending_accessSending only. Any other endpoint answers 401 restricted_api_key.Anything whose job is to send mail — which is most things.

A sending_access key may also carry domain_id, which pins it to one verified domain: a request whose from is on any other domain is refused. A full_access key carrying domain_id is rejected at creation rather than silently ignored.

Handling the token

  • The token starts with rk_ and is returned by the create response and nowhere else. We store only its hash, so a lost token cannot be recovered — mint a new key and revoke the old one.
  • Keep it in an environment variable or a secret manager. Every example on this site reads it from the environment for that reason.
  • last_used_at on the list endpoint tells you whether a key is still in use before you revoke it.

If a key is exposed, revoke it first and investigate second. Revocation takes effect on the next request, and the row is kept so your audit history still reads correctly.

Endpoints

POST /api-keys

Mint a key and read its token — once.

Body

Body
FieldTypeDescription
name*stringWhat the key is for, up to 255 characters. It appears in the dashboard and in audit records.
permissionstringfull_access (the default) reaches every endpoint. sending_access may only send.
domain_idstringRestrict the key to one verified domain. Allowed only with sending_access; a full_access key carrying it is refused.
curl -X POST "https://api.rasket.com/api-keys" \
  -H "Authorization: Bearer $RASKET_API_KEY" \
  -H "User-Agent: acme-billing/1.0" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "billing worker",
  "permission": "sending_access",
  "domain_id": "d91a7b60-1a5f-4a2e-9d1b-0d9f2c7a1e34"
}'

Response 201

{
  "id": "a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75",
  "token": "rk_live_2f7a9c1d8e3b5074a6c2f019d4b83e5a"
}
  • token is returned by this response and never again. Store it before you close the connection; we keep only its hash.
  • A key inherits the team it was created in. It cannot reach another team's data.

GET /api-keys

Every key on the team, without its token.

Query parameters

Query parameters
FieldTypeDescription
limitintegerHow many items to return, 1–100. Defaults to 20.
afterstringReturn the page that follows this item ID. Mutually exclusive with before.
beforestringReturn the page that precedes this item ID. Mutually exclusive with after.
statusstringFilter by active, revoked or suspended.
curl -X GET "https://api.rasket.com/api-keys" \
  -H "Authorization: Bearer $RASKET_API_KEY" \
  -H "User-Agent: acme-billing/1.0"

Response 200

{
  "object": "list",
  "has_more": false,
  "data": [
    {
      "id": "a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75",
      "name": "billing worker",
      "created_at": "2026-09-09T09:11:07.552Z",
      "last_used_at": "2026-09-09T10:14:02.118Z",
      "permission": "sending_access",
      "domain_id": "d91a7b60-1a5f-4a2e-9d1b-0d9f2c7a1e34",
      "key_prefix": "rk_live",
      "status": "active",
      "last_used_request_log_id": "req_8f21c0d93b7a"
    }
  ]
}
  • last_used_at is written on every authenticated request, so it tells you whether a key is still in use before you revoke it.

PATCH /api-keys/{api_key_id}

Change the name. Nothing else about a key is editable.

Path parameters

Path parameters
FieldTypeDescription
api_key_id*stringThe key's ID.

Body

Body
FieldTypeDescription
name*stringThe new name.
curl -X PATCH "https://api.rasket.com/api-keys/a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75" \
  -H "Authorization: Bearer $RASKET_API_KEY" \
  -H "User-Agent: acme-billing/1.0" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "billing worker (eu)"
}'

Response 200

{
  "object": "api_key",
  "id": "a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75"
}
  • Permission and domain restriction are fixed at creation. To change either, create a new key and revoke this one.

DELETE /api-keys/{api_key_id}

Stop the key working, immediately and permanently.

Path parameters

Path parameters
FieldTypeDescription
api_key_id*stringThe key's ID.
curl -X DELETE "https://api.rasket.com/api-keys/a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75" \
  -H "Authorization: Bearer $RASKET_API_KEY" \
  -H "User-Agent: acme-billing/1.0"

Response 200

{
  "object": "api_key",
  "id": "a4d2f0c8-5b31-4e7a-9c62-8f0b1d4e6a75",
  "deleted": true
}
  • The row is kept so your audit history stays readable; only the credential stops working.
  • A revoked key answers 403 restricted_api_key, which is a different answer from an unknown key's 401 missing_api_key.