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.
| Field | Type | Description |
|---|
version | string | API version that served the request |
time_taken_ms | number | Total wall-clock time in milliseconds |
credits_consumed | number | Number of API credits consumed by the request |
compute_time_ms | number | Server-side compute time in milliseconds |
Included on list endpoints that support cursor-based pagination.
| Field | Type | Description |
|---|
has_more | boolean | Whether additional pages of results exist |
pagination_key | string | number | null | Pass this value as a query parameter to fetch the next page |
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"
}