Skip to content

Reference

Idempotency

Send an Idempotency-Key, and a request retried after a timeout never runs, or charges, twice.

POST /v1/images/generations, /v1/videos/generations and /v1/videos/edits take an Idempotency-Key header: a string of yours, 1 to 200 printable characters without spaces (a UUID, your order id). The first request with a key runs. For 24 hours, the same key with the same body returns that request's generation instead of starting another.

POST /v1/images/generations HTTP/1.1
Host: frameport.ai
Authorization: Bearer fp_live_...
Content-Type: application/json
Idempotency-Key: order-2c9f41e7

{"model": "fp-image-1", "prompt": "A lighthouse on a cliff at dawn"}
WhenThe answer
The first request with the key202, the generation, its price held.
The same key and the same body again200 with Idempotent-Replayed: true: the same generation, as it is now. Nothing more is held.
The same key with another body, or on another endpoint409 idempotency_conflict. Use a new key for a new request.
The same key before the first request has answered409 request_in_progress, with Retry-After.
The first request was refused (400, 402, 429…)The key is free again: nothing was held. Fix the request and send it with the same key.

Good to know

  • Keys belong to the workspace: every API key of the workspace shares them.
  • After 24 hours a key is new again.
  • The body is compared as sent: the same fields with other values, or other fields, are another request.
  • The MCP server's tools take it as idempotency_key.