List Data Sessions
const url = 'https://api.customer.onsim.uk/v1/data-sessions?from=2026-04-15T12%3A00%3A00Z&to=2026-04-15T12%3A00%3A00Z&roaming=true';const options = {method: 'GET', headers: {'x-api-key': '<x-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://api.customer.onsim.uk/v1/data-sessions?from=2026-04-15T12%3A00%3A00Z&to=2026-04-15T12%3A00%3A00Z&roaming=true' \ --header 'x-api-key: <x-api-key>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”The list has the Data Sessions at this time or later.
The list has the Data Sessions before this time. It is 31 days after from at most.
Only the Data Sessions of the SIM with this extension.
Only the Data Sessions of the SIM of this account, for a SIM with no extension.
true: only the Data Sessions abroad. false: only those at home. With no roaming, the list has both.
Responses
Section titled “Responses”OK
The mobile data that one of your SIMs used in about one hour. It is a reading, not a connection.
object
The ID of the Data Session.
The SIM that used the data: its extension, or its account when it has no extension.
object
The extension, for a party of your own: a User, a Hunt Group or an IVR. Look it up in their lists to learn which, and its name.
The digits of a phone number, for an outside party. withheld when the party hides it. A feature code such as *40 is here too.
The name of one of your own lines that has no extension, such as a SIM in a router. app.onsim shows it in the Account column of its logs.
When the network read the use. A Data Session has one time, and no start or end.
The data that the SIM used, in bytes, in both directions.
The country where the SIM used the data, as an ISO 3166-1 alpha-3 code, such as GBR.
What we charge for the data. A Data Session has none when its record has no amount.
object
The money that we charge. 0 when the tariff rates the use at no cost.
The currency of amount, as an ISO 4217 code, such as GBP.
The units that we bill, after the tariff rounds them. For data, the tariff rounds up to the next 20 KiB.
The units that we measure, before the tariff rounds them. Only a Leg has it: a Data Session gives the same value as bytes. A Leg that passes the call on stays bridged to the end of the Call, and we measure that time too.
The unit of quantity and used_quantity: seconds for a Leg, kib for a Data Session.
What the tariff rates the use as. A Leg to one of your extensions has none.
object
The entry that the tariff matches: a prefix of the dialled number, such as 447968, or a data zone, such as MXGDATAZ1GBR.
The name of that entry in the tariff, such as UK - Mobile - T-Mobile or Mobile Data (UK). It says why the price is what it is.
The country of that entry, as an ISO 3166-1 alpha-3 code, such as GBR. For a Leg, it is the country of the dialled number, not of the caller.
Example
[ { "charge": { "unit": "seconds" } }]Headers
Section titled “Headers”Only when the window has more Data Sessions than one answer holds. It gives the request for the next ones, as <?from=...&to=...>; rel="next".
The request is not valid
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}The API key is missing or not valid, or: This request is not permitted
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}The request is too large
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}Too many requests, or: The daily quota is used up
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}The request failed
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}Your records are not available now
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}The request took too long
An error, as RFC 9457 Problem Details.
object
A URI that names the kind of error. It is also a page of the docs.
A short summary of the kind of error.
The HTTP status.
What went wrong in this request.
Each parameter that is not valid. Only an invalid-request error has it.
object
The parameter that is not valid.
Why it is not valid.
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "errors": [ { "field": "example", "detail": "example" } ]}