> ## Documentation Index
> Fetch the complete documentation index at: https://docs.struct.to/llms.txt
> Use this file to discover all available pages before exploring further.

# Response Format

> Understand how all API responses are structured.

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

```json theme={null}
{
  "success": true,
  "data": { ... },
  "message": null,
  "info": {
    "version": "1.0.0",
    "credits_consumed": 1
  },
  "pagination": {
    "has_more": true,
    "pagination_key": "abc123"
  }
}
```

<Note>The `pagination` field is optional and only appears on list endpoints.</Note>

## 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           |
| `credits_consumed` | `number` | Number of API credits consumed by the request |

### `pagination`

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 |

## 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. Some endpoints also accept an `offset` parameter for deep-linkable server-rendered pages.

See [Pagination](/api-reference/pagination) for the full walkthrough and when to use each strategy.

## Error Responses

When a request fails, the envelope still applies. The `success` field will be `false` and `message` will describe the error.

```json theme={null}
{
  "success": false,
  "data": null,
  "message": "Invalid API key"
}
```
