Browse the Help Centre
Overview

Help Centre / API and MCP

What is an idempotency key in overads?

Included in Growth, the one overads plan. API keys, webhooks and the MCP server are part of the plan.

An idempotency key is a unique string you send with a write to the overads API, in the Idempotency-Key header. If the same request arrives again with the same key, overads replays the first result and does not run the write a second time. Send one on every POST, PATCH and DELETE.

The problem it solves

Your script asks overads to schedule a post. The network drops before the answer arrives. Did the post get created? You cannot tell. If you send the request again without a key and the first one did arrive, the same post now exists twice and will be published twice. With a key, the second request is recognised and answered with the stored result of the first.

How to send one

Idempotency-Key: 4d2f0c8e-launch-post
curlbash
curl -X POST https://api.overads.io/public/v1/posts -H "Authorization: Bearer sk_live_YOUR_KEY" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{ "content": "Closed on Monday for the holiday.", "connectionIds": ["3f1c1a2e-6b2a-4a0e-9a5f-0d5a7d0f2b11"], "scheduledAt": "2026-12-20T04:00:00Z" }'

Generate the key once per write you intend, keep it beside the request, and send the same key on every retry of that request.

The rules

  • Every POST, PATCH and DELETE on the public API accepts the header.
  • A key is scoped to the workspace and remembered for 24 hours.
  • A key can be up to 255 characters. A UUID is a fine choice.
  • The request is recognised by its method, its path and its JSON body with the keys sorted. The same body written in a different key order still matches.
  • A failed attempt releases the key, so a retry after a 4xx or 5xx runs for real.
  • With no header, the write runs every time it is sent.

What you get back

You sendoverads answers
A new keyThe write runs. The answer is stored under the key.
The same key and the same request, after it finishedThe stored answer, with its original status and the header Idempotency-Replayed: true. Nothing runs again.
The same key and the same request, while the first is still running409 with IDEMPOTENCY_IN_FLIGHT. Wait and retry with the same key.
The same key with a different request422 with IDEMPOTENCY_KEY_CONFLICT. Your code reused a key for a new write.
The same key after the first attempt failedThe write runs again, for real.

What a replay and a conflict look like

A replayed answer is the first answer again, with one extra header.

Replayhttp
HTTP/1.1 201 Created
Idempotency-Replayed: true
Content-Type: application/json

A key reused for a different request is refused in the usual error shape.

422json
{
  "error": {
    "code": "IDEMPOTENCY_KEY_CONFLICT",
    "message": "..."
  }
}
CodeWhat to do
IDEMPOTENCY_IN_FLIGHTWait a moment, then send the same request with the same key. You get the first request's result.
IDEMPOTENCY_KEY_CONFLICTMake a new key for the new request. Check that your retry loop does not share one key between jobs.
VALIDATION_FAILED naming the keyThe key is over 255 characters. Send a shorter one.

A worked example

Brew & Bloom's site schedules a post announcing holiday hours.

  1. The site makes the key holiday-hours-2026 and sends the request. overads creates the post, but the connection drops before the 201 arrives.
  2. The site waits two seconds and sends the same request with the same key.
  3. overads recognises the key and the request, and answers 201 with the post it already created and Idempotency-Replayed: true.
  4. The site stores the post id. One post exists.

Later the owner changes the closing day and the site sends new copy. That is a different write, so the site makes a new key. Reusing holiday-hours-2026 with the new body would answer IDEMPOTENCY_KEY_CONFLICT.

Choosing a good key

ApproachGood forWatch out for
A random UUID made when the write is first attemptedAnything. Store it with the job so every retry reuses it.Making a new UUID inside the retry loop, which defeats the key.
A name built from your own record, such as the menu item id and the dateJobs that may be restarted from scratch and must not repeat.Changing the body under the same name gives a conflict. Add a version to the name when the content changes.

Secrets are never replayed

Three calls return a secret once: creating a client workspace's API key, registering a webhook and rotating a webhook secret. A replay of any of them carries secret: null and secretOmitted: true. The secret is in the original response only, so store it the first time.

From an AI assistant

Over the MCP server the write tools take an optional idempotencyKey argument backed by the same store: create_post, update_post, delete_post, get_upload_url, complete_media, delete_media, run_workflow and draft_on_brand_post, and on the server today create_image and run_action as well. There the request is recognised by the tool name plus its arguments. A key used on REST and then on MCP with different arguments is a conflict. The server tells a connected assistant to pass a new key for each write it intends and to reuse it on a retry.

When you do not need one

  • GET requests. Reading twice changes nothing.
  • A retry after a 429. A refused request did nothing, though sending the same key again does no harm.

If the store is unreachable

If the idempotency store cannot be reached, the write goes ahead without the duplicate check and the outage is logged. The API never refuses a write to protect against a retry.

With webhooks

Idempotency keys protect the writes you send. For the events overads sends you, the matching tool is the X-Overads-Delivery header: a retried delivery carries the same id, so your receiver can skip one it has handled. See verify a webhook signature.

Common questions

How long does overads remember an idempotency key?

24 hours, per workspace. After that the same key is treated as new.

What is the longest key I can send?

255 characters. A longer key is refused with VALIDATION_FAILED.

Can I reuse one key for every request?

No. The same key with a different request is refused with IDEMPOTENCY_KEY_CONFLICT. Use one key per intended write.

How do I know a response was a replay?

A replayed response carries the header Idempotency-Replayed: true and the original status code.

Is the header required?

No. Without it the write runs every time it is sent, so a retry after a timeout can create a duplicate.