QueryUsageSubscription
Overview
- Method:
GET
- Endpoint:
/api/QueryUsageSubscription
- Description: Retrieves usage summaries for subscriptions, providing details on voice, data, and SMS usage, including domestic and international consumption, along with associated costs.
GET /api/QueryUsageSubscription
Query Parameters
The following parameters can be used to filter the results:
id
(string, optional): Filter by specific usage record ID.customerId
(string, optional): Filter by customer ID.phoneNumber
(string, optional): Filter by phone number.simCardNumber
(string, optional): Filter by SIM card number.include
(string, optional): Related data to include in the response.fields
(string, optional): Specific fields to include in the response.meta
(string, optional): Additional metadata for the query.take
(integer, optional): Number of results to return (pagination).skip
(integer, optional): Number of results to skip (pagination).orderBy
/orderByDesc
(string, optional): Sort results in ascending or descending order by a specific field.
Response Structure
The response provides detailed usage summaries for subscriptions:
{
"offset": 0,
"total": 3,
"results": [
{
"id": "RMBQxre4zFPscwudq",
"subscriptionId": "za42YEPvugfnQcbiN",
"phoneNumber": "06-****7640",
"yearMonth": "2025_01",
"customerId": "4neHKRNRJcSs78FSX",
"providerGroup": "KPNMOBIEL",
"quantityInBundleHomeVoice": -1,
"usageHomeVoice": 218.13,
"quantityInBundleHomeData": 12000,
"usageHomeData": 2694.31,
"quantityInBundleHomeSms": -1,
"usageHomeSms": 0,
"amountPremium": 0,
"isGroupSim": false,
"amountTotalUsage": 0,
"amountInternationalTotal": 0,
"usageDetails": [
{
"invoiceLineType": "7",
"invoiceLineCode": "INT_NAT",
"description": "Internet nationaal",
"sortOrder": 1033,
"quantity": 1,
"volume": 2758969,
"volumeStr": "2694 MB",
"amount": 0,
"refId": 24,
"rateClassId": "uhFqV5clK0SASANDV"
},
{
"invoiceLineType": "7",
"invoiceLineCode": "N_MOBKPN",
"description": "Bellen naar mobiel",
"sortOrder": 1000,
"quantity": 3,
"volume": 12502,
"volumeStr": "03:28:22",
"amount": 0,
"refId": 41,
"rateClassId": "vM1ytLXW9hov09rZg"
},
{
"invoiceLineType": "7",
"invoiceLineCode": "N_FIXED",
"description": "Bellen naar vaste nummers",
"sortOrder": 1001,
"quantity": 1,
"volume": 586,
"volumeStr": "00:09:46",
"amount": 0,
"refId": 2,
"rateClassId": "JO3s5s8n3O0cKM2Li"
},
{
"invoiceLineType": "8",
"invoiceLineCode": "PRMSMS",
"description": "Sms info: zie Payinfo ",
"sortOrder": 1027,
"quantity": 1,
"volume": 1,
"volumeStr": "1 stk",
"amount": 0,
"refId": 20,
"rateClassId": "aPwBpMERBnLsczlh3"
}
]
},
{
"id": "5xIvCTJsbkPHRzw9Y",
"subscriptionId": "B7ATZKpRp7o9edegf",
"phoneNumber": "06-****8893",
"yearMonth": "2025_01",
"customerId": "4neHKRNRJcSs78FSX",
"providerGroup": "KPNMOBIEL",
"quantityInBundleHomeVoice": -1,
"usageHomeVoice": 0,
"quantityInBundleHomeData": 12000,
"usageHomeData": 8034.94,
"quantityInBundleHomeSms": -1,
"usageHomeSms": 0,
"usageWorldData": 0,
"isGroupSim": false,
"amountTotalUsage": 0,
"amountInternationalTotal": 0,
"amountWorldData": 0,
"usageDetails": [
{
"invoiceLineType": "7",
"invoiceLineCode": "INT_NAT",
"description": "Internet nationaal",
"sortOrder": 1033,
"quantity": 1,
"volume": 8227777,
"volumeStr": "8035 MB",
"amount": 0,
"refId": 24,
"rateClassId": "uhFqV5clK0SASANDV"
},
{
"invoiceLineType": "8",
"invoiceLineCode": "INT_WORLD",
"description": "Internet in de rest van de wereld",
"sortOrder": 1035,
"quantity": 1,
"volume": 0,
"volumeStr": "0 MB",
"amount": 0,
"refId": 33,
"rateClassId": "bKl6QxoKJeMGncDxK"
}
]
},
{
"id": "FD8i9Pbn0Gx6qzzxf",
"subscriptionId": "eZpM5LlprPvSDIBEt",
"phoneNumber": "097-*****6154",
"yearMonth": "2025_01",
"customerId": "2o8Sc3iAz9MQCmA89",
"providerGroup": "KPNMOBIEL",
"usageHomeData": 522.429,
"isGroupSim": true,
"amountTotalUsage": 0,
"amountInternationalTotal": 0,
"usageDetails": [
{
"invoiceLineType": "7",
"invoiceLineCode": "INT_NAT",
"description": "Internet nationaal",
"sortOrder": 1033,
"quantity": 1,
"volume": 534967,
"volumeStr": "522 MB",
"amount": 0,
"refId": 24,
"rateClassId": "uhFqV5clK0SASANDV"
}
]
}
]
}
Field Descriptions
subscriptionsSummary
Object
id
: Unique identifier for the usage record.subscriptionId
: ID of the subscription.phoneNumber
: Associated phone number.yearMonth
: Year and month of usage record.customerId
: Customer ID.providerGroup
: Provider group name.quantityInBundleHomeVoice
: Included voice bundle (home).usageHomeVoice
: Used voice minutes (home).quantityInBundleHomeData
: Included data bundle (home).usageHomeData
: Used data (home).quantityInBundleHomeSms
: Included SMS bundle (home).usageHomeSms
: Used SMS (home).amountPremium
: Premium charges.isGroupSim
: Indicates whether it's a group SIM.amountTotalUsage
: Total usage cost.amountInternationalTotal
: Total international charges.usageDetails
: List of detailed usage objects per invoice line.
Warning
The subscription only appears in the data when there was usage registration in the period!
usageDetails
Object
invoiceLineType
: Type of invoice line.invoiceLineCode
: Code representing the usage category.description
: Description of the usage codeinvoiceLineCode
.quantity
: Number of occurrences.volume
: Amount of data or time used.volumeStr
: String representation of usage volume.amount
: Cost associated with this line item.refId
: Reference ID.rateClassId
: Rate class ID. (this is the reference we use to link it to theinvoiceLineCode
field).
Warning
The usageDetails
-object of a specific invoiceLineCode
only appear when there was usage registration in the period and on the specific invoiceLineCode
!
Usage Notes
- Use
customerId
,phoneNumber
, orsimCardNumber
to filter specific usage data. - Apply
skip
andtake
for pagination when handling large datasets. - Use
orderBy
andorderByDesc
to sort results for more readable output. subscriptions
only appear when usage was registered in the period requested.
Example Requests
Retrieve the latest usage summary for a phone number
GET /api/QueryUsageSubscription?phoneNumber=06-12345678&orderByDesc=yearMonth
Paginate through usage data (first 50 records)
GET /api/QueryUsageSubscription?skip=0&take=50
Summary
The /api/QueryUsageSubscription
endpoint provides detailed usage data, including call, SMS, and data usage.
- Supports filtering by
customerId
,phoneNumber
, andsimCardNumber
. - Returns usage summaries including bundled and used amounts.
- Supports sorting and pagination for optimized data retrieval.
Use this API to analyze subscription usage efficiently.