Configure idempotency headers
Enterprise feature
This feature is available only for the Enterprise plan. To get started, reach out to support@buildwithfern.com.
For endpoints you’ve configured as idempotent, Fern’s SDKs allow users to
specify idempotency headers for safe request retries. Typically the headers include Idempotency-Key,
but you can also specify additional headers.
Generated SDK behavior
The generated SDKs expose idempotency headers as parameters only for endpoints marked as idempotent, ensuring users know exactly which invocations are idempotent.
Auto-generate idempotency keys
Generated SDKs can attach an idempotency-key header automatically, generating a UUIDv4 value for each request unless the caller supplies one. Enable it once for every generator under api.settings:
By default the SDK sends an Idempotency-Key header on POST and PUT requests. Pass an object to change the header name or the eligible methods:
To override the API-level value for a single SDK, set auto-generate-idempotency-key under that generator’s config. Auto-generation is supported by the TypeScript, Python, Java, Go, C#, PHP, and Ruby SDKs.
Setting up idempotency headers
Configure the idempotency headers your API uses, then mark individual endpoints as idempotent:
For full configuration details, see Idempotency in OpenAPI.