Skip to main content
Every list endpoint in the Terminus Hub Public API returns the same pagination envelope, every error uses the same error object, and each API key has its own rate limit. Learn these three patterns once and handle them the same way across your 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, up to 10000. Defaults to 100 if not specified.

Example Paginated Request

The following request fetches the second page of workspaces, 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. Each item has the same shape as the endpoint’s single-item response. See each endpoint’s page for its schema and example.
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 the same for every error type, so one error-handling function covers your whole integration. The one exception is a request with a missing or malformed Authorization header, described in Authentication errors.

Error Envelope

Error Response Fields

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

Error Types Reference

The specification’s list of error types also includes plan_limit_exceeded, account_locked, and conflict_error. Those apply to requests that change data, so the read-only Public API endpoints do not return them.
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 shows a simple error-handling pattern in JavaScript:

Rate limiting

Requests are rate limited per API key. Each key may make up to 100 requests per minute. Requests with no Authorization header are limited to 20 per minute per IP address. When you exceed the limit, the API responds with 429 and a rate_limit_error:
Every API-key response, successful or not, carries the X-RateLimit-* headers, so you can slow down before you hit the limit. A 429 adds Retry-After. Respect Retry-After and use exponential back-off for resilient integrations.