> For the complete documentation index, see [llms.txt](https://docs.lsports.eu/u/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.lsports.eu/u/defend/integration-guide/bet-placement-responses.md).

# Bet Placement Flow and Responses

Every response POST /cart/place-bet can return, what triggers it, and how to handle it

This page explains how DEFEND processes a bet slip sent to `POST /cart/place-bet`, and lists every response you can receive. Use it to map each response to an action in your sportsbook.

***

## How DEFEND Processes a Bet Slip

DEFEND runs each bet slip through four stages, in this order. The first stage that fails returns its response, and later stages do not run.

1. **Access check.** DEFEND confirms your access token belongs to an operator with active DEFEND access.
2. **Request validation and fixture/market lookup.** DEFEND validates the request body and finds every fixture and market in your selections.
3. **Placement checks.** DEFEND confirms the player is not blocked, then confirms the odds and markets in the bet slip are still current and open. Then it checks the bet slip against the bet slip rules LSports set up for your platform, such as allowed bet types, InPlay betting, stake range, and number of selections. Contact your CSM to change these rules.
4. **Risk limits.** DEFEND checks the bet slip against your [Platform Limits](https://docs.lsports.eu/u/defend/risk-controls/platform-limits.md), [Tiers](https://docs.lsports.eu/u/defend/risk-controls/tiers.md), and [Player Platform Limits](https://docs.lsports.eu/u/defend/step-4-player-management/player-platform-limits.md). The result is accepted, under review, or rejected.

### Response Shapes

Each stage returns a different body shape. Read the HTTP status first, then parse the body that matches it.

| Stage                                | Body shape                                                    | Key fields                                            |
| ------------------------------------ | ------------------------------------------------------------- | ----------------------------------------------------- |
| **Access check**                     | `{ "message": "..." }`                                        | `message`                                             |
| **Request validation and lookup**    | `{ "message", "details", "errorType", "errors", "warnings" }` | `errorType` (when present), `errors`                  |
| **Placement checks and risk limits** | `{ "result", "error_code", "reason", "stake_limit" }`         | `error_code`, `reason`, `stake_limit` (when returned) |

{% hint style="info" %}
Build your handling on `error_code` and `errorType`. The `message`, `details`, and `reason` texts are for people to read and can change.
{% endhint %}

***

## 1. Access Check

DEFEND checks access before it reads the bet slip. Your access token identifies your account (see [Authentication](https://docs.lsports.eu/u/defend/integration-guide/authentication.md)).

| HTTP    | Message                                                            | Trigger                                            | What to do                                                |
| ------- | ------------------------------------------------------------------ | -------------------------------------------------- | --------------------------------------------------------- |
| **401** | `Unauthorized: customerid header is missing.`                      | The request does not identify your account         | Send a valid `Authorization: Bearer <accessToken>` header |
| **400** | `Bad Request: customerid should be a valid number.`                | The account identifier on the request is not valid | Contact your CSM                                          |
| **403** | `User {id} is unauthorized, the user does not have access to rms.` | Your account has no DEFEND access                  | Contact your CSM                                          |
| **402** | `User {id} is unauthorized, his rms asset is not active.`          | Your DEFEND access is inactive                     | Contact your CSM                                          |
| **402** | `User {id} is unauthorized, his rms asset has expired.`            | Your DEFEND access has expired                     | Contact your CSM                                          |
| **500** | `Internal Server Error.`                                           | DEFEND could not complete the access check         | Retry. Contact your CSM if it persists                    |

**Example (HTTP 402)**

```json
{
  "message": "User 1234 is unauthorized, his rms asset has expired."
}
```

***

## 2. Request Validation and Fixture/Market Lookup

DEFEND validates the request and looks up each fixture and market.

### HTTP 400: Request Validation Failed

Returned when a required field is missing or invalid: `betSlipContext`, `betType`, `stake.totalAmount`, `totalSelections`, `selections`, `userInfo`, or `systemStructure` (for `betType: system`). `errors` holds one message per failed field. Outright league and `betSlipId` rules return this response too (see [API Reference](https://docs.lsports.eu/u/defend/api.md)).

DEFEND also enforces these fixed limits for every platform. They are not configurable in ARENA360. The error message names the field but not the limit:

* `totalSelections`: at most 20
* `stake.totalAmount`: greater than 0 and at most 1,000,000
* `betSlipId`: at most 50 characters
* `userInfo.userName`: at most 100 characters
* Selection odds: greater than 1

```json
{
  "message": "Request validation failed. The bet slip contains invalid or missing data that prevents processing.",
  "errors": ["<one message per failed field>"],
  "warnings": [],
  "details": "Please review all error messages and ensure your request contains valid data in the correct format. Each field must meet the specified requirements for successful bet slip processing."
}
```

### HTTP 400: Invalid Selection Data

Returned when DEFEND cannot read the fixture IDs or market IDs in your selections.

```json
{
  "message": "Data validation failed during bet slip processing.",
  "details": "<joined error messages>",
  "errorType": "INVALID_SELECTION_DATA",
  "errors": [],
  "warnings": []
}
```

### HTTP 404: Fixture or Market Not Found

Returned when DEFEND cannot find a fixture or market from your selections.

* **External data sources:** Make sure you sent the fixture and market data to DEFEND through the [Customer Feed Integration API](https://docs.lsports.eu/u/defend/api.md#customer-feed-integration-api) before placing the bet slip
* **TRADE-exclusive:** LSports sends fixture and market data to DEFEND for you. Check that the fixture and market are part of your TRADE setup, or contact your CSM

See the [Integration Guide](https://docs.lsports.eu/u/defend/integration-guide.md) to confirm which setup applies to you.

| `errorType`                     | Meaning                                                                             |
| ------------------------------- | ----------------------------------------------------------------------------------- |
| **`EVENTS_NOT_FOUND`**          | None of the fixtures exist in DEFEND                                                |
| **`PARTIAL_EVENTS_NOT_FOUND`**  | Some of the fixtures are missing. `missingCount` and `totalRequested` show how many |
| **`MARKETS_NOT_FOUND`**         | None of the markets exist in DEFEND                                                 |
| **`PARTIAL_MARKETS_NOT_FOUND`** | Some of the markets are missing. `missingCount` and `totalRequested` show how many  |

### HTTP 422: Bet Construction Failed

Returned when the fixtures and markets exist, but at least one selection cannot be matched. Common causes are a line or outcome that is not available on the fixture, missing odds, or a market that is not open for betting.

DEFEND rejects the whole bet slip and places none of its selections, even when the other selections are valid. `failedSelections` lists each selection that could not be matched, using the IDs you sent in the request.

```json
{
  "message": "Bet construction failed. One or more selections could not be matched, so the bet slip was not placed.",
  "details": "Each selection listed in failedSelections has a line or outcome that is not available on its event, or missing odds data. The bet slip is placed only when every selection is valid. Please verify the listed selections and that the events are open for betting.",
  "errorType": "BET_CONSTRUCTION_FAILED",
  "totalSelectionsProvided": 3,
  "validBetsCreated": 2,
  "failedSelections": [
    {
      "selectionIndex": 2,
      "eventId": "6299995832",
      "marketId": "2666973288",
      "marketLine": "2.5",
      "betId": "2499979555"
    }
  ]
}
```

| Field                                   | Description                                                                 |
| --------------------------------------- | --------------------------------------------------------------------------- |
| **`totalSelectionsProvided`**           | Number of selections in the request                                         |
| **`validBetsCreated`**                  | Number of selections that matched. None of them are placed                  |
| **`failedSelections`**                  | One entry per selection that could not be matched                           |
| **`failedSelections[].selectionIndex`** | Position of the selection in your `selections` array, starting at 0         |
| **`failedSelections[].eventId`**        | Fixture ID, as sent in the request                                          |
| **`failedSelections[].marketId`**       | Market ID, as sent in the request                                           |
| **`failedSelections[].marketLine`**     | Market line, as sent in the request. Omitted when the selection has no line |
| **`failedSelections[].betId`**          | Bet ID, as sent in the request                                              |

To place the bet, remove or replace each selection in `failedSelections` and send the bet slip again.

### HTTP 500 and 503: Processing Errors

These responses mean DEFEND could not finish processing. Retry the request. If the error repeats, contact your CSM with the `errorType` and the time of the request.

| HTTP    | `errorType`                   | Meaning                                                                |
| ------- | ----------------------------- | ---------------------------------------------------------------------- |
| **500** | `DATABASE_ERROR_EVENTS`       | DEFEND could not load the fixtures                                     |
| **500** | `DATABASE_ERROR_MARKETS`      | DEFEND could not load the markets                                      |
| **500** | `MISSING_CART_RULE`           | Your platform's bet slip configuration is incomplete. Contact your CSM |
| **500** | `INTERNAL_PROCESSING_ERROR`   | An unexpected error occurred while processing the bet slip             |
| **503** | `DATABASE_SERVICE_ERROR`      | DEFEND storage is temporarily unavailable                              |
| **400** | `PROCESSING_VALIDATION_ERROR` | The bet slip failed a data check during processing                     |

A request body that is not valid JSON returns HTTP 500 with `{ "description": "Internal Error" }`.

***

## 3. Placement Checks

After validation and lookup, DEFEND confirms the player is not blocked, then confirms the odds and markets in the bet slip are still current and open. Then it checks the bet slip against the bet slip rules LSports set up for your platform, and applies your risk limits (see [section 4](#4-risk-limit-rejection-reasons)).

{% hint style="info" %}
InPlay and mixed bet slips have a default bet delay before DEFEND checks them, so expect a slower response than for PreMatch bet slips. Set your request timeout to allow for it.
{% endhint %}

Every response from this stage uses the same body:

```json
{
  "result": false,
  "error_code": "<code>",
  "reason": "<text>"
}
```

### HTTP 200: Accepted

The bet slip passed every check and is stored.

```json
{
  "bet_code": "7tnsd4d0d-h1d2r2lfs3",
  "shortCode": "2518",
  "result": true
}
```

### HTTP 200: Under Review

The bet slip goes to [Bet Referral](https://docs.lsports.eu/u/defend/bet-monitor.md#bet-referral), where a trader accepts or rejects it. The trader's decision arrives through the `RESERVE_BET_ACCEPT` and `RESERVE_BET_REJECT` events on the [WebSocket connection](https://docs.lsports.eu/u/defend/websocket-connection.md).

```json
{
  "bet_code": "7tnsd4d0d-h1d2r2lfs3",
  "shortCode": "2518",
  "result": false,
  "error_code": "review",
  "reason": "Bet under review"
}
```

A bet slip goes to review in one case: it exceeds a limit whose action is **Check**, and no limit set to **Reject**. When several limits are exceeded, Reject takes priority.

`reason` is always `Bet under review`. The limit that caused the review is shown to the trader in Bet Referral, not in the response.

### HTTP 400: Rejected

Each `error_code` below means the bet slip was not placed.

| `error_code`                   | `reason`                          | Trigger                                                                                                                                                                                                   |
| ------------------------------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`user_locked`**              | `User is blocked`                 | The player is blocked in [Player List](https://docs.lsports.eu/u/defend/step-4-player-management/player-list.md)                                                                                          |
| **`update_odds`**              | `Invalid odds`                    | A selection no longer matches current odds or market state. See [Odds validation failed](https://docs.lsports.eu/u/defend/api.md#response-http-400-odds-validation-failed)                                |
| **`constraints_check_failed`** | `Invalid constraints: <messages>` | The bet slip breaks one or more of your platform's bet slip rules (see below)                                                                                                                             |
| **`totals_incorrect`**         | `Totals incorrect`                | DEFEND could not confirm the bet slip totals from the stake and odds sent. Resend the bet slip with current odds. If you use `accept_odds`, send it as the boolean `true`. Contact your CSM if it repeats |
| **`external_save_failed`**     | One or more risk limit messages   | The bet slip exceeds a limit set to **Reject**. See [section 4](#4-risk-limit-rejection-reasons)                                                                                                          |
| **`duplicate_bet_slip_id`**    | `Bet slip id already exists`      | The `betSlipId` was already used. See [Bet Slip ID Support](https://docs.lsports.eu/u/defend/api.md#bet-slip-id-support)                                                                                  |
| **`generic_error`**            | `Generic Error`                   | An unexpected error occurred during placement. Retry, and contact your CSM if it repeats                                                                                                                  |

{% hint style="info" %}
`generic_error` returns HTTP 400, not HTTP 500. Treat it as a temporary failure and retry.
{% endhint %}

#### Bet Slip Rule Messages (`constraints_check_failed`)

When several rules fail, `reason` lists every message, separated by commas.

```json
{
  "result": false,
  "error_code": "constraints_check_failed",
  "reason": "Invalid constraints: liveNotEnabled"
}
```

| Message                                                           | Meaning                                                                                     |
| ----------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
| **`singleNotAllowed`**                                            | Single bet slips are not enabled on your platform                                           |
| **`multipleNotAllowed`**                                          | Multiple bet slips are not enabled on your platform                                         |
| **`systemNotAllowed`**                                            | System bet slips are not enabled on your platform                                           |
| **`live or mixed contexts are not allowed for system bet-slips`** | System bet slips can only contain PreMatch selections                                       |
| **`liveNotEnabled`**                                              | InPlay betting is not enabled on your platform                                              |
| **`antepostCombinabilityNotAllowed`**                             | Outright selections cannot be combined with other selections                                |
| **`maximumOddsSystem`**                                           | The system bet slip has more than 10 selections                                             |
| **`minimumAmountNotRespected`**                                   | The stake on a PreMatch bet slip is below the minimum in your bet slip rules                |
| **`<fixture> Multiplicity not respected`**                        | A selection from this fixture cannot be placed in a bet slip with this number of selections |

#### Odds Validation Reasons (`update_odds`)

The `data_to_update` array lists each failing selection with its own `reason`. Each entry also identifies the selection with the IDs you sent in the request, so you can match it to your bet slip directly.

| Field                | Description                                                                 |
| -------------------- | --------------------------------------------------------------------------- |
| **`selectionIndex`** | Position of the selection in your `selections` array, starting at 0         |
| **`eventId`**        | Fixture ID, as sent in the request                                          |
| **`marketId`**       | Market ID, as sent in the request                                           |
| **`marketLine`**     | Market line, as sent in the request. Omitted when the selection has no line |
| **`betId`**          | Bet ID, as sent in the request                                              |

```json
{
  "result": false,
  "error_code": "update_odds",
  "reason": "Invalid odds",
  "data_to_update": [
    {
      "source": "eventId;marketUniqueId;outcomeId",
      "type": "prematch",
      "result": false,
      "reason": "disabled",
      "selectionIndex": 1,
      "eventId": "4459816548",
      "marketId": "2666973288",
      "marketLine": "2.5",
      "betId": "4273848547"
    }
  ]
}
```

The other fields (`source`, `type`, `result`, `reason`, `newOdd`) are unchanged.

| `reason`                   | Meaning                                                                                 |
| -------------------------- | --------------------------------------------------------------------------------------- |
| **`changed_odd_value`**    | Odds in the request differ from current odds                                            |
| **`disabled`**             | The outcome or market is suspended or deactivated                                       |
| **`time_over`**            | The fixture has started, finished, or been cancelled, or the outcome is already settled |
| **`changed_multiplicity`** | The combination rules for the selection have changed                                    |

Setting `accept_odds` to `true` only corrects a `changed_odd_value` selection. All other reasons in this table still return `update_odds`.

***

## 4. Risk Limit Rejection Reasons

When a bet slip exceeds a limit set to **Reject**, DEFEND returns HTTP 400 with `error_code: external_save_failed`. `reason` holds the message for each limit the bet slip exceeded.

```json
{
  "result": false,
  "error_code": "external_save_failed",
  "reason": "Rule entity Market Error: (22920/7525)"
}
```

### Reading the Reason

* **Values.** Most messages end in `(actual/limit)`. In the example above, the potential win of 22920 exceeds the market limit of 7525.
* **Several limits.** When more than one limit is exceeded, `reason` lists every message, separated by a blank line (`\n\n`).
* **Language.** Messages are returned in your platform language (English, Spanish, Italian, or Portuguese). The tables below show the English text.
* **Bet type.** `{type}` in a message is `single`, `multiple`, or `system`. Some messages use `simple` for single bet slips.
* **Context.** `{context}` is `live`, `prematch`, or `mixed`. Mixed covers bet slips that contain both InPlay and PreMatch selections.

A limit set to **Check** sends the bet slip to review instead. The same messages appear as the review reason in Bet Referral.

### Maximum Allowed Stake

When DEFEND rejects a bet slip for its potential win, it also returns `stake_limit`: the largest stake whose potential win stays within the limit. Offer this amount to the player so they can place the bet again.

#### When It Is Returned

`stake_limit` is returned on a rejected bet slip when at least one exceeded limit is one of these:

| Limit                                            | Message in `reason`                               |
| ------------------------------------------------ | ------------------------------------------------- |
| **Market limit**                                 | `Rule entity Market Error: (potential win/limit)` |
| **Max Winning** (PreMatch) or **Max Win InPlay** | `Error max winning for {type} bet`                |

* It applies to single and multiple bet slips (PreMatch, InPlay, and mixed), and to outright single bet slips.
* If the bet slip exceeded other limits in addition to the limits above, `stake_limit` is still returned.
* It is not returned when the bet slip is sent to review, or for system bet slips.

#### Examples

**Single bet slip.** Stake €10,000 at odds 3.00, market limit €5,000. The largest stake whose potential win stays within €5,000 is €1,666.66.

```json
{
  "result": false,
  "error_code": "external_save_failed",
  "reason": "Rule entity Market Error: (30000/5000)",
  "stake_limit": {
    "requested_stake": 10000.00,
    "max_allowed_stake": 1666.66,
    "currency": "EUR"
  }
}
```

**Multiple bet slip.** Stake €10 at combined odds 20.00 (potential win €200). Two selections exceed their market limits: the first at €150, the second at €100. `reason` shows the first selection that went over its limit. `max_allowed_stake` uses the lowest exceeded limit, €100.

```json
{
  "result": false,
  "error_code": "external_save_failed",
  "reason": "Rule entity Market Error: (200/150)",
  "stake_limit": {
    "requested_stake": 10.00,
    "max_allowed_stake": 5.00,
    "currency": "EUR"
  }
}
```

#### Fields

| Field               | Type   | Description                                                                                                                                 |
| ------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| `requested_stake`   | number | The stake sent in the bet slip                                                                                                              |
| `max_allowed_stake` | number | The largest stake whose potential win stays within the limit, rounded down to the cent. When several limits are exceeded, the lowest amount |
| `currency`          | string | Currency of both amounts                                                                                                                    |

{% hint style="info" %}
Read the amount from `max_allowed_stake`. Do not parse it from `reason`.
{% endhint %}

#### Placing the Bet Again

* Send a new bet slip with a new `betSlipId` and the stake from `max_allowed_stake`.
* **InPlay.** Odds can change before the player confirms. If the new bet slip is rejected again, DEFEND returns a new `stake_limit` based on the current odds.
* The new bet slip is checked against all your limits again, so it can still be rejected.

### Stake and Winnings

| Message                                                           | Limit                                                                                                 |
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| **`Error min amount for {type} bet (stake/limit)`**               | **Min Bet Amount**: the stake is below the minimum. PreMatch bet slips only                           |
| **`Error max played for {type} bet (stake/limit)`**               | **Max Bet Amount**: the stake is above the maximum                                                    |
| **`Error max winning for {type} bet`**                            | **Max Winning** or **Max Win InPlay**: the potential win is above the maximum                         |
| **`Error maximum winning for {type} bet exceeded (total/limit)`** | **Bet Max Risk**: the monthly limit for this bet type was exceeded. PreMatch bet slips only           |
| **`Block error on maximum amount (stake/limit)`**                 | The stake is above the blocking amount set for your platform or player. Contact your CSM to review it |

### Odds

| Message                              | Limit                                                                                                                |
| ------------------------------------ | -------------------------------------------------------------------------------------------------------------------- |
| **`Error odds range not respected`** | **Min-Max Odds**: at least one selection in the bet slip has odds outside the allowed range. PreMatch bet slips only |

### Repeated Bets

Repeated bet limits count the same bet placed by the same player within a rolling 24-hour window.

| Message                                                              | Limit                                                                 |
| -------------------------------------------------------------------- | --------------------------------------------------------------------- |
| **`Error max repeated {type} bet for user(count/limit)`**            | **Cumulative For Repeated Bet**: the bet was placed too many times    |
| **`Error max amount for repeated {type} bet for user(stake/limit)`** | **Max Repeated For Bet**: total stake on the repeated bet is too high |

### Winning Percentage

| Message                                                                           | Limit                                                                                                                                                                                                                                                                                                                        |
| --------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Error max percentage for winning in {type} {context} bet {actual} > {limit}`** | **Max Winning Percentage**: of the player's winning bet slips in this context, the share that are this bet type is above the maximum. `{actual}` and `{limit}` are percentages. Checked only for players with a [Player Platform Limit](https://docs.lsports.eu/u/defend/step-4-player-management/player-platform-limits.md) |

### Ongoing Winnings

Ongoing winnings limits cap the total potential winnings from bets that are not yet settled.

| Message                                                                             | Limit                                                                           |
| ----------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- |
| **`Error ongoing winning in progress for {type} live bet(limit)`**                  | **Max Winning for Ongoing Bet**: the player's InPlay limit                      |
| **`Error max ongoing winning for system live bet(limit)`**                          | **Max Winning for Ongoing Bet**: the player's InPlay limit for system bet slips |
| **`Error ongoing winning for {type} prematch bet(limit)`**                          | **Max Winning for Ongoing PreMatch Bet**: the player's PreMatch limit           |
| **`Error platform-wide ongoing winning exceeded for {type} {context} bet (limit)`** | Platform-wide cap on ongoing winnings across all players                        |

### Market Limit

| Message                                               | Limit                                                                                                  |
| ----------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| **`Rule entity Market Error: (potential win/limit)`** | The potential win is above the [market limit](https://docs.lsports.eu/u/defend/risk-controls/tiers.md) |

***

## Related

* [API Reference](https://docs.lsports.eu/u/defend/api.md): Request and response schemas for `POST /cart/place-bet`
* [Platform Limits](https://docs.lsports.eu/u/defend/risk-controls/platform-limits.md): Configure the limits behind each rejection reason
* [Tiers](https://docs.lsports.eu/u/defend/risk-controls/tiers.md): Configure market Lay to Lose limits
* [Bet Monitor](https://docs.lsports.eu/u/defend/bet-monitor.md): Review bet slips held for Bet Referral


---

# 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.lsports.eu/u/defend/integration-guide/bet-placement-responses.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.
