Skip to main content

User Transaction History

Endpoint

https://api.betatel.com/api/billing/me/transactions

Method: POST

Description: Retrieve transaction history for a specific user.

Request Headers

The request must include an Authorization header with a valid API key for authentication:

HeaderValueRequiredDescription
x-api-key{{x-api-key}}YesThe authentication API key to verify the user's identity

Request Body

Your request should contain the following structure:

{
"filter": {
"serviceId": "otp-call",
"datetime": {
"from": "2025-03-25T09:00:00Z",
"to": "2025-03-25T09:12:00Z"
},
"type": "CREDIT",
"currency": "EUR"
},
"rowsPerPage": 20,
"page": 1
}

Request Parameters

ParamValueTypeRequiredDescription
datetime-ObjectNoFilter transactions for specific date (ISO 8601), for range use from:,to:
serviceIdotp-callStringNoFilter by service ID
currencyEURStringNoFilter by currency code
typeCREDITStringNoFilter by transaction type
page1IntNoPage number (default: 1)
rowsPerPage20IntNoRecords per page (default: 20)

Let’s Dive Into the Code!

Choose your preferred programming language and use the provided examples to integrate the user transaction history.

Example - cURL
curl --location 'https://api.betatel.com/api/billing/me/transactions' \
--header 'Content-Type: application/json' \
--header 'x-api-key: C8FdQrQKxXiLvUtEoyLobJopZwZhalPhdoDr9qVxACBI' \
--data '{
"filter": {
"serviceId": "otp-call",
"datetime": { "from": "2025-03-25T09:00:00Z", "to": "2025-03-25T10:00:00Z" },
"type": "CREDIT",
"currency": "EUR",
"userId": "67a1cfd3e547d3bea4694f51"
},
"rowsPerPage": 20,
"page": 1
}'

Response

JSON Schema:

{
"filter": {
"serviceId": "otp-call",
"datetime": {
"from": "2025-03-25T09:00:00Z",
"to": "2025-03-25T09:12:00Z"
},
"type": "CREDIT",
"currency": "EUR",
"userId": "67a1cfd3e547d3bea4694f51"
},
"page": 1,
"rowsPerPage": 20,
"list": [
{
"_id": "67e272f3296990d38bead330",
"transaction_id": "fjdkfjdk7438473843re",
"correlation_id": "qwertzui1234567898765432345",
"user_id": "67a1cfd3e547d3bea4694f51",
"service_id": "otp-call",
"type": "CREDIT",
"description": "New credit",
"datetime": "2025-03-25T09:10:02.613Z",
"unit_price": 20,
"quantity": 1,
"value": 20,
"currency": "EUR",
"balance_after": 20,
"__v": 0
}
],
"total": 1,
"totalPages": 1,
"hasPreviousPage": false,
"hasNextPage": false
}
FieldTypeDescription
filterobjectThe filters applied to the transaction history query.
- serviceIdstringThe identifier for the service (e.g., "otp-call").
- datetimeobjectThe date and time range for filtering transactions.
-- fromstringThe start of the datetime range (e.g., "2025-03-25T09:00:00Z").
-- tostringThe end of the datetime range (e.g., "2025-03-25T09:12:00Z").
- typestringThe type of transaction (e.g., "CREDIT").
- currencystringThe currency for the transactions (e.g., "EUR").
- userIdstringThe unique identifier for the user (e.g., "67a1cfd3e547d3bea4694f51").
pagenumberThe current page of results (e.g., 1).
rowsPerPagenumberThe number of rows per page (e.g., 20).
listarrayA list of transactions matching the filters.
- _idstringThe unique identifier for the transaction (e.g., "67e272f3296990d38bead330").
- transaction_idstringThe unique identifier for the transaction (e.g., "fjdkfjdk7438473843re").
- correlation_idstringA unique identifier for the authorization request (e.g., "qwertzui1234567898765432345").
- user_idstringThe unique identifier for the user (e.g., "67a1cfd3e547d3bea4694f51").
- service_idstringThe identifier for the service associated with the transaction (e.g., "otp-call").
- typestringThe type of transaction (e.g., "CREDIT").
- descriptionstringA description of the transaction (e.g., "New credit").
- datetimestringThe timestamp of when the transaction occurred (e.g., "2025-03-25T09:10:02.613Z").
- unit_pricenumberThe price per unit for the service (e.g., 20).
- quantitynumberThe quantity of the service used (e.g., 1).
- valuenumberThe total value of the transaction (e.g., 20).
- currencystringThe currency in which the transaction is represented (e.g., "EUR").
- balance_afternumberThe user's balance after the transaction (e.g., 20).
totalnumberThe total number of transactions matching the filters (e.g., 1).
totalPagesnumberThe total number of pages of results (e.g., 1).
hasPreviousPagebooleanIndicates if there is a previous page of results (e.g., false).
hasNextPagebooleanIndicates if there is a next page of results (e.g., false).