Rivane

Accounting
made smart

ERP Use CasesTier 1Published June 28, 2026

Idempotent Retry of a Duplicated Create (external_id Anchor)

Idempotent Retry of a Duplicated Create (external_id Anchor) for US and UK finance teams: ERP requirements, controls, audit evidence, data model, APIs, state transitions, and implementation checks.

Platform / Idempotency & Integration is where ERP discipline either begins or breaks.

Idempotent Retry of a Duplicated Create (external_id Anchor) looks operational from far away. In a real finance team, it is a chain of assertions: the right actor started the work, the required records existed, the control policy was applied, the state change was preserved, and the outcome can be explained later without rebuilding the transaction from emails and spreadsheets.

The expected business outcome is specific: Duplicate submissions and re-syncs produce exactly one row; re-running the seeder on day 3 writes zero new rows; cross-system identity is stable and corruption-free.

The control flow a finance team actually needs.

Workflow map showing control steps, exceptions, and evidence for this ERP process.Every Retry-Able...Start conditionCreate Path Is I...Required checksIdentity Is The ...Owner and SLADurable Beyond T...System updateSame Fixture → S...Exception handlingAudit packetEvidence trailException loopPlatform / Idempotency & Integration should preserve every override and rejection.
Workflow map for this ERP process, including exception handling and audit evidence.

Step 1

Every Retry-Able Business Resource...

Step 2

Create Path Is INSERT … ON CONFLICT DO...

Step 3

Identity Is The Caller-Stable External...

Step 4

Durable Beyond The 24h HTTP...

Step 5

Same Fixture → Same External Id → Same...

The ERP surface involved.

Module

Platform / Idempotency & Integration

Actors

Integration Sync, Seeder, API Caller, Owning Service

Tier

Tier 1

Finance area

Cross-Cutting Edge Cases & Failure Modes

Region lens

US and UK finance teams

Publication date

June 28, 2026

every retry-able business resource carries a caller-controlled `external_id` + partial unique index on `(tenancy, external_id)`; create path is `INSERT … ON CONFLICT (tenancy, external_id) DO UPDATE … RETURNING id`, never a plain insert; identity is the caller-stable `external_id`, NOT a hash of mutable business fields (a field edit must not change identity); durable beyond the 24h HTTP idempotency-key TTL; same fixture → same `external_id` → same logical row across dev/staging/prod; second create returns the original id and zero new rows; audit reflects an update, not a second create.

US and UK teams have different compliance hooks, but the same control problem.

US teams usually care about clean evidence for audit support, vendor records, payment controls, tax reporting, and management review. UK teams usually care about VAT-ready records, approval evidence, digital-record discipline, and traceable postings. The country-specific details differ, but the operating pattern is the same: the ERP needs controlled records, explicit ownership, defensible state changes, and evidence that survives beyond the person who completed the task.

The control matrix.

Control areaRequirementAcceptance proof
Control 1
every retry-able business resource carries a caller-controlled external_id + partial unique index on (tenancy, external_id)
Given a business resource with an existing row created via a first call carrying external_id ext_vend_001
Control 2
create path is INSERT … ON CONFLICT (tenancy, external_id) DO UPDATE … RETURNING id, never a plain insert
when the same create payload is submitted again with the same external_id after the 24h HTTP idempotency cache has expired
Control 3
identity is the caller-stable external_id, NOT a hash of mutable business fields (a field edit must not change identity
then the response returns the original record id, zero new rows are inserted, mutable fields are updated in place, and the audit trail reflects an update not a second create
Control 4durable beyond the 24h HTTP idempotency-key TTL
negative) when external_id is omitted from a retry-able create then 422 with error code external_id_required.
Control 5
same fixture → same external_id → same logical row across dev/staging/prod
Duplicate submissions and re-syncs produce exactly one row; re-running the seeder on day 3 writes zero new rows; cross-system identity is stable and corruption-free.
Control 6second create returns the original id and zero new rowsDuplicate submissions and re-syncs produce exactly one row; re-running the seeder on day 3 writes zero new rows; cross-system identity is stable and corruption-free.

Audit evidence is a chain, not a folder.

Evidence layerWhat should be preserved
Business event
A caller (integration sync, retried API request, re-run seeder) submits the same logical create twice - network retry, at-least-once delivery, day-3 re-sync. Each create carries a caller-controlled external_id. The owning service performs an upsert keyed on (tenancy, external_id): the first call inserts, the second matches the existing row and updates mutable fields in place, returning the same record id. No duplicate business row is ever created, even after the short-lived HTTP idempotency-key cache has expired.
Control rules
every retry-able business resource carries a caller-controlled external_id + partial unique index on (tenancy, external_id);
create path is INSERT … ON CONFLICT (tenancy, external_id) DO UPDATE … RETURNING id, never a plain insert;
identity is the caller-stable external_id, NOT a hash of mutable business fields (a field edit must not change identity);
durable beyond the 24h HTTP idempotency-key TTL;
same fixture → same external_id → same logical row across dev/staging/prod;
second create returns the original id and zero new rows;
audit reflects an update, not a second create.
Acceptance proof
Given a business resource with an existing row created via a first call carrying external_id ext_vend_001;
when the same create payload is submitted again with the same external_id after the 24h HTTP idempotency cache has expired;
then the response returns the original record id, zero new rows are inserted, mutable fields are updated in place, and the audit trail reflects an update not a second create;
(negative) when external_id is omitted from a retry-able create then 422 with error code external_id_required.
Data record
vendor { id: string, entity_id: string, name: string, external_id: string, status: enum, created_at: timestamp, updated_at: timestamp };
partial unique index on (entity_id, external_id) WHERE external_id IS NOT NULL;
(reference, product may differ).
System event
POST /v1/vendors { name, external_id, ... } -> 201 on first call { id, external_id }; -> 200 on duplicate external_id { id, external_id, updated: true };
GET /v1/vendors/{id};
idempotent via external_id;
does NOT use name as uniqueness key.
Lifecycle state
ACTIVE -> ARCHIVED;
guard: duplicate external_id triggers upsert not 409;
plain insert without external_id on a retry-able resource is structurally blocked by service layer.

The useful version of this workflow is not only fast. It is inspectable. A controller, auditor, or operator should be able to move from source event to system record to state transition to final business outcome without guessing.

Implementation contracts.

Reference data model

`vendor` { id: string, entity_id: string, name: string, external_id: string, status: enum, created_at: timestamp, updated_at: timestamp }; partial unique index on `(entity_id, external_id) WHERE external_id IS NOT NULL`; (reference, product may differ).

API and events

`POST /v1/vendors` { name, external_id, ... } -> 201 on first call { id, external_id }; -> 200 on duplicate external_id { id, external_id, updated: true }; `GET /v1/vendors/{id}`; idempotent via `external_id`; does NOT use name as uniqueness key.

State transitions

`ACTIVE -> ARCHIVED`; guard: duplicate external_id triggers upsert not 409; plain insert without external_id on a retry-able resource is structurally blocked by service layer.

Common implementation traps.

Treating the workflow as data entry

If the ERP only stores the final record, the team loses the decision trail that explains how the record became valid.

Hiding exception logic

Exceptions need owners, reason codes, and time stamps. A vague pending state is not a control.

Posting without recovery design

Retries, duplicate submissions, and partial failures must be explicit so the system does not create inconsistent records.

Skipping evidence design

A workflow that cannot produce evidence on demand will eventually push finance teams back into manual screenshots and spreadsheets.

Where Rivane fits.

Rivane is built for finance workflows where automation must stay tied to source documents, approvals, state transitions, ledger impact, reporting, and audit evidence. Use this guide as a checklist for evaluating whether an ERP workflow is merely digitized or actually controlled.

References and source basis.

These sources provide the standards, regulatory, or government context around the flow. They are included so the guide is useful to finance operators, auditors, and implementation teams, not only buyers reading software copy.

Back to ERP use cases