Pagination
Most List
endpoints support offset pagination to allow bulk fetching multiple items. Each List
endpoint shares a common response structure. Examples of these requests can be seen in List Applications and List Tokens.
The List Logs endpoint supports cursor pagination.
Offset Pagination
Request
- cURL
- JavaScript
- C#
- Python
- Go
curl "https://api.basistheory.com/applications?page=2&size=10" \
-H "BT-API-KEY: <API_KEY>"
import {BasisTheory} from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const applications = await bt.applications.list({
page: 2,
size: 10,
});
using BasisTheory.net.Applications;
var client = new ApplicationClient("<MANAGEMENT_API_KEY>");
var applications = await client.GetAsync(new ApplicationGetRequest {
Page = 2,
PageSize = 10
});
import basistheory
from basistheory.api import applications_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
applications_client = applications_api.ApplicationsApi(api_client)
applications = applications_client.get(page=2, size=10)
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
applications, httpResponse, err := apiClient.ApplicationsApi.Get(contextWithAPIKey).Page(2).Size(10).Execute()
}
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
page | false | integer | 1 | Page number of the results to return. |
size | false | integer | 20 | Number of results per page to return. Maximum size of 100 results. |
Response
{
"pagination": {
"total_items": 924,
"page_number": 2,
"page_size": 10,
"total_pages": 93
},
"data": [
{...},
{...},
{...}
]
}
Offset Pagination Object
Attribute | Type | Description |
---|---|---|
pagination | offset pagination metadata | Pagination metadata for the response |
data | array | Query results of the request. See list endpoint resource for response schema definition |
Offset Pagination Metadata Object
Attribute | Type | Description |
---|---|---|
total_items | integer | Total number of items in the Tenant |
page_number | integer | Current page number. Should match page query parameter. |
page_size | integer | The size of each page. Should match size query parameter. |
total_pages | integer | The total number of pages. |
Cursor Pagination
Request
- cURL
- JavaScript
- C#
- Python
- Go
curl "https://api.basistheory.com/logs?start=AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD&size=10" \
-H "BT-API-KEY: <API_KEY>"
import {BasisTheory} from "@basis-theory/basis-theory-js";
const bt = await new BasisTheory().init("<MANAGEMENT_API_KEY>");
const logs = await bt.logs.list({
start: 'AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD',
size: 10,
});
using BasisTheory.net.Logs;
var client = new LogClient("<MANAGEMENT_API_KEY>");
var logs = await client.GetAsync(new GetLogsRequest {
Start = "AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD",
PageSize = 10
});
import basistheory
from basistheory.api import logs_api
with basistheory.ApiClient(configuration=basistheory.Configuration(api_key="<MANAGEMENT_API_KEY>")) as api_client:
logs_client = logs_api.LogsApi(api_client)
logs = logs_client.get(start="AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD", size=10)
package main
import (
"context"
"github.com/Basis-Theory/basistheory-go/v3"
)
func main() {
configuration := basistheory.NewConfiguration()
apiClient := basistheory.NewAPIClient(configuration)
contextWithAPIKey := context.WithValue(context.Background(), basistheory.ContextAPIKeys, map[string]basistheory.APIKey{
"ApiKey": {Key: "<MANAGEMENT_API_KEY>"},
})
logs, httpResponse, err := apiClient.LogsApi.Get(contextWithAPIKey).Start("AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD").Size(10).Execute()
}
Query Parameters
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
start | false | string | null | Cursor provided in the previous query to get the next set of results. |
size | false | integer | 20 | The maximum number of results to return. Maximum size of 100 results. |
Response
{
"pagination": {
"after": "AAAAAAAAAAAAAAAABBBBBBBBBBBBBBCCCCCCCCCCDDDDDDDDDD",
"page_size": 10
},
"data": [
{...},
{...},
{...}
]
}
Cursor Pagination Object
Attribute | Type | Description |
---|---|---|
pagination | cursor pagination metadata | Pagination metadata for the response |
data | array | Query results of the request. See list endpoint resource for response schema definition |
Cursor Pagination Metadata Object
Attribute | Type | Description |
---|---|---|
after | string | Cursor to get the next set of results. |
page_size | integer | The maximum number of results returned. Should match size query parameter. |