What is an Idempotent API?

An idempotent API is an API endpoint designed so that calling it multiple times with the same input produces the same server-side result as calling it once, making it safe to retry after a timeout or uncertain response.

HTTP method semantics give a starting point — GET, PUT, and DELETE are specified to be idempotent (a repeated PUT with the same body should leave the resource in the same state; a repeated DELETE of an already-deleted resource should be a no-op, not an error), while POST is traditionally not, since it's often used to create a new resource each time it's called. In practice, teams still need to design POST endpoints carefully for idempotency wherever a duplicate submission would cause a real problem, such as creating two orders or sending two payments. The standard technique is an idempotency key: the client generates a unique token per logical operation and sends it with the request; the server records which keys it has already processed and returns the original result for a repeat, instead of executing the operation again. This lets a client safely retry on timeout or connection drop without a human needing to manually check “did that actually go through” before trying again.

In practice with Neotask

Neotask's job and billing endpoints accept an idempotency key on write requests, so if a worker's HTTP call to record a completed job times out and the caller retries, the server recognizes the duplicate key and returns the original result instead of double-processing the job or double-charging credits.

Related terms

Start free

Plans

Free

$0/mo

Download without a card and start for free.

Individual

$50/mo

The full personal agent platform for one person.

Enterprise

$200/mo

Multiple workspaces and capacity for larger teams.

Continue