Skip to main content

Idempotency

Zenoo supports idempotent requests through the external_reference field. This prevents duplicate verifications caused by retries, user double-clicks, network failures, or asynchronous workflow replays.

How It Works

Include an external_reference in any verification request. If you submit the same external_reference twice:
  1. The second request returns the existing case’s tokens.
  2. No duplicate verification is created.
  3. No additional charges apply.
The external_reference is scoped to your project. Two different projects can use the same reference value without conflict.

Company Verification Example

Person Verification Example

Duplicate Detection Behavior

When Zenoo receives a request with an external_reference that already exists in your project:
The response to the second request is identical to the first. You get back the same pull and start tokens pointing to the original case.

What Happens to the Request Body

The second request’s body fields (company name, country, etc.) are ignored. Zenoo returns the existing case based solely on the external_reference match. If you need to run a new verification with different data for the same entity, use a different external_reference.

When to Use

Always, in production. The external_reference field protects against accidental duplicates with no downside.
The external_reference field protects against:
  • Network retries. If your HTTP client retries a timed-out request, you do not get charged twice.
  • User double-clicks. If a user clicks “Verify” twice, only one verification runs.
  • Workflow replays. If your orchestration system replays a failed step, the verification is not duplicated.
  • Distributed systems. If two instances of your service submit the same verification concurrently, one case is created.

Best Practices

Use your internal identifiers. Map external_reference to something unique in your system: Include it in every production request. There is no downside and it prevents accidental duplicates.
Make references deterministic. Derive them from your data (application ID, customer ID + date) rather than generating random UUIDs. This ensures the same logical operation always produces the same reference.
reference-generator.js
Include the scope in the reference. If the same entity can have multiple verification types (initial onboarding, periodic review, re-verification), include the type in the reference to avoid collisions:

Webhook Deduplication

Idempotency also matters on the receiving side. Zenoo may deliver the same webhook event more than once. Use journey_id combined with event_type as a deduplication key:
server.js
Always return 200 for duplicates. Returning an error triggers unnecessary retries.

Testing Idempotency

Verify that duplicate requests return the same case:
You should receive the same case_reference and tokens in both responses. No new verification is created.

Next Steps