Skip to content

API Keys

API keys authenticate your application when calling the RelayPost REST API. Each key is scoped to an organization — it can only access that organization’s data.

API keys follow this format:

rp_live_aBcDeFgHiJkLmNoPqRsT...
PrefixMeaning
rp_live_Production key
rp_test_Test/sandbox key

Only the first 12 characters (the prefix) are stored for display. The full key is shown once at creation time and cannot be retrieved later.

API keys are created and managed through the RelayPost dashboard under Settings → API Keys. From there you can:

  • Create new keys with a name and environment (production or test)
  • View existing keys (prefix only — the full key is shown once at creation)
  • Revoke keys that are no longer needed

Revoked keys immediately stop working. This cannot be undone — create a new key if needed.

Include the key in the Authorization header on all REST API requests:

Terminal window
curl -X POST https://relaypost.dev/api/v1/emails/send \
-H "Content-Type: application/json" \
-H "Authorization: Bearer rp_live_aBcDeFgHiJkLmNoPqRsT..." \
-d '{
"from": { "email": "[email protected]", "name": "Your App" },
"to": [{ "email": "[email protected]" }],
"subject": "Hello from RelayPost",
"html": "<p>It works!</p>"
}'

If the API key is missing or invalid, the API returns a JSON error:

{
"error": {
"code": "AUTH_MISSING",
"message": "No Authorization header provided"
}
}
{
"error": {
"code": "AUTH_INVALID",
"message": "API key is invalid or revoked"
}
}

Every REST API response includes rate limit information in the headers:

HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the current window
X-RateLimit-RemainingRequests remaining in the current window
Retry-AfterSeconds to wait before retrying (only on 429 responses)

See Rate Limits for details.

  • Never commit API keys to version control
  • Use environment variables to store keys
  • Use test environment keys during development
  • Rotate keys periodically — revoke old ones and create new ones
  • Use separate keys for different services so you can revoke individually