# External Settlement Request and Response (Including Rejection)

The example below is based on a Ticket placement request that also includes some external content.&#x20;

<details>

<summary><strong>Ticket Placement Request</strong> </summary>

```json
{
  "operatorId": 9985,
  "content": {
    "type": "ticket",
    "ticketId": "Ticket_3668",
    "bets": [
      {
        "betId": "Ticket_3668_bet_0",
        "selections": [
          {
            "type": "external",
            "event": "ext:match:736977",
            "expSettleTime": 1691581504000,
            "outcome": "ext-pre:9985:s77",
            "odds": {
              "type": "decimal",
              "value": "7.1"
            }
          },
          {
            "type": "uf",
            "productId": "1",
            "eventId": "sr:match:15163591",
            "marketId": "1",
            "outcomeId": "2",
            "specifiers": "hcp=1:0",
            "odds": {
              "type": "decimal",
              "value": "1.48"
            }
          }
        ],
        "stake": [
          {
            "type": "cash",
            "currency": "EUR",
            "amount": "50"
          }
        ]
      },
      {
        "betId": "Ticket_3668_bet_1",
        "selections": [
         {
           "type": "uf",
           "productId": "3",
           "eventId": "sr:season:55413",
           "marketId": "534",
           "outcomeId": "pre:outcometext:9919",
           "specifiers": "variant=pre:markettext:60279",
           "odds": {
             "type": "decimal",
             "value": "1.1"
           }
         }
       ],
        "stake": [
          {
            "type": "cash",
            "currency": "EUR",
            "amount": "10"
          }
        ]
      }
    ],
    "context": {
      "channel": {
        "type": "retail",
        "shopId": "shop_789135"
      },
      "limitId": 1409
    }
  },
  "correlationId": "tD01Nm532",
  "timestampUtc": 1679060042000,
  "operation": "ticket-placement",
  "version": "3.0"
}
```

</details>

<br>

The **settlement for the selection with external content** is done by the External settlement request (below). It contains a reference to the corresponding ticket, bet ("betId": "Bet\_ewe80D1dQw") and the amount won by this selection(s) (the amount is zero in case of a losing selection(s)). The External settlement request must be sent no later than 30 days after the date reported in the "expSettleTime" field of the original Ticket placement request (otherwise the bet will be automatically settled as lost by MTS).

<details>

<summary><strong>External Settlement Request</strong></summary>

```json
{
  "operatorId": 9985,
  "content": {
    "type": "ext-settlement",
    "settlementId": "SETL3134413498778",
    "details": {
      "type": "bet",
      "ticketId": "Ticket_3668",
      "ticketSignature": "IEzuiEl82X+SmjWB3xDB0AIB6fUZVFOvmGKm6Rcvxm0=",
      "betId": "Ticket_3668_bet_0",
      "payout": [
        {
            "type": "cash",
            "currency": "EUR",
            "amount": "11.45",
            "traceId": "Source_8963"
        }
      ]
    }
  },
  "correlationId": "6kxT98Sj3",
  "timestampUtc": 1678883043000,
  "operation": "ticket-ext-settlement",
  "version": "3.0"
}
```

</details>

<details>

<summary><strong>External Settlement Response</strong></summary>

```json
{
  "content": {
    "type": "ext-settlement-reply",
    "settlementId": "SETL3134413498778",
    "signature": "mHFX4dXMq4b3aqnVbgiFL06LlHZTU4pj7Qn8rYnmLgA=",
    "status": "accepted",
    "ticketId": "Ticket_3668",
    "code": 0,
    "message": "Transaction processed"
  },
  "correlationId": "6kxT98Sj3",
  "timestampUtc": 1691750043000,
  "operation": "ticket-ext-settlement",
  "version": "3.0"
}
```

</details>

<br>

#### Rejection example <a href="#mtsexternalsettlementrequestandresponse-includingrejection-v3.0-rejectionexample" id="mtsexternalsettlementrequestandresponse-includingrejection-v3.0-rejectionexample"></a>

This is an example of a negative response from MTS. In this case, the request is rejected because some other selections (of the same bet) with Sportradar content have already been settled as lost. For available External settlement response codes, see [here](https://app.gitbook.com/s/k9SMFSuFGUx0b4iEHZ2f/api-description/ticket-json-format-description/external-content-description/external-settlement-response).

<details>

<summary><strong>External Settlement Response  -  Rejection</strong></summary>

```json
{
  "content": {
    "type": "ext-settlement-reply",
    "settlementId": "SETL3134413498778",
    "signature": "mHFX4dXMq4b3aqnVbgiFL06LlHZTU4pj7Qn8rYnmLgA=",
    "status": "rejected",
    "ticketId": "Ticket_3668",
    "code": -207,
    "message": "External settlement sent for ticket with losing Sportradar content selection(s)"
  },
  "correlationId": "6kxT98Sj3",
  "timestampUtc": 1691750043000,
  "operation": "ticket-ext-settlement",
  "version": "3.0"
}
```

</details>


---

# Agent Instructions: 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:

```
GET https://docs.sportradar.com/mts/transaction-3.0-api/mts-related-transaction-examples/external-content-examples/external-settlement-request-and-response-including-rejection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
