> For the complete documentation index, see [llms.txt](https://docs.sportradar.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sportradar.com/betlink-integration/backend-integration/idempotency.md).

# Idempotency

Idempotency is a key concept in the BetLink wallet API integration. The Bet Placement endpoint, Void endpoint and Selection Result endpoint must all behave in an idempotent manner. BetLink's idempotency is based on the header `X-Idempotency-Key` which is in the form of a UUID. This means that the endpoints should respond with exactly the same response for a request sent with the same idempotency header, no matter how many times it is received.

Most idempotent reactive APIs achieve this by keeping a log of processed idempotency keys that can be referenced upon receiving a new request. Idempotency keys should only be marked as processed if the request was responded to with a 200, regardless of whether the eventual function goal (of e.g. placing a bet) was successful or not. Any server/general exceptions experienced during processing of a request would not count as a processed key.

* For the Bet Placement endpoint, this means that if the operator backend has already processed a request with the incoming idempotency header, no new bets should be saved against the user but the response should still show that the bet has been placed successfully or unsuccessfully as would have been the case with the first Bet Placement request for this key.
* For the Void endpoint, this means that if the operator backend has already processed a request with the incoming idempotency header, no further bets should be voided but the response should still show that the bets have been successfully or unsuccessfully voided as would have been the case with the first Void request for this key.
* For the Selection Settlement endpoint, this means that if the operator backend has already processed a request with the incoming idempotency header, no additional bet resulting should occur but the response should show that the bets have been successfully or unsuccessfully resulted as would have been the case with the first Selection Result request for this key.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sportradar.com/betlink-integration/backend-integration/idempotency.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
