SportAPI Documentation
EN
C Product documentationCoupon API
v1
Service & pricing ↗ Get access ↗
Coupon API / Active and settled coupons

Active and Recently Settled Coupons

The SportAPI Coupon Settlement System provides two separate methods:

MethodReturned data
GET /api/partner/coupons/activeAll currently active partner coupons.
GET /api/partner/coupons/calculatedCoupons 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 status is normally 0;
  • real_win is null;
  • calculate_coef is null;
  • calculate_date is null;
  • unsettled bets in events_data have status 0.

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

ConditionBehavior
Parameter omittedThe last 5 minutes are used.
time <= 0The last 5 minutes are used.
time from 1 to 120The provided number of minutes is used.
time > 120The 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
PurposeCurrent incomplete couponsRecently received final results
ParametersNoneOptional time
Maximum windowNot applicable120 minutes
Selection basisCurrent stateFinal settlement time
Active couponsReturnedNot returned
Settled couponsNot returnedReturned within the window
Result formatArray directly in bodyArray 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/active is used for active coupons.
  • /api/partner/coupons/calculated is used for recent results.
  • A valid Bearer JWT is provided.
  • /active has no parameters.
  • The time parameter is specified in minutes.
  • The time value is limited to 120 minutes.
  • /calculated selects by settlement time, not placement time.
  • Coupons are read from the body array, not body.coupons.
  • An empty array is treated as a successful result.
  • Every coupon and its entire events_data array are processed.
  • A repeated coupon_code updates the existing record.
  • Financial operations are idempotent.

Next section: Coupon and bet model.