# Cashout API

Cashout API allows to control which bets are included in the Cashout Feed.

{% content-ref url="/pages/ivn3IWuh7XK7eWavHRnp" %}
[Cashout Feed](/odds88-client-api/odds88-feeds/cashout-feed.md)
{% endcontent-ref %}

As cashout real-time calculation can be very resource-consuming, we need to know which exact bets we should keep there.

## Subscribe Endpoint

Allows to subscribe to a potential cashout amount for specific bets.

`betIds` should contain only ids of the bets (without player id).

{% hint style="info" %}
Subscription will wear-out after 10 minutes.

In order to keep bets in the subscription, this endpoint should be called periodically to renew the subscription.
{% endhint %}

Potential cashout values will be sent via the Cashout Feed.

{% content-ref url="/pages/ivn3IWuh7XK7eWavHRnp" %}
[Cashout Feed](/odds88-client-api/odds88-feeds/cashout-feed.md)
{% endcontent-ref %}

## POST /api/Cashout/subscribe

> Subscribes to provided bets for realtime data

```json
{"openapi":"3.0.4","info":{"title":"[T1159-STAGE] Odds88 API","version":"v1"},"tags":[{"name":"Cashout"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel":{"required":["betIds"],"type":"object","properties":{"betIds":{"type":"array","items":{"type":"string"},"nullable":true}},"additionalProperties":false}}},"paths":{"/api/Cashout/subscribe":{"post":{"tags":["Cashout"],"summary":"Subscribes to provided bets for realtime data","requestBody":{"description":"","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}},"text/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}},"application/*+json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}}}},"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal Server Error"}}}}}}
```

## Unsubscribe Endpoint

Allows to unsibscribe from cashout values for specific bets.

`betIds` should contain only ids of the bets (without player id).

Should be called when real-time cashout amount for specific bets is not needed anymore (when player leaves the bet history page or moves to another page).

## POST /api/Cashout/unsubscribe

> Unsubscribes from provided bets to stop realtime data

```json
{"openapi":"3.0.4","info":{"title":"[T1159-STAGE] Odds88 API","version":"v1"},"tags":[{"name":"Cashout"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel":{"required":["betIds"],"type":"object","properties":{"betIds":{"type":"array","items":{"type":"string"},"nullable":true}},"additionalProperties":false}}},"paths":{"/api/Cashout/unsubscribe":{"post":{"tags":["Cashout"],"summary":"Unsubscribes from provided bets to stop realtime data","requestBody":{"description":"","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}},"text/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}},"application/*+json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutSubscriptionRequestModel"}]}}}},"responses":{"200":{"description":"OK"},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal Server Error"}}}}}}
```

## Cashout Endpoint

Allows to perform cashout of the bet with risk management check.

Odds88 will perform validation of cashout possibility and cashout amount.

## POST /api/Cashout

> Tries to cashout a bet.

```json
{"openapi":"3.0.4","info":{"title":"[T1159-STAGE] Odds88 API","version":"v1"},"tags":[{"name":"Cashout"}],"security":[{"Bearer":[]}],"components":{"securitySchemes":{"Bearer":{"type":"http","description":"JWT Authorization header using the Bearer scheme. Example: \"Authorization: Bearer {token}\"","scheme":"Bearer","bearerFormat":"JWT"}},"schemas":{"Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetRequestModel":{"required":["amount","betId","priceChange"],"type":"object","properties":{"betId":{"type":"string","nullable":true},"priceChange":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.PriceChangeType"}],"description":"* `1` - None\n* `2` - Any"},"amount":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.AmountRequestModel"}],"nullable":true}},"additionalProperties":false},"Marlin.SportsbetApi.Host.Models.Cashout.PriceChangeType":{"enum":[1,2],"type":"integer","description":"* `1` - None\n* `2` - Any","format":"int32"},"Marlin.SportsbetApi.Host.Models.Cashout.AmountRequestModel":{"required":["currency","precision"],"type":"object","properties":{"localAmount":{"type":"number","format":"double","nullable":true},"precision":{"type":"integer","format":"int32"},"currency":{"type":"string","nullable":true}},"additionalProperties":false},"Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponseModel":{"required":["payload","success"],"type":"object","properties":{"success":{"type":"boolean"},"reason":{"type":"string","nullable":true},"payload":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponsePayloadModel"}],"nullable":true}},"additionalProperties":false},"Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponsePayloadModel":{"required":["betId"],"type":"object","properties":{"betId":{"type":"string","nullable":true},"localAmount":{"type":"number","format":"double","nullable":true}},"additionalProperties":false}}},"paths":{"/api/Cashout":{"post":{"tags":["Cashout"],"summary":"Tries to cashout a bet.","requestBody":{"description":"","content":{"application/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetRequestModel"}]}},"text/json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetRequestModel"}]}},"application/*+json":{"schema":{"allOf":[{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetRequestModel"}]}}}},"responses":{"200":{"description":"OK","content":{"text/plain":{"schema":{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponseModel"}},"application/json":{"schema":{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponseModel"}},"text/json":{"schema":{"$ref":"#/components/schemas/Marlin.SportsbetApi.Host.Models.Cashout.CashoutBetResponseModel"}}}},"401":{"description":"Unauthorized"},"403":{"description":"Forbidden"},"500":{"description":"Internal Server Error"}}}}}}
```


---

# 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.odds88.io/odds88-client-api/odds88-api-endpoints/cashout-api.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.
