Skip to main content
Every list endpoint in the Terminus Hub Public API returns results using a consistent pagination envelope, and every error (regardless of the endpoint or failure reason) uses the same error object structure. Learning these two patterns once means you can handle them uniformly across your entire integration.

Pagination

All list endpoints (GET /api/v1/workspaces, GET /api/v1/records, etc.) return a shared response envelope containing the page of results, a flag indicating whether more pages exist, and the total count of matching resources.

Query Parameters

Control pagination by passing the following query parameters on any list request:
integer
default:"1"
The page number to retrieve. Pages are 1-indexed. The first page is page=1. Omit this parameter to start from the beginning.
integer
default:"100"
The number of items to return per page. Must be between 1 and 10000 (inclusive). Defaults to 100 if not specified.

Example Paginated Request

The following request fetches the second page of records, with 50 results per page:

Pagination Response Envelope

Every list response wraps results in the same top-level envelope:
array
required
The array of resource objects for the current page. The shape of each item depends on the endpoint (Workspace, Record, Submission, etc.).
boolean
required
true when there are additional pages beyond the current one. When false, the current page is the last page of results.
integer
required
The total number of resources matching the request’s filters, across all pages, not just the current page. Use this to calculate the total number of pages: ceil(total_count / limit).
To retrieve all results programmatically, increment page by 1 on each request and stop when has_more is false. Larger pages mean fewer requests; the maximum limit is 10000.

Errors

When a request fails, the API returns an appropriate HTTP status code and a JSON body containing a single error object. The structure is identical regardless of the error type, making it easy to write a single error-handling function for your entire integration.

Error Envelope

Error Response Fields

object
required
The top-level error container. All error details are nested inside this object.

Error Types Reference

Your integration should always check the HTTP status code first, then inspect error.type for branching logic, and error.code for fine-grained handling. Do not rely solely on error.message, as message text may change between API versions.

Handling Errors: Example

The snippet below demonstrates a simple, robust error-handling pattern in JavaScript:

Rate limiting

Requests are rate limited per API key. Each key may make up to 100 requests per minute. (Unauthenticated requests are limited to 20 per minute per IP.) When you exceed the limit, the API responds with 429 and a rate_limit_error:
Every 429 includes headers to help you back off: Respect Retry-After and implement exponential back-off for resilient integrations.