Skip to content

Troubleshooting

Common problems and their solutions.

401 response, invalid_credentials. The OSP sent does not match any account: a typo, or the OSP has been replaced since (/auth/rotate invalidates the old one). Solution:

  1. If you have a valid session token, use /auth/rotate to generate a new OSP
  2. Otherwise, create a new account with /auth/register (the old account stays unreachable)

The API answers 401 invalid token for an invalid or expired JWT access token (lifetime: 15 minutes). Use the refresh token:

Terminal window
curl -X POST https://ostrakon.example.com/api/v1/auth/refresh \
-H "Content-Type: application/json" \
-d '{"refresh_token": "your-refresh-token"}'

You exceeded the request limit. The response carries error: "rate_limit_exceeded", and the headers X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset (Unix timestamp of the next reset, the limit is counted per minute) and X-RateLimit-Type. There is no Retry-After header: wait for X-RateLimit-Reset.

The limits for authenticated requests (JWT or API key) are per account and depend on the plan, in requests per minute:

Type Free Premium Enterprise
Read (GET) 120 6 000 30 000
Write (POST, PATCH, DELETE) 60 3 000 15 000
Sending events (/events, /events/batch) 300 10 000 50 000
Statistics and reading events 600 12 000 60 000

Public endpoints (/public/*) are limited per IP: 30 req/min in general, 120 req/min for statistics. Registration is limited to 5 per hour per IP. A public trigger also has an event quota per hour and per day (quota_exceeded, 429).

Solutions:

  • Implement exponential backoff
  • Batch events with /events/batch
  • A JWT and an API key of the same account share the same counters: several keys do not raise the limit
  1. Check that the token is valid (not expired) and that it is sent in a header (Authorization or X-API-Key), not in the URL
  2. Check that you have the trigger:stats scope on the trigger (trigger:stats:<id>, or trigger:stats:* for /events/stream): trigger:read is not enough
  3. For public triggers, use the /public/events/stream/{id} endpoint
  4. A 503 too_many_connections means the limit of open streams is reached: close the ones you no longer use
  1. Check that events are actually being emitted on the trigger
  2. The SSE connection can take a few seconds to establish
  3. Check that your client supports text/event-stream
  4. Messages are named (connected, event, heartbeat): with EventSource, onmessage receives nothing, use addEventListener (see Real-time Events)
  1. The key may have been revoked: check in Settings > Developer > API keys
  2. Check the header: X-API-Key: sk_...
  3. Do the key's scopes cover the requested operation? A 403 names the missing scope (required scope: ...)

The API rejects a JSON body that carries a field the endpoint does not know, and names it:

{"error": "unknown_field", "message": "unknown field \"descripton\""}

It is usually a typo (descripton for description) or a field copied from another endpoint. Remove or rename it: the API reference lists the fields of each endpoint. Only the structure of the body is strict; the metadata object of an event stays free-form and accepts any key.

Events are buffered before being written to the database. Typical delay: about 1 second. For real time, use SSE.

  • Reduce the time range of the selector
  • Filter by group to limit the data shown