Network calls fail in ways that leave you unsure whether the request went through. Idempotency keys make retries safe: replay the same request with the same key and MADIAD Hub returns the original result instead of publishing again.
Send an idempotency key
Add an Idempotency-Key header with a value you control — a UUID per logical action is ideal.
curl -X POST https://api.madiad.com/v1/posts/photos \
-H "Authorization: Bearer $MADIAD_API_KEY" \
-H "Idempotency-Key: 9f1c2e7a-4b6d-4e2a-9c10-7b3f8d5a1e22" \
-F "profile_id=prof_…" \
-F "platforms[]=instagram" \
-F "caption=Launch" \
-F "photos[]=@./launch.jpg"
How it behaves
- First request with a key — processed normally; the result is stored against that key.
- Replay with the same key — returns the stored result; no second post is created.
- Different key — treated as a brand-new request.
Generate the key before the first attempt and reuse it for every retry of that same action. Generating a new key on retry defeats the purpose.
When to use it
Always, for any request that creates something — posts in particular. It’s essential when:
- A client or workflow tool (n8n, queues, cron) auto-retries on timeout.
- A webhook or job may be delivered more than once.
- A user double-clicks publish.
Keys are scoped to your account and remembered long enough to cover realistic retry windows.