Pages in Guides

Idempotency and Request Ids

A request that times out may still have run. Send an Idempotency-Key header (a new UUID per action) on POST /api/posts, POST /api/posts/bulk, POST /api/posts/{postId}/publish, POST /api/posts/{postId}/retry, POST /api/posts/{postId}/approve, POST /api/accounts/connect, POST /api/platform-sets, POST /api/webhooks/endpoints and POST /api/feedback, and send the same key when you retry. A retry with the same key and body within 24 hours returns the first response without creating or publishing again, with Idempotent-Replayed: true. MCP tools take the key as the idempotencyKey argument.

Create and publish once
curl -X POST https://api.ampost.io/api/posts \
  -H "Authorization: Bearer amp_live_YOUR_KEY" \
  -H "Idempotency-Key: 9f1c2d3e-4b5a-4c6d-8e7f-0a1b2c3d4e5f" \
  -H "Content-Type: application/json" \
  -d '{"text":"Launch day","targets":[{"platforms":["linkedin"]}],"publishNow":true}'
  • The same key with a different request: 409 IDEMPOTENCY_KEY_REUSED.
  • The same key while the first request still runs: 409 IDEMPOTENCY_REQUEST_IN_PROGRESS; retry with the same key a few seconds later.
  • Only successful responses are kept. After an error the key is free again, so you can fix the request and retry with it.
  • Keys belong to your Ampost user and are 1-255 visible ASCII characters.

Request ids

Every API and MCP response carries X-Request-Id. Send your own id (8-128 letters, digits, ., _, : or -) to have it echoed; otherwise Ampost generates one. Quote it when you contact support.