Error format
Every error response is JSON with anerror code and a message:
erroris a stable snake_case code you can switch on.messageis a human-readable explanation.400validation errors also includedetailswith per-field messages.
401 Unauthorized means the request was not authenticated.
A 403 Forbidden means the token was accepted, but the client is not allowed to access the resource.
Authentication Errors
Protected endpoints require a valid OAuth 2.0 access token.Missing Token
If theAuthorization header is missing, protected endpoints return 401 Unauthorized:
POST /auth/token and GET /health:
Invalid or Expired Token
If the access token is invalid, expired, or revoked, protected endpoints return:- The header uses the
Bearerscheme and the token value is complete. - The token has not been revoked or replaced.
Invalid Client Credentials
POST /auth/token does not use a Bearer token. If the client ID or client secret is wrong, the API returns:
Unauthorized Token
In rare cases, a token is accepted but is not associated with a user. Protected endpoints then return:Validation Errors
If the request body or query parameters fail validation, the API returns400 Bad Request:
Rate Limits
The API limits how many requests a client can send in a 1-minute window. Limits are counted per IP address, andPOST /auth/token also counts per clientId.
GET /health is not rate limited.
POST /auth/token is subject to both the global IP limit and the stricter auth limits.
The lowest remaining limit is the one that applies.
When a limit is exceeded, the API returns 429 Too Many Requests:
429 response also includes Retry-After with the number of seconds to wait before retrying.
Recommended handling:
- Do not retry immediately. Wait for
Retry-After, or untilRateLimit-Resetseconds have passed. - Cache the access token and reuse it until it expires (typically 1 hour). Do not call
POST /auth/tokenon every request.
Server Errors (5xx)
If the API returns a5xx status code (for example 500 Internal Server Error), it means that an unexpected error occurred on the goLance servers.
- Retry the request after a short delay (for example, 5–10 seconds).
- If the error persists, contact goLance Support and provide the request details (endpoint, timestamp, and response body if available).
