Active and Recently Settled Coupons
The SportAPI Coupon Settlement System provides two separate methods:
| Method | Returned data |
|---|---|
GET /api/partner/coupons/active | All currently active partner coupons. |
GET /api/partner/coupons/calculated | Coupons whose final result appeared during the last N minutes. |
Both requests require a valid Bearer JWT and return only coupons belonging to the token owner.
Authorization: Bearer <token>
Accept: application/json
Active coupons
Use:
GET /api/partner/coupons/active
The method has no parameters and returns all partner coupons that the API currently considers active.
It is suitable for:
- displaying the user’s current bets;
- restoring a list of incomplete coupons;
- periodically reconciling active coupons with the local database;
- finding coupons still awaiting a result.
Request example
HTTP:
GET /api/partner/coupons/active HTTP/1.1
Host: coupon-api.example.com
Authorization: Bearer <token>
Accept: application/json
cURL:
BASE_URL="https://coupon-api.example.com"
TOKEN="<jwt-token>"
curl --request GET \
--url "$BASE_URL/api/partner/coupons/active" \
--header "Accept: application/json" \
--header "Authorization: Bearer $TOKEN"
The partner receives the actual BASE_URL from the manager.
Response example
{
"code": 1,
"body": [
{
"coupon_code": "000000000272",
"amount": 10,
"win": 18.5,
"potential_win": 18.5,
"real_win": null,
"coef": 1.85,
"original_coef": 1.85,
"calculate_coef": null,
"has_return": false,
"date": 1784970000000,
"status": 0,
"asian": false,
"calculate_date": null,
"coupon_type": 1,
"events_count": 1,
"events_data": [
{
"id": 84521,
"game_id": 737779544,
"raw_pointer": "line#737779544#1#1#0#1.85",
"line_type": "line",
"is_live": false,
"bet_group_id": 1,
"bet_group_name": "Match Result",
"bet_id": 1,
"bet_name": "First Team to Win",
"status": 0,
"opp1": "Team A",
"opp2": "Team B",
"coef": 1.85,
"calc_coef": null,
"calculate_date": null,
"calculate_score": null,
"rate": "0"
}
]
}
],
"error_code": null,
"error_message": null,
"date": 1784970000100,
"time_ms": 15,
"path": "/api/partner/coupons/active"
}
Before settlement:
- coupon
statusis normally0; real_winisnull;calculate_coefisnull;calculate_dateisnull;- unsettled bets in
events_datahave status0.
The value 0 is not used instead of null for an unsettled calculate_date.
When there are no active coupons
An empty list is a successful result:
{
"code": 1,
"body": [],
"error_code": null,
"error_message": null,
"date": 1784970000100,
"time_ms": 5,
"path": "/api/partner/coupons/active"
}
Do not treat an empty body as an error, and do not expect body.coupons: the coupon array is located directly in body.
Recently settled coupons
Use:
GET /api/partner/coupons/calculated?time={minutes}
time is the number of minutes before the current moment.
The time parameter
| Condition | Behavior |
|---|---|
| Parameter omitted | The last 5 minutes are used. |
time <= 0 | The last 5 minutes are used. |
time from 1 to 120 | The provided number of minutes is used. |
time > 120 | The value is limited to 120 minutes. |
Examples:
/api/partner/coupons/calculated
/api/partner/coupons/calculated?time=5
/api/partner/coupons/calculated?time=120
Request example
GET /api/partner/coupons/calculated?time=10 HTTP/1.1
Host: coupon-api.example.com
Authorization: Bearer <token>
Accept: application/json
BASE_URL="https://coupon-api.example.com"
TOKEN="<jwt-token>"
curl --request GET \
--url "$BASE_URL/api/partner/coupons/calculated?time=10" \
--header "Accept: application/json" \
--header "Authorization: Bearer $TOKEN"
How coupons are selected
Selection uses the coupon’s final settlement time:
current time − time minutes ≤ final settlement time
The coupon placement time does not affect this selection.
For example, a coupon may have been placed two days ago but settled during the last 10 minutes. A request with time=10 returns that coupon.
The method does not return:
- active coupons;
- coupons belonging to other partners;
- coupons settled before the selected time window.
Response example
{
"code": 1,
"body": [
{
"coupon_code": "000000000272",
"amount": 10,
"win": 18.5,
"potential_win": 18.5,
"real_win": 18.5,
"coef": 1.85,
"original_coef": 1.85,
"calculate_coef": 1.85,
"has_return": false,
"date": 1784970000000,
"status": 2,
"asian": false,
"calculate_date": 1784973600000,
"coupon_type": 1,
"events_count": 1,
"events_data": [
{
"id": 84521,
"game_id": 737779544,
"raw_pointer": "line#737779544#1#1#0#1.85",
"line_type": "line",
"is_live": false,
"bet_group_id": 1,
"bet_group_name": "Match Result",
"bet_id": 1,
"bet_name": "First Team to Win",
"status": 1,
"opp1": "Team A",
"opp2": "Team B",
"coef": 1.85,
"calc_coef": 1.85,
"calculate_date": 1784973600000,
"calculate_score": "2:1",
"settlement_reason_code": "AUTOMATIC_SETTLEMENT",
"settlement_reason": "Calculated automatically",
"rate": "0"
}
]
}
],
"error_code": null,
"error_message": null,
"date": 1784973600100,
"time_ms": 12,
"path": "/api/partner/coupons/calculated"
}
Every entry in body is a complete coupon model and contains every bet in events_data.
Sport, tournament, participant, bet group, and outcome names are returned in full in the language specified when the coupon was placed.
When there are no new settlements
Empty successful response:
{
"code": 1,
"body": [],
"error_code": null,
"error_message": null,
"date": 1784973600100,
"time_ms": 5,
"path": "/api/partner/coupons/calculated"
}
An empty array means that there are no accessible finally settled coupons in the selected window.
Losing accumulator behavior
An accumulator loss may be determined immediately after its first losing outcome.
The current model of a losing accumulator may therefore contain:
coupon status = 4
one bet has status = 2
some remaining bets still have status = 0
The financial result of this coupon is already a loss, but settlement of the remaining bets continues. The full model is later updated with the final statuses of every bet.
Do not create a new coupon when the same coupon_code appears again. Update the existing record and protect financial operations from repeated execution.
Method differences
| Property | /active | /calculated |
|---|---|---|
| Purpose | Current incomplete coupons | Recently received final results |
| Parameters | None | Optional time |
| Maximum window | Not applicable | 120 minutes |
| Selection basis | Current state | Final settlement time |
| Active coupons | Returned | Not returned |
| Settled coupons | Not returned | Returned within the window |
| Result format | Array directly in body | Array directly in body |
Both methods return the complete new-API coupon model.
Selecting a method
Use /active to:
- display incomplete coupons;
- reconcile the local list of active bets;
- restore active coupons after an outage.
Use /calculated to:
- receive results without callbacks;
- monitor result delivery when callbacks are enabled;
- find coupons settled during a recent period;
- recover after a short outage.
To check specific known codes after an interruption longer than 120 minutes, use POST /api/partner/coupons/results with coupon_ids.
Polling with overlapping windows
For fallback reconciliation, a request can run every 5 minutes while checking the last 10 minutes:
every 5 minutes:
GET /api/partner/coupons/calculated?time=10
This creates overlapping time windows, so one missed run does not cause a result to be lost.
Receiving an already processed coupon again is expected. Update data by coupon_code and do not repeat a debit or credit.
The complete recovery flow is described in Polling fallback.
Checking for success
Both methods use the common response envelope:
HTTP 2xx and code = 1 → request succeeded; process the entire body array
HTTP 2xx and code = 0 → business error; check error_code
HTTP 401 → JWT is missing, invalid, or expired
HTTP 403 → token does not have the required access
HTTP 5xx → temporary server error
When code = 1, an empty body is a valid successful result.
Compatible endpoints
A compatible new-format alias is available for active coupons:
GET /api/v3/partner/bet/active
The following endpoint was previously used for recently settled coupons:
GET /coupons/calculated?time=5
The legacy endpoint remains supported, but new integrations should use /api/partner/coupons/calculated.
A detailed comparison is provided in Migrating from the old API.
Checklist
/api/partner/coupons/activeis used for active coupons./api/partner/coupons/calculatedis used for recent results.- A valid Bearer JWT is provided.
/activehas no parameters.- The
timeparameter is specified in minutes. - The
timevalue is limited to 120 minutes. /calculatedselects by settlement time, not placement time.- Coupons are read from the
bodyarray, notbody.coupons. - An empty array is treated as a successful result.
- Every coupon and its entire
events_dataarray are processed. - A repeated
coupon_codeupdates the existing record. - Financial operations are idempotent.
Next section: Coupon and bet model.