# Void Endpoint

Sometimes the BetLink backend will need to void bets. Some examples of when this might happen are:

* there is a network issue during bet a placement request to the operator that means the BetLink backend has no knowledge of whether the betslip was successfully placed or otherwise on the operator end
* in future versions of BetLink, automated bet voiding tools will be added that allow an operator agent to void bets or groups of bets via an admin console

When a void request is received, all of the bets within the bets array should be looked up in the operator backend and set to a status akin to 'VOIDED', which can never be resulted/settled. If the operator has no record of the bets (or that they're already voided as per the idempotency requirements), it should respond anyway with a successful void response, as detailed below.

### Request Parameters

type: `POST`\
content-type: `application/json`

#### Idempotency

Request will contain a header `X-Idempotency-Key` in the form of a UUID string. See the 'Idempotency' section for more detail.

<table><thead><tr><th width="178">Parameter</th><th width="216">Type</th><th width="111">Required?</th><th>Example</th></tr></thead><tbody><tr><td>requestId</td><td>String/UUID</td><td>Yes</td><td>92e02ae9-a2a3-48e2-af0e-940aec4bbcfb</td></tr><tr><td>userId</td><td>String</td><td>Yes</td><td>user123</td></tr><tr><td>timestamp</td><td>String (epoch)</td><td>Yes</td><td>1640995200000</td></tr><tr><td>bets</td><td>Array &#x3C;VoidBetDetails></td><td>Yes</td><td></td></tr></tbody></table>

### Response Parameters

accepts: `application/json`

<table><thead><tr><th width="179">Parameter</th><th width="215">Type</th><th width="112">Required?</th><th></th></tr></thead><tbody><tr><td>requestId</td><td>String/UUID</td><td>Yes</td><td>Matches request's requestId</td></tr><tr><td>userId</td><td>String</td><td>Yes</td><td></td></tr><tr><td>timestamp</td><td>String (epoch)</td><td>Yes</td><td>Response timestamp</td></tr><tr><td>status</td><td>String ("VOIDED")</td><td>Yes</td><td></td></tr><tr><td>bets</td><td>Array &#x3C;VoidBetDetails></td><td>Yes</td><td></td></tr></tbody></table>

### Error Response

accepts: `application/json`

| Parameter    | Type               | Required? |
| ------------ | ------------------ | --------- |
| status       | String ("FAILURE") | Yes       |
| errorCode    | String             | Yes       |
| errorMessage | String             | No        |

#### Errors

| Error Code             | Http Status |
| ---------------------- | ----------- |
| INVALID\_USER          | 400         |
| INVALID\_BET\_DETAILS  | 400         |
| MISSING\_PARAMETER     | 400         |
| AUTHENTICATION\_FAILED | 403         |
| GENERAL\_EXCEPTION     | 500         |
| REQUEST\_TIMED\_OUT    | 503         |

### VoidBetDetails

<table><thead><tr><th>Parameter</th><th width="158">Type</th><th>Required?</th></tr></thead><tbody><tr><td>betId</td><td>String/UUID</td><td>Yes</td></tr><tr><td>sportId</td><td>String</td><td>Yes</td></tr><tr><td>eventId</td><td>String</td><td>Yes</td></tr><tr><td>marketId</td><td>String</td><td>Yes</td></tr><tr><td>selectionId</td><td>String</td><td>Yes</td></tr></tbody></table>
