An idempotency guard ensures that retrying the same logical POST does not create duplicate database state. Place it inside the atomic critical section, typically by storing an idempotency key in a column with a UNIQUE constraint. section 8.4
Retrying a POST
A request passes validation and enters BEGIN ... COMMIT. The handler checks the idempotency key while performing conflict checks and writes. If the client retries the POST, the UNIQUE constraint prevents a second row, while the small transaction limits the lock window. section 8.4
Figure 8.6 A typical API request has three phases: synchronous pre-flight checks the user waits for, a core database transaction, and asynchronous follow-up work that runs after the 201 response is sent.

Use the three-phase request flow to locate the guard: after pre-flight validation and inside the core database transaction, before asynchronous follow-up work. section 8.4
