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 the key encrypted at rest. You can re-read it from Settings → API Keys, so treat that screen as sensitive.
RevocationInstant. Go to Settings → API Keys → Delete.

What an API key cannot do

Some operations are deliberately restricted to an interactive session in the coach app and always answer 403 when called with X-API-Key:

  • Creating, listing, revealing or revoking API keys.
  • Impersonating a client, or changing a client's password.
  • Managing team members (employees) and their permissions.
  • Deleting the coach account.

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