Tickets

Credit Tickets to User

POST /users/{user_id}/tickets/credit

This API is used to credit a specified number of tickets to a user’s account. The API requires authentication and the organization’s ID to ensure proper access control. Upon successfully crediting the tickets, the API returns the updated ticket balance and a unique transaction identifier.

Body

Name
Type
Description

amount

number

Number of the tickets to credit

description

string(optional)

Description or reason for crediting tickets

idempotency_key

string

Idempotency key

Response

{
  "status": "success",
  "user_id": string,
  "new_ticket_balance": number,
  "transaction_id": string  // Unique ID for the ticketing action
}

Debit Tickets from User

POST /users/{user_id}/tickets/debit

This API is used to debit (subtract) a specified number of tickets from a user’s account.

Body

Name
Type
Description

amount

number

Number of tickets to debit

description

string(optional)

Description or reason for debiting tickets

idempotency_key

string

Idempotency key

Response

{
  "status": "success",
  "user_id": string,
  "new_ticket_balance": number,
  "transaction_id": "string"  // Unique ID for the ticketing action
}

Get User Ticket History

GET /users/{user_id}/tickets/history

This API is used to retrieve the transaction history of ticket credits and debits for a specific user. It supports pagination to manage large data sets and provides details about each transaction, including the type, amount, and description.

Query Parameters

Name
Type
Description

limit

number (optional)

The number of transactions to return (default 10)

next_token

number (optional)

Pagination cursor to get the next set of results.

Response

{
  "status": "success",
  "limit": number,
  "next_token": string,  // The cursor to retrieve the next set of results.
                         // returns "" if it's the last page
  "transactions": [
    {
      "transaction_id": string,
      "idempotency_key": string,
      "outcome_id": string, // if this is from a game, this field will be set
      "amount": number, // can be negative for debit
      "description": string,
      "date_created": string  // ISO 8601 format
    }
  ]
}

Get User Ticket Balance

GET /users/{user_id}/tickets/balance

This API is used to retrieve the current ticket balance for a specific user.

Body

The request body should be empty

Response

{
  "status": "success",
  "balance": number,
}

Last updated

Was this helpful?