Skip to main content

Authentication

All API requests require authentication via a Bearer token in the Authorization header:
Authorization: Bearer <token>

Authentication methods

OAuth 2.0

The API supports OAuth 2.0 with JWT access tokens issued by the Erna authorization server. Tokens are validated using the JWKS endpoint. The authorization server URL is https://auth.erna.ai.

API keys

API keys provide a simpler authentication method for server-to-server integrations. Include the key as a Bearer token.

Scopes

OAuth tokens and API keys require specific scopes to access endpoints:
ScopeRequired for
schedules:writePOST /v1/schedules
schedules:readGET /v1/schedules/jobs/
solver:runPOST /v1/solver/solve

Protected Resource Metadata

The API publishes an RFC 9728 Protected Resource Metadata document at:
GET /.well-known/oauth-protected-resource
This document tells OAuth clients which authorization server to use and which scopes are available.

Credits

Schedule generation (POST /v1/schedules) consumes credits. Credits are reserved when the job is created and finalized when the job completes. If you have insufficient credits, the API returns a 402 response with a link to the checkout page. The direct solver endpoint (POST /v1/solver/solve) does not consume credits.