Idempotency-Key header on the endpoints that start a search or request. If you retry a request with the same key, for example after a timeout or a 500, Baselayer returns the resource the first request created instead of creating and billing a new one.
The header is optional. Requests without it work exactly as before.
How It Works
Create a unique key for each search you mean to run, ideally a UUID. Save it with your own record before you send the request, and send the same key with every retry.1
Send the request with a key
POST /searches with Idempotency-Key: K. Baselayer creates a search.2
The response is lost
A timeout, a
500 or a restart means you never see the search ID.3
Retry with the same key and body
Baselayer returns the same search, with the header
Idempotent-Replayed: true, instead of creating a second one.Sending a Key
What a Replay Returns
A replay returns the original resource, with the sameid, Location and X-Resource-Id, plus the header Idempotent-Replayed: true. Header names can arrive in lowercase, so compare them case-insensitively.
The status code follows the resource’s state when Baselayer responds:
A synchronous retry that finds the search still running waits for it, like a new synchronous request. If the wait runs out, you get
202. See Synchronous & Asynchronous Request Execution.
A replay never re-runs a finished search. If the original ended in FAILED, the replay returns it with a success status code and state: FAILED, so always check state. To run a search again, for example after fixing the address, send it with a new key.
If the first request got a 500 after Baselayer saved it, a retry with the same key returns the saved search and makes sure it runs. Without a key, the retry creates a second search.
If two requests with the same key arrive at the same time, Baselayer creates one resource and the second request returns it as a replay.
Errors
Finding a Resource by Its Key
Every resource created with a key carries it asidempotency_key, in the response body and in its webhooks. If you never received the resource ID, match the webhook to your record by idempotency_key. Order.created events are about billing and don’t include it.
reference_id is different: it labels a resource with your own ID, and many searches can share one. Use both.
Supported Endpoints
Any other endpoint ignores the header, so a retry there creates a new resource. That includes batch and export requests.
Know Your Agent credential mints require a key and keep it for 24 hours. See Minting Credentials. MCP tools take the key as an
idempotency_key argument. See MCP Tools.
Best Practices
- Save the key before you send the request. A key created inside the retry loop protects nothing.
- Retry timeouts,
5xxresponses and409code6701with the same key. For other4xxerrors, fix the request and use a new key. - Back off between retries, for example 1, 2, then 4 seconds.
Next Steps
- Handle sync and async responses
- Set up webhooks
- See the
Idempotency-Keyheader on each endpoint in the API Reference