Developers

Authentication

The API uses API keys for server-to-server authentication. Each key is scoped to a single company (coaching business) and grants the same permissions as the coach account.

Creating an API key

  1. Open the TrainerStudio coach app.
  2. Go to Settings → API Keys.
  3. Click Create API Key and give it a descriptive name (e.g. "Zapier integration", "Claude agent").
  4. Copy the key immediately — it is only shown once.

Using the key

Send the key in the X-API-Key header on every request:

curl https://api.trainerstudio.io/coach/customers \
  -H "X-API-Key: YOUR_API_KEY"

Key properties

PropertyDetail
ScopeCompany-level. The key can access all clients, programs, and data within the coach's company.
FormatOpaque string. Treat it as a secret.
StorageThe server stores a hash — if you lose the key, revoke it and create a new one.
RevocationInstant. Go to Settings → API Keys → Delete.

Error responses

StatusMeaning
401 UnauthorizedMissing or invalid X-API-Key header.
403 ForbiddenThe key is valid but the operation requires a different role.
{
  "statusCode": 401,
  "message": "Missing X-API-Key header"
}

Security best practices

  • Never expose keys in client-side code — API keys are for server-to-server use only.
  • Use one key per integration so you can revoke individually without breaking other systems.
  • Store keys in environment variables or a secrets manager, never in source code.
  • Rotate keys periodically — create a new one, update your integration, then revoke the old one.

On this page