Skip to main content
Every response from the Struct API is wrapped in a standard envelope. This structure is consistent across all endpoints, regardless of the data being returned.

Envelope Structure

{
  "success": true,
  "data": { ... },
  "message": null,
  "info": {
    "version": "1.0.0",
    "credits_consumed": 1
  },
  "pagination": {
    "has_more": true,
    "pagination_key": "abc123"
  }
}
The pagination field is optional and only appears on list endpoints.

Fields

success

A boolean indicating whether the request was processed successfully.

data

The response payload. Its type depends on the endpoint — it can be a single object or an array.

message

A human-readable status message. Typically null on success. On errors, this contains a description of what went wrong.

info

Metadata about the request execution. Present on most successful responses.
FieldTypeDescription
versionstringAPI version that served the request
time_taken_msnumberTotal wall-clock time in milliseconds
credits_consumednumberNumber of API credits consumed by the request
compute_time_msnumberServer-side compute time in milliseconds

pagination

Included on list endpoints that support cursor-based pagination.
FieldTypeDescription
has_morebooleanWhether additional pages of results exist
pagination_keystring | number | nullPass this value as a query parameter to fetch the next page

Pagination

List endpoints return paginated results. To iterate through all pages, pass the pagination_key from the previous response as a query parameter in your next request.
curl "https://api.struct.to/v1/markets?pagination_key=abc123" \
  -H "X-API-Key: YOUR_API_KEY"

Error Responses

When a request fails, the envelope still applies. The success field will be false and message will describe the error.
{
  "success": false,
  "data": null,
  "message": "Invalid API key"
}
Last modified on March 18, 2026