Billable create calls accept an Idempotency-Key header. Send a unique value per logical operation. If the request is retried with the same key, you get the original result back instead of a second diagram, and you are charged only once. The stored result is replayed for 24 hours.
Supported on generate, generate_stream, edit, and fix.

Rules of thumb

  • Generate the key client-side (a UUID is ideal) and reuse it across retries of the same action.
  • Use a new key for a genuinely new diagram.
  • Retry within the 24-hour window.
Pair idempotency with exponential backoff on 429 and 5xx (see Errors) for a robust create path.