POST endpoints accept an Idempotency-Key header. If two requests share the same key, the second returns the cached response from the first instead of creating a duplicate resource.
This is critical for Vision API operations that consume credits. A network timeout during POST /compare shouldn’t cost you twice.
Usage
Pass a unique key (we recommend UUIDv4) in theIdempotency-Key header:
202 response — no new job is created and no credits are charged.
Behavior
| Scenario | Result |
|---|---|
| First request with key | Processed normally |
| Duplicate key, original succeeded | Returns cached response (same status, same body) |
| Duplicate key, original still processing | Returns cached 202 with the original job_id |
Duplicate key, original failed with 4xx | Returns cached error (no retry) |
Duplicate key, original failed with 5xx | Allows retry (key is released) |
Key Rules
- Keys are scoped to your organization. Two different organizations can use the same key.
- Keys expire after 24 hours. After expiry, the same key can be reused.
- Keys must be between 1 and 256 characters (alphanumeric, hyphens, and underscores).
- Sending a different request body with an existing key returns a
409 Conflicterror.
Response Headers
When a cached response is returned, the response includes:When to Use
Use idempotency keys on anyPOST that creates resources or starts jobs:
POST /drawings— prevent duplicate drawing processingPOST /drawings/{id}/compare— prevent duplicate comparisonsPOST /compare— prevent duplicate analysisPOST /parse— prevent duplicate parsing
GET, PATCH, or DELETE — these are naturally idempotent.