---
title: "Idempotency Keys — Documentation"
canonical: "https://repull.dev/docs/idempotency"
description: "Send an Idempotency-Key on any POST, PUT or PATCH so retries return the first response instead of repeating side effects. Rules and examples."
updated: "2026-11-30T00:48:58.694Z"
commit: "18314c12fefb59a7545ef7607c0893919de20aa9"
---

# Idempotency Keys

Every POST, PUT, and PATCH endpoint accepts an `Idempotency-Key` header. If you send the same key twice, the second request returns the cached response from the first — no duplicate side effects.

## How It Works

Include a unique string in the `Idempotency-Key` header. Repull stores the response for 24 hours. If the same key is sent again, the cached response is returned with an `Idempotency-Status: cached` header.

```
curl -X POST /v1/reservations \
  -H "Authorization: Bearer sk_live_KEY" \
  -H "Idempotency-Key: unique-request-id-12345" \
  -H "Content-Type: application/json" \
  -d '{"propertyId": "123", "checkIn": "2026-06-01", ...}'

# If retried with the same Idempotency-Key, returns cached response
# Response header: Idempotency-Status: cached
```

## When to Use

- **Retry logic** — Network failures, timeouts, or 5xx errors. Retrying with the same key guarantees no duplicate bookings or payments.
- **AI agents** — LLM-driven tools that may retry tool calls. Idempotency prevents double-actions.
- **Webhook handlers** — If your webhook processor might receive the same event twice, use the event ID as the idempotency key when calling back into Repull.
- **User-facing forms** — Prevent double-submit on slow connections.

## Python Example

```
import requests, uuid

response = requests.post(
    "https://api.repull.dev/v1/reservations",
    headers={
        "Authorization": "Bearer sk_live_KEY",
        "Idempotency-Key": str(uuid.uuid4()),
        "Content-Type": "application/json",
    },
    json={
        "propertyId": "123",
        "checkIn": "2026-06-01",
        "checkOut": "2026-06-05",
        "guestName": "Jane Doe",
    },
)

# On retry, use the SAME Idempotency-Key value
print(response.headers.get("Idempotency-Status"))  # "cached" on retry
```

## Key Guidelines

- Keys are cached for **24 hours**. After that, the same key is treated as a new request.
- Use UUIDs or deterministic keys derived from your business logic (e.g. `create-res-guest42-2026-06-01`).
- Keys are scoped per workspace — the same key in different workspaces is treated independently.
- GET and DELETE requests do not support idempotency keys (they are already idempotent by nature).

## Which responses are stored

Only final answers are stored against a key. An answer that means “nothing was done, try again” is not, so retrying with the **same** key runs the request for real:

- any `5xx` server error
- `408`, `425` and `429`, including `airbnb_rate_limited`, `booking_rate_limited` and `daily_limit_exceeded`
- refusals that stop before anything is done and ask you to fix something outside the request first: `connection_reauth_required` and `listing_inactive`

Everything else is stored and replayed, including a final refusal such as `422 airbnb_rejected`. To send a corrected request after one of those, use a new key: the same key with a different body returns `422 idempotency_key_reused`.
