96Astro API

Documentation

Idempotency

Make retries safe with idempotency keys, so a timeout or a dropped connection can never charge you twice for the same request.

Send a unique Idempotency-Key header with each request:

Idempotency-Key: 4f8c2a8e-6b1d-4c6e-9a3f-2b7d1e0c9a55
  • Same key and same body within 24 hours returns the original result, marked meta.replayed: true and the Idempotent-Replayed: true header, and you are charged once.
  • Same key with a different body returns 409 idempotency_conflict.
  • Same key while the first request is still running returns 409 idempotency_conflict with retryable: true. It never runs twice; retry shortly with the same key to get the result.
  • A failed first attempt was not charged, so a retry with the same key and body runs again.
  • After 24 hours the key expires and returns 409 idempotency_conflict; use a new one.

Generate a new key (a UUID is ideal) for each logical operation, and reuse it only when retrying that same operation. Keys are 1 to 200 characters, and are scoped to your organization and to the sandbox or live environment.

The same rules apply to PDF and audio jobs, to AI readings and to conversation messages. A retried stream replays the stored answer as a stream and is not charged again.

Idempotency protects against duplicate charges from retries. It is not a cache: a new request for the same chart, with a new key, is a new call.

Was this page helpful?

Send us feedback

What is it about?