Appearance
Idempotency
POST /quotes, POST /organizations, POST /leads, and the batch versions require an idempotency key so a retried HTTP call does not double-write.
Directory and lead sync also send external_reference. That id updates the same company or lead on later runs, after the idempotency key has expired. Use a new idempotency key when the JSON body changes. Reusing the old key with a different body returns 409.
Header
http
Idempotency-Key: 01J8Z3V… # or any opaque string ≤ 128 charsRecommendations:
- Use a UUID / ULID per user submit action.
- Persist the key with your form submission id.
- Reuse the same key when retrying after timeouts.
- Use a new key for a genuinely new submission.
Behavior
| Case | Result |
|---|---|
| First request with key | Processed; full response body stored with status and resource id |
| Replay, same key + same body fingerprint | Original response replayed (same resource id and body) |
| Replay, same key + different body | 409 idempotency_conflict |
| Key expired (retention ~72 hours) | Treated as new |
Retention and purge: public-api-spec.md §8.
Example
bash
KEY=submit-10482-attempt
curl -sS "$AF_API/quotes" \
-H "Authorization: Bearer $AF_API_KEY" \
-H "Idempotency-Key: $KEY" \
-H "Content-Type: application/json" \
-d @payload.json
# network blip — safe to repeat with same KEY