Idempotency and retries

Request Safe to retry?
GET Yes, at any time
POST /orders, POST /orders/{id}/cancel Yes, with the same Idempotency-Key
PUT /orders/{id} Yes: send the same body to the same id again

POST: the Idempotency-Key

Every POST needs an Idempotency-Key header, so a retry after a timeout never runs twice.

POST /external/v0/orders
Authorization: Bearer dsk_test_…
Idempotency-Key: 6f1c2a4e-8d0b-4c7e-9a51-3b2f7e0d9c11
Content-Type: application/json
  • Generate a new UUID per operation, and send the same key when you retry that operation.
  • A retry with the same key and the same body gets the stored response again, with the header Idempotent-Replayed: true. Nothing runs twice.
  • Only successful (2xx) responses are stored. A rejected request (4xx) frees the key: fix the request and send it again with the same key.
  • Same key, different body: 422 idempotency-key-reused. The first request still running: 409 idempotency-in-progress with Retry-After.
  • Keys are kept for 24 hours. A missing key returns 400.

partnerReferenceId is the second safety net. It is your own id for an order, unique among your live orders. A second order with the same id returns 409 with existingId, so you can fetch the order you already placed. A canceled order frees its id.

PUT: no key needed

PUT /orders/{id} replaces the order with the body you send. Sending the same body again changes nothing and returns the current version. If the response of a successful PUT was lost, send the same body to the same id again: the id now belongs to the replaced version, and the call returns the newer version with 200. Only a different body on an old id is a 409 (existingId = the newest version).

MCP tools

The MCP tools have no Idempotency-Key. Retrying is still safe:

  • place_order: a repeated call with the same partnerReferenceId returns a 409 with existingId (the order you already placed) instead of a second order.
  • cancel_order: a repeated call returns a 409 "already canceled". Treat it as done, or check with get_order.
  • modify_order: as for PUT above.

A rate limit or an invalid key is an HTTP error of the MCP request itself (429 with Retry-After, 401), not a tool result; MCP clients show it as a failed call. Wait the Retry-After seconds before calling again.