---
title: "What Is Idempotency in REST APIs?"
img: https://s3.us-east-2.amazonaws.com/unified-article-images/what_is_idempotency_in_rest_apis-icon.png
date: 2026-05-04T23:52:00.000Z
updated: 2026-12-02T01:08:11.326Z
readingTime: 7
tag: Product
description: "\"An API operation is idempotent when sending it twice has the same effect as sending it once. In REST, GET, PUT and DELETE are idempotent by definition and POST...\""
url: "https://unified.to/blog/what_is_idempotency_in_rest_apis"
---

# What Is Idempotency in REST APIs?

An API operation is idempotent when sending it twice has the same effect as sending it once. In REST, GET, PUT and DELETE are idempotent by definition and POST is not, so a retried POST after a timeout can create a second invoice, candidate or payment. Through an integration layer, the fix is to decide where duplicates get caught: by an idempotency key the API honours, or by checks in your own code.


## What does idempotent mean in REST?


An idempotent request leaves the server in the same state whether it runs once or many times. [RFC 9110](https://www.rfc-editor.org/rfc/rfc9110#section-9.2.2) defines PUT, DELETE and the safe methods (GET, HEAD, OPTIONS and TRACE) as idempotent.

- **GET** reads without changing anything, so repeating it is harmless.
- **PUT** sets a resource to the body you send, so the second call sets the same state again.
- **DELETE** removes a resource; a repeat finds it already gone. The response can differ (a 404 the second time), but the state doesn't.
- **POST** usually creates something new each time. Two identical POSTs to `/invoices` can create two invoices.
- **PATCH** isn't idempotent by definition. A PATCH that sets a field is safe to repeat; one that appends to a list or increments a value isn't.

Idempotency is about the effect on the server, not the response. That's why retries are the problem: a client that never got a response can't tell whether its first request ran.


## How do APIs make POST requests safe to retry?


APIs make POST safe to retry in one of three ways: the client supplies the ID, the create is split into two idempotent steps, or the client sends an idempotency key the server remembers.

1. **Client-supplied IDs.** The client generates a unique ID and sends it with the create. A retry with the same ID hits a uniqueness check and is rejected, often with a 409 Conflict, instead of creating a second record.
2. **Two steps.** A POST reserves an empty resource and returns its ID; a PUT to that ID fills it in. PUT is idempotent, so the second step is safe to retry.
3. **An idempotency key.** The client sends a unique value in a header, usually `Idempotency-Key`. The server records the result of the first request for that key and returns it for any retry. On its v1 API, Stripe [saves the status code and body](https://docs.stripe.com/api/idempotent_requests) of the first request made with a key and returns them for retries, and the IETF HTTP APIs working group has an [Internet-Draft](https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/) defining the header.

The idempotency key is the common pattern for payments and accounting writes, where a duplicate costs money.


## Where do duplicate writes come from in an integration?


Duplicate writes in an integration come from retries that run after the first attempt already succeeded. The usual causes:

- **Timeouts.** Your request reaches the source system, the write succeeds, and the response is lost or arrives after your client gives up. If a call times out before the response arrives, the write may already have been applied, so check before you retry.
- **Automatic retries in your stack.** HTTP clients, job queues and SDKs often retry on network errors without knowing whether the write landed.
- **Repeated change events.** A webhook can deliver the same record more than once, or deliver changes out of order, and a handler that creates records on every event creates duplicates.
- **AI agent retries.** An agent that doesn't get a clear success can call a write tool again, and [MCP](/mcp) clients can retry when a session is interrupted.

A 429 rate-limit response is the safe case: the request was refused, so retrying after the wait doesn't duplicate anything. For how unified APIs return and retry rate-limited calls, see [how unified APIs handle rate limits](https://unified.to/blog/how_do_unified_apis_handle_rate_limits).


## How do unified APIs handle idempotency keys?


Unified APIs differ on idempotency keys: some accept a key at their own layer, some hand it to the source system, and some leave it to you. As of 1 December 2026:


| Vendor                           | Mechanism                                                                                             | Scope                                                                                                  | Window                                        | On a retry                                                                          | Stage                                                                                                                        |
| -------------------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | --------------------------------------------- | ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Merge                            | `Idempotency-Key` header                                                                              | POST requests                                                                                          | 24 hours                                      | Same key and parameters return the stored response; different parameters return 400 | "Idempotent operations are currently in beta" ([docs](https://docs.merge.dev/merge-unified/writing-data/writes/idempotency)) |
| Apideck                          | `Idempotency-Key` header; doesn't store responses and lets the integration's own deduplication decide | Listed creates and updates on QuickBooks, NetSuite, Xero and Sage Intacct; other operations return 400 | 24 hours, or the integration's shorter window | Same key and body return the original record; a key still in flight returns 409     | Not labelled beta ([guide](https://developers.apideck.com/guides/idempotency-keys.md))                                       |
| Chift                            | `X-Chift-Client-RequestId` header                                                                     | Any request, scoped to a connection                                                                    | 6 months                                      | A repeat returns 409                                                                | ([docs](https://docs.chift.eu/developer-guides/unified-api/idempotency))                                                     |
| Unified.to | No key on unified write endpoints; headers set on a Passthrough call are sent to the source API       | Passthrough calls to APIs that accept a key                                                            | The source API's window                       | The source API's behaviour                                                          | ([Passthrough API](https://docs.unified.to/passthrough/overview))                                                            |
Two things follow from the table. A key at the integration layer only protects the operations the vendor lists, so check that the write your product makes is covered. And a key the source system honours itself, such as Stripe's or Xero's `Idempotency-Key`, protects the write wherever the retry comes from. For how Merge and Unified.to compare beyond idempotency, see [Merge vs. Unified.to](https://unified.to/blog/merge_vs_unified_which_unified_api_should_you_choose_in_2026).


## How do you make writes through Unified.to safe to retry?


On Unified.to, duplicate protection lives in your code or in the source API, because the unified write endpoints take no idempotency key and Unified.to doesn't retry calls for you. As of 1 December 2026:

- **Writes are synchronous.** A write goes to the source system in the same request and returns the created or updated record, or the source's error, with no job to poll ([Rutter migration guide](https://docs.unified.to/migrate/rutter)).
- **Unified.to** **doesn't hold or retry API calls.** It returns a rate-limit or source error to you straight away, so every retry is your code's decision, and that's where the check goes ([rate limits and retries](https://docs.unified.to/guides/rate_limits_and_retries)).
- **[Rate limits](https://docs.unified.to/reference/rate_limits) come back as 429.** A vendor 429, a vendor 503, or a 403 whose error identifies a rate limit reaches you as a 429, with `Retry-After` in whole seconds when the vendor sent a readable wait. Unified.to's own workspace limit also returns 429, usually with `Retry-After`. A 429 means the request wasn't processed, so retrying after the wait is safe.
- **Passthrough carries the source API's own key.** Headers you set on a Passthrough call are sent to the source API; credentials can't be overridden. For a write to an API that honours `Idempotency-Key`, send it on the Passthrough call and the source deduplicates.

Patterns that cover most cases:

1. **Store the source ID.** Save the ID the create returns against your own record, with a unique constraint on the connection ID and your record's ID, so a second create for the same record fails in your database before it reaches the API.
2. **Check before retrying a timed-out create.** List or search the object by a field you set, such as an email, a reference number or an external ID, and only create if nothing matches.
3. **Make webhook handlers update by state, not by event.** Unified.to's [webhooks guide](https://docs.unified.to/guides/how_to_create_and_configure_webhooks) says rapid changes "can trigger multiple events that may arrive out of order" and that some integrations, such as HubSpot, send an event per property change. Use the object's latest state and only update a record when the incoming `updated_at` is newer.
4. **Expect redelivery after failures.** A [virtual webhook](https://unified.to/blog/what_are_virtual_webhooks_how_they_differ_from_sync_based_webhooks) that fails to deliver re-reads the same page from the integration and its cursor advances only after a successful delivery, so the same records can arrive again. A native webhook is retried 3 times and then marked unhealthy, and the event isn't redelivered unless the integration sends it again.

## How do you keep AI agent writes from duplicating?


Keep agent writes from duplicating by limiting which write tools the agent sees and making those tools safe to repeat. [Unified MCP](/mcp), Unified.to's hosted MCP server for products, runs each tool call through the same handler as the equivalent API call, so it behaves the same way: Unified.to doesn't retry it, and retries come from your agent or MCP client.

- **Show the agent only the writes it needs.** A connection-scoped session only shows the agent tools for that connection's integration, and the `permissions` and `tools` parameters narrow the list further ([Unified MCP](https://docs.unified.to/mcp)).
- **Make write tools safe to repeat.** Apply the same checks as for API calls: store the source ID, and look before you create.
- **Check the log.** Each tool call appears in the API-call log with the type `mcp`, so a repeated write shows up as two rows. For how Unified MCP compares with other hosted MCP servers, see [Unified MCP vs. Merge Agent Handler](https://unified.to/blog/unified_mcp_vs_merge_agent_handler_which_mcp_server_should_your_agent_use_2026).

## Frequently asked questions


### Is PUT always idempotent?


PUT is idempotent by definition in RFC 9110, but only if the server implements it as a full replacement. An API that treats PUT as a partial update with side effects, such as incrementing a counter, breaks that guarantee, so check the source API's documentation for each write.


### Does Unified.to deduplicate webhook events?


Don't rely on it: Unified.to's webhooks guide says events can repeat and arrive out of order. Design handlers to tolerate both: update records from the object's latest state, and skip an event whose `updated_at` is older than the record you already hold.


---


_Written by Mallory Greene._


_About the author: Mallory Greene is Head of Marketing at_ _Unified.to__. She writes about integration infrastructure, unified APIs, and MCP for technical teams. Based in Toronto._