> ## Documentation Index
> Fetch the complete documentation index at: https://docs.moneyline.co/llms.txt
> Use this file to discover all available pages before exploring further.

# Idempotency

> Retry a write safely — the same key returns the original result instead of creating a duplicate.

Every `POST` endpoint accepts an `Idempotency-Key` header. Retrying with the same key returns the original result rather than creating a second resource.

This matters most for the failure you cannot see: a request that reached the server, succeeded, and then timed out on the way back. Without a key, the safe-looking retry creates a duplicate submission.

```bash cURL icon="https://mintcdn.com/paragon-f28ba471/UuDHN4B1J-v_DThS/images/lang/curl.svg?fit=max&auto=format&n=UuDHN4B1J-v_DThS&q=85&s=317cbd8cd7548ad8579adf23d3bd0ec9" theme={null}
curl -X POST http://localhost:3000/v1/submissions \
  -H "Authorization: Bearer $MONEYLINE_API_KEY" \
  -H "Idempotency-Key: deal-001-create" \
  -H "Content-Type: application/json" \
  -d '{"external_id": "deal-001"}'
```

```ts TypeScript icon="https://mintcdn.com/paragon-f28ba471/UuDHN4B1J-v_DThS/images/lang/typescript.svg?fit=max&auto=format&n=UuDHN4B1J-v_DThS&q=85&s=cba1e12257cdbf42b6c7a23031def04f" theme={null}
await client.submissions.create(
  { external_id: 'deal-001' },
  { idempotencyKey: 'deal-001-create' },
);
```

```python Python icon="https://mintcdn.com/paragon-f28ba471/UuDHN4B1J-v_DThS/images/lang/python.svg?fit=max&auto=format&n=UuDHN4B1J-v_DThS&q=85&s=a9a026d5d8b16735c0cea1b7dd0ac6e5" theme={null}
client.submissions.create(
    external_id="deal-001",
    idempotency_key="deal-001-create",
)
```

## Choosing a key

A good key is derived from the thing you are creating, not from the moment you are creating it.

\[!TIP] `deal-001-create` — derived from your own identifier for the deal.
\[!TIP] A UUID generated once and stored alongside the pending write.
&#x20;A fresh UUID per attempt. Every retry looks like a new request, which defeats the purpose.

> [!NOTE]
>
> Keys are scoped per organization and per endpoint. The same key on
> `POST /v1/submissions` and `POST /v1/webhooks` refers to two different
> operations and will not collide.

## Interaction with retries

The SDKs retry `429` and `5xx` automatically. When you supply an idempotency key those built-in retries are safe by construction — which is the reason to always supply one on writes.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.