Skip to main content

Authentication

All API requests require an API key passed in the Authorization header.

Creating an API key

  1. Log in to your dashboard
  2. Click Create key and give it a name (e.g. “Production”, “My App”)
  3. Copy the key immediately — it is only shown once
API keys look like this: tpc_aBcDeFgHiJkLmNoPqRsTuVwXyZ...

Using your API key

Include the key in the Authorization header as a Bearer token:
curl -X POST https://thepostalcompany.com/api/v1/letters \
  -H "Authorization: Bearer tpc_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Revoking a key

Go to API Keys in the dashboard and click Revoke next to the key you want to disable. Revoked keys immediately stop working.

Error responses

StatusMeaning
401Missing, invalid, or revoked API key
{
  "error": "Invalid or revoked API key"
}