API docs

Authentication

Every request carries your API key in the Authorization header.

An API key is a 51-character string that starts with ws_. Each key belongs to one project and spends that project's credits. A sandbox key starts with ws_test_ and never sends or charges anything: see the Sandbox page.

curl https://api.wesend.mn/v1/balance \
  -H "Authorization: Bearer $WESEND_API_KEY"

Managing keys

  • A project can hold up to 10 active keys. Create a separate key for each system and environment.
  • A key is shown in full only when it is created. Afterwards only its first and last characters are visible.
  • A revoked key stops working at once. This cannot be undone.
  • When a member is removed from the project, the keys they created stop working too.

IP allowlist

Each key can list up to 20 IP addresses or CIDR ranges (IPv4 or IPv6). With an empty list the key works from any address. Once an address is added, requests from anywhere else answer 403 ip_not_allowed, so a leaked key cannot be used away from your servers.

Response403 Forbidden
{
  "error": {
    "code": "ip_not_allowed",
    "message": "This API key does not accept requests from 198.51.100.7."
  }
}

Set it in the dashboard under API keys, from the key's IP allowlist. The address the key was last used from is shown there and can be added with one click.

Activity log

Every key created or revoked, and every change to an IP allowlist, is listed on the API keys page with who did it and when. Requests refused by an allowlist are listed too, once an hour per address and key.

Use keys only from your server. Never put one in browser or mobile app code: anyone can read it there and send with your credits.

Failures

A missing, unknown or revoked key answers 401 invalid_api_key. Too many wrong keys from one address answer 429 rate_limited, with the seconds to wait in the Retry-After header.

Response401 Unauthorized
{
  "error": {
    "code": "invalid_api_key",
    "message": "The API key is missing, unknown or revoked."
  }
}