Pagination
All list endpoints in the Temps API support pagination. By default, results are limited to 20 items per page with a maximum of 100. Use the page and page_size query parameters to navigate through results.
Page-Based Pagination
The Temps API uses page-based pagination. Every list endpoint accepts page and page_size parameters and returns a total count so you can calculate the total number of pages.
Parameters
- Name
page- Type
- integer
- Description
The page number to retrieve (1-indexed). Defaults to
1.
- Name
page_size- Type
- integer
- Description
The number of items per page. Defaults to
20, maximum100.
Response Metadata
- Name
total- Type
- integer
- Description
The total number of items across all pages.
- Name
page- Type
- integer
- Description
The current page number.
- Name
page_size- Type
- integer
- Description
The number of items per page.
- Name
data- Type
- array
- Description
The array of items for the current page.
Paginated request
curl -G https://your-temps-instance.com/api/projects \
-H "Authorization: Bearer tk_your_api_key" \
-d page=2 \
-d page_size=10
Paginated response
{
"data": [
{
"id": 11,
"name": "my-app",
"slug": "my-app"
},
{
"id": 12,
"name": "api-service",
"slug": "api-service"
}
],
"total": 25,
"page": 2,
"page_size": 10
}
Sorting
List endpoints return results sorted by created_at in descending order by default (newest first). Some endpoints support additional sorting options via a sort parameter.
Cursor-Based Pagination
Some endpoints that return large datasets (such as blob storage listing and log search) use cursor-based pagination for better performance.
Parameters
- Name
cursor- Type
- string
- Description
An opaque continuation token from the previous response. Omit for the first request.
- Name
limit- Type
- integer
- Description
Maximum number of items to return (varies by endpoint).
For cursor-based endpoints, keep requesting with the returned next_cursor value until it is null.
Cursor-based response
{
"blobs": [
{
"pathname": "images/logo.png",
"size": 15234,
"content_type": "image/png"
}
],
"next_cursor": "eyJrZXkiOiJpbWFnZXMvbG9nby5wbmcifQ==",
"has_more": true
}
SDK Usage
When using the official SDKs, pagination is handled through the API parameters:
Node SDK
import { TempsClient } from '@temps-sdk/node-sdk';
const client = new TempsClient({
baseUrl: 'https://your-temps-instance.com',
apiKey: 'your-api-key'
});
// Fetch page 1 of projects
const result = await client.projects.list({
query: { page: 1, page_size: 20 }
});
console.log(`Showing ${result.data.length} of ${result.total} projects`);