# idempotency_mismatch

> The key is already used

- Status: 422 Unprocessable Entity
- Returned by: /api/public
- Operations: [cancelOrder](https://developers.rivr.io/reference/api-public/cancelOrder.md), [refundOrder](https://developers.rivr.io/reference/api-public/refundOrder.md), [sendOrderToDevice](https://developers.rivr.io/reference/api-public/sendOrderToDevice.md), [createSubscription](https://developers.rivr.io/reference/api-public/createSubscription.md)
- Retry (`retryWhen`): `after_fix`
- Did anything happen? (`outcome`): `none` (It did not happen)
- Idempotency-Key in /api/public
- Page in the portal: https://developers.rivr.io/errors/idempotency_mismatch
- Try it: `GET https://developers.rivr.io/errors/simulate/idempotency_mismatch` answers with the code's exact wire form; `?succeedAfter=N&attempt=K` gives a 200 once `attempt` passes `N`

## What it means

The key has already been used for a different request: another order or another body. Nothing was done. On send-to-device and `POST /api/public/subscriptions` the code comes only in the sandbox until the platform's next release; production ignores the header there.

## What your system does

Use a new key for every new request: every new refund, cancellation, send to a device or subscription request. A retry of the same request sends exactly the same bytes as the first time.

## Is it worth retrying?

No, not without changing the call.

`retryWhen`: `after_fix`. Change the request first, as the code's page says: a value, the token, a header or a new key. Then send it.

## Did anything happen?

`outcome`: `none`. **It did not happen.** This call did not do what you asked for and changed nothing else that you can see or that concerns money. Where the code has an `outcomeNote`, it takes precedence.

This request did nothing. But the key is already used by an earlier request, which may have gone through: the body is compared byte for byte, so a retry with a rebuilt body also gets this answer, for example with a new `createdDate`, another field order or other whitespace. If it was a retry, read the state as for `idempotency_outcome_unknown` before you use a new key.

## Example: /api/public

```http
HTTP/1.1 422 Unprocessable Entity
Content-Type: application/json

{
  "propertyName": "Idempotency-Key",
  "message": "The Idempotency-Key has already been used for a different request (another order or another request body). Nothing was done. Use a new key for every new request.",
  "errorCode": "idempotency_mismatch",
  "code": "idempotency_mismatch",
  "type": "https://developers.rivr.io/errors/idempotency_mismatch"
}
```

The `title`, `detail`, `message` and `error_description` texts are exactly as the API writes them today.
