Get started
Idempotent requests
A network error can leave you unsure whether a session was created. Send an Idempotency-Key header and you can retry the same request without creating a second session.
How it works
- Pick a unique key per operation, for example
signup-customer-1042. It must be 8 to 128 characters of letters, digits and- _ : . - The first successful response is kept for 24 hours per company and key.
- A retry with the same key and the same body gets that response back, with the header
Idempotent-Replayed: true. - If the first request failed, nothing is kept and the retry runs as a new request.
curl -X POST https://api.myid.ir/v1/verifications \
-H "Authorization: Bearer $MYID_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: signup-customer-1042" \
-d '{
"flowCode": "01JD7YQK2D1C4M2V7R9T3B6N8P",
"externalRef": "customer-1042"
}'When a key is refused
| Case | Result |
|---|---|
| Same key, same body | The first response is returned. No new session. |
| Same key, different body | 400: the key was already used with a different request body. |
| Same key while the first request is still running | 400: retry in a moment. |
| Key with invalid characters or length | 400: fix the key format. |
Only
POST /v1/verifications accepts an idempotency key. GET requests and cancel are safe to retry as they are.