Skip to content

List Data Sessions

GET
/v1/data-sessions
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>'
from
required
string format: date-time

The list has the Data Sessions at this time or later.

to
required
string format: date-time

The list has the Data Sessions before this time. It is 31 days after from at most.

extension
string
>= 1 characters

Only the Data Sessions of the SIM with this extension.

account
string
>= 1 characters

Only the Data Sessions of the SIM of this account, for a SIM with no extension.

roaming
string
Allowed values: true false

true: only the Data Sessions abroad. false: only those at home. With no roaming, the list has both.

OK

Media typeapplication/json
Array<object>

The mobile data that one of your SIMs used in about one hour. It is a reading, not a connection.

object
id
required

The ID of the Data Session.

string
sim
required

The SIM that used the data: its extension, or its account when it has no extension.

object
extension

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.

string
number

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.

string
account

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.

string
at
required

When the network read the use. A Data Session has one time, and no start or end.

string format: date-time
bytes
required

The data that the SIM used, in bytes, in both directions.

integer
country

The country where the SIM used the data, as an ISO 3166-1 alpha-3 code, such as GBR.

string
charge

What we charge for the data. A Data Session has none when its record has no amount.

object
amount
required

The money that we charge. 0 when the tariff rates the use at no cost.

number
currency
required

The currency of amount, as an ISO 4217 code, such as GBP.

string
quantity

The units that we bill, after the tariff rounds them. For data, the tariff rounds up to the next 20 KiB.

integer
used_quantity

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.

integer
unit
required

The unit of quantity and used_quantity: seconds for a Leg, kib for a Data Session.

string
Allowed values: seconds kib
destination

What the tariff rates the use as. A Leg to one of your extensions has none.

object
prefix
required

The entry that the tariff matches: a prefix of the dialled number, such as 447968, or a data zone, such as MXGDATAZ1GBR.

string
description
required

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.

string
country

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.

string
Example
[
{
"charge": {
"unit": "seconds"
}
}
]
Link
string

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

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
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

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}

The request is too large

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}

Too many requests, or: The daily quota is used up

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}

The request failed

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}

Your records are not available now

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}

The request took too long

Media typeapplication/problem+json

An error, as RFC 9457 Problem Details.

object
type
required

A URI that names the kind of error. It is also a page of the docs.

string
title
required

A short summary of the kind of error.

string
status
required

The HTTP status.

integer
detail

What went wrong in this request.

string
errors

Each parameter that is not valid. Only an invalid-request error has it.

Array<object>
object
field
required

The parameter that is not valid.

string
detail
required

Why it is not valid.

string
Examplegenerated
{
"type": "example",
"title": "example",
"status": 1,
"detail": "example",
"errors": [
{
"field": "example",
"detail": "example"
}
]
}