Skip to content

Idempotency

Network errors and timeouts leave you unsure whether a lead was accepted. Idempotency lets you retry the same submission without creating a second lead.

Send an Idempotency-Key header with POST /api/v1/leads. Pingdex remembers the key together with a fingerprint of the request, and uses them when the same key arrives again.

Terminal window
curl https://api.pingdex.io/api/v1/leads \
--request POST \
--header "Authorization: Bearer $PINGDEX_API_KEY" \
--header "Content-Type: application/json" \
--header "Idempotency-Key: 8c4e1a7b-5d29-4f60-b3a8-9e2d6f1c0a47" \
--data '{
"campaign_id": "3e1a7c52-9b04-4d68-a2f1-6c8d0e5b7a93",
"external_id": "web-2026-000124",
"payload": { "email": "alex.example@example.com", "postcode": "XX2 2XX" }
}'

A key is unique per account, endpoint and key value. Two different accounts can use the same key without interference, and the same key used on a different endpoint is treated separately.

Pingdex computes a SHA-256 hash of the canonical form of these three values:

  • campaign_id
  • external_id
  • payload

Because the form is canonical, differences that do not change the meaning, such as the order of keys in the JSON, do not change the fingerprint.

Situation Result
New key The lead is accepted and processed as normal.
Same key, same fingerprint The earlier submission is replayed. Pingdex does not process the lead again.
Same key, different fingerprint The request is refused with 409.

A 409 tells you the key has already been used for a different lead. Generate a new key for the new lead. See API errors.

Use external_id to tie a lead to your own records, and Idempotency-Key to make retries safe.

  • Generate one key per lead, for example a UUID, and store it with the lead before you send it.
  • Reuse the same key only when retrying the identical request.
  • Do not reuse a key for a lead with a different campaign, payload or external_id.

See Submit a lead.