> 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/transaction30api/sandbox/user-manual/max_stake.md).

# max\_stake

**Goal:** Call **max-stake** with a nested ticket and receive the sandbox max cash stake. One module covers both regular UF and accumulator nested shapes.

Sandbox module name: `max_stake` (also case dir `max_stake_accumulator` for the accumulator golden).

{% stepper %}
{% step %}

## Build a nested `TicketRequest`

Build a nested `TicketRequest` with `ticketId`, `TicketContext` (`limitId` + mobile `Channel`).
{% endstep %}

{% step %}

## Omit `endCustomer`

**Omit / leave empty `endCustomer`** — max-stake routing does not use punter id.
{% endstep %}

{% step %}

## Set the first selection event ID

Set first selection `eventId` to **`sr:match:15050881`**.
{% endstep %}

{% step %}

## Select the ticket shape

Regular: one top-level UF selection with decimal odds + cash stake.

Accumulator: one top-level `newAccumulatorSelectionBuilder()` with ≥2 nested UF legs (first leg `sr:match:15050881`).
{% endstep %}

{% step %}

## Wrap and send the request

Wrap with `MaxStakeRequest.newBuilder().setTicket(...)`.

Send with `mbsSdk.getTicketProtocol().sendMaxStake(request)`.
{% endstep %}
{% endstepper %}

## Java example — regular UF

```java
import com.sportradar.mbs.sdk.entities.channel.Channel;
import com.sportradar.mbs.sdk.entities.common.Bet;
import com.sportradar.mbs.sdk.entities.common.TicketContext;
import com.sportradar.mbs.sdk.entities.odds.Odds;
import com.sportradar.mbs.sdk.entities.request.MaxStakeRequest;
import com.sportradar.mbs.sdk.entities.request.TicketRequest;
import com.sportradar.mbs.sdk.entities.response.MaxStakeResponse;
import com.sportradar.mbs.sdk.entities.selection.Selection;
import com.sportradar.mbs.sdk.entities.stake.Stake;
import java.math.BigDecimal;

MaxStakeRequest request = MaxStakeRequest.newBuilder()
    .setTicket(TicketRequest.newBuilder()
        .setTicketId("tid-ms")
        .setContext(TicketContext.newBuilder()
            .setLimitId(123L)
            .setChannel(Channel.newMobileChannelBuilder()
                .setLang("en")
                .setIp("127.0.0.1")
                .setDeviceId("deviceId123")
                .build())
            // omit endCustomer
            .build())
        .setBets(Bet.newBuilder()
            .setBetId("bet-1")
            .setSelections(Selection.newUfSelectionBuilder()
                .setProductId("3")
                .setEventId("sr:match:15050881")
                .setMarketId("m1")
                .setOutcomeId("o1")
                .setOdds(Odds.newDecimalOddsBuilder()
                    .setValue(new BigDecimal("2.0"))
                    .build())
                .build())
            .setStake(Stake.newCashStakeBuilder()
                .setAmount(new BigDecimal("10"))
                .setCurrency("EUR")
                .build())
            .build())
        .build())
    .build();

MaxStakeResponse response = mbsSdk.getTicketProtocol().sendMaxStake(request);
// expect: getMessage() == "accepted", first cash stake amount "2872885"
```

## Java example — accumulator nested

```java
import com.sportradar.mbs.sdk.entities.channel.Channel;
import com.sportradar.mbs.sdk.entities.common.Bet;
import com.sportradar.mbs.sdk.entities.common.TicketContext;
import com.sportradar.mbs.sdk.entities.odds.Odds;
import com.sportradar.mbs.sdk.entities.request.MaxStakeRequest;
import com.sportradar.mbs.sdk.entities.request.TicketRequest;
import com.sportradar.mbs.sdk.entities.response.MaxStakeResponse;
import com.sportradar.mbs.sdk.entities.selection.Selection;
import com.sportradar.mbs.sdk.entities.selection.UfSelection;
import com.sportradar.mbs.sdk.entities.stake.Stake;
import java.math.BigDecimal;

UfSelection leg1 = Selection.newUfSelectionBuilder()
    .setProductId("3")
    .setEventId("sr:match:15050881")
    .setMarketId("m1")
    .setOutcomeId("o1")
    .setOdds(Odds.newDecimalOddsBuilder().setValue(new BigDecimal("1.38")).build())
    .build();
UfSelection leg2 = Selection.newUfSelectionBuilder()
    .setProductId("3")
    .setEventId("sr:match:22222222")
    .setMarketId("m1")
    .setOutcomeId("o1")
    .setOdds(Odds.newDecimalOddsBuilder().setValue(new BigDecimal("1.38")).build())
    .build();

MaxStakeRequest accaRequest = MaxStakeRequest.newBuilder()
    .setTicket(TicketRequest.newBuilder()
        .setTicketId("tid-ms-acca")
        .setContext(TicketContext.newBuilder()
            .setLimitId(123L)
            .setChannel(Channel.newMobileChannelBuilder()
                .setLang("en")
                .setIp("127.0.0.1")
                .setDeviceId("deviceId123")
                .build())
            .build())
        .setBets(Bet.newBuilder()
            .setBetId("bet-acca")
            .setSelections(Selection.newAccumulatorSelectionBuilder()
                .setSelections(leg1, leg2)
                .build())
            .setStake(Stake.newCashStakeBuilder()
                .setAmount(new BigDecimal("10"))
                .setCurrency("EUR")
                .build())
            .build())
        .build())
    .build();

MaxStakeResponse accaResponse = mbsSdk.getTicketProtocol().sendMaxStake(accaRequest);
// expect: message "accepted;selectionType=accumulator", cash amount "1950000"
```

## Wire JSON — regular

```json
{
  "operatorId": 9985,
  "correlationId": "corr-1",
  "timestampUtc": 1710000000000,
  "operation": "max-stake",
  "version": "3.0",
  "content": {
    "type": "max-stake",
    "ticket": {
      "type": "ticket",
      "ticketId": "tid-ms",
      "context": {
        "limitId": 123,
        "channel": {
          "type": "mobile",
          "lang": "en",
          "ip": "127.0.0.1",
          "deviceId": "deviceId123"
        }
      },
      "bets": [
        {
          "betId": "bet-1",
          "selections": [
            {
              "type": "uf",
              "eventId": "sr:match:15050881",
              "marketId": "m1",
              "outcomeId": "o1",
              "productId": "3",
              "odds": { "type": "decimal", "value": "2.0" }
            }
          ],
          "stake": [
            {
              "type": "cash",
              "amount": "10",
              "currency": "EUR"
            }
          ]
        }
      ]
    }
  }
}
```

## Wire JSON — accumulator

Top-level selection `"type": "accumulator"` with nested UF legs; first leg `eventId` `"sr:match:15050881"`. Envelope `operation` / `content.type` remain `"max-stake"`.

| Field name                                                           | Value                     | Mandatory / Optional              | Data type | Ignored by sandbox |
| -------------------------------------------------------------------- | ------------------------- | --------------------------------- | --------- | ------------------ |
| `operatorId`                                                         | `9985`                    | Mandatory                         | integer   | Yes                |
| `operation`                                                          | `"max-stake"`             | Mandatory                         | string    | No                 |
| `content.type`                                                       | `"max-stake"`             | Mandatory                         | string    | No                 |
| `content.ticket.context.limitId`                                     | `123`                     | Mandatory                         | integer   | Yes                |
| `content.ticket.context.channel.type`                                | `"mobile"`                | Mandatory                         | string    | Yes                |
| `content.ticket.context.endCustomer`                                 | *(omit)*                  | Optional — omit for this scenario | object    | —                  |
| `content.ticket.bets[].selections[].type`                            | `"uf"` or `"accumulator"` | Mandatory                         | string    | No (routing)       |
| `content.ticket.bets[].selections[].eventId` (UF) / first nested leg | `"sr:match:15050881"`     | Mandatory (sandbox)               | string    | No (routing)       |
| Stake amount on request                                              | any                       | Mandatory                         | string    | Yes                |

## Expected responses

| Nested shape | `getMessage()`                         | Max cash stake (`getBets()[0]` cash amount) |
| ------------ | -------------------------------------- | ------------------------------------------- |
| Regular UF   | `"accepted"`                           | `"2872885"` EUR                             |
| Accumulator  | `"accepted;selectionType=accumulator"` | `"1950000"` EUR                             |

Wire JSON example (regular; content type `"max-stake-reply"`):

```json
{
  "correlationId": "corr-1",
  "timestampUtc": 1710000001000,
  "operation": "max-stake",
  "version": "3.0",
  "content": {
    "type": "max-stake-reply",
    "code": 0,
    "message": "accepted",
    "signature": "sandbox-signature",
    "bets": [
      {
        "betId": "bet-1",
        "stake": [
          {
            "type": "cash",
            "amount": "2872885",
            "currency": "EUR"
          }
        ]
      }
    ]
  }
}
```

Accumulator reply uses the same shape with `"message": "accepted;selectionType=accumulator"` and `"amount": "1950000"`.

## Common mistakes

| Mistake                                             | Result                                                                  |
| --------------------------------------------------- | ----------------------------------------------------------------------- |
| Wrong / missing `eventId` (not `sr:match:15050881`) | Fallback `-999` on `max-stake-reply`                                    |
| Setting a placement customer id                     | Ignored for max-stake routing (empty punter facet); still ok if present |
| Multi-bet nested ticket                             | Schema / single-bet validation error (not `-999`)                       |
| Expecting placement-style `ticket-reply`            | Reply content type is `"max-stake-reply"`                               |

See also: [Error responses](broken://pages/3cdf760ce49fd6992d47d7772f4a4b9f67f0519f#error-responses) in the parent manual.


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.sportradar.com/transaction30api/sandbox/user-manual/max_stake.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
