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
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
}{
"status": "error",
"message": string // e.g. "ticket amount must be positive"
}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
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
}{
"status": "error",
"message": string // e.g. "ticket amount must be positive"
}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
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
}
]
}{
"status": "error",
"message": string //e.g "limit must be greater than or equal to 0"
}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,
}{
"status": "error",
"message": string //e,g "Invalid user ID"
}Last updated
Was this helpful?