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

# Response Format

> Understanding API response structure and metadata

All API responses follow a consistent JSON structure.

## Success Response

```json theme={null}
{
  "success": true,
  "error": null,
  "data": {
    "uuid": "abc123-def456-ghi789",
    "fileUrl": "https://cdn.snapopa.com/abc123-def456-ghi789.png",
    "fromCache": false,
    "tokenCost": 1,
    "fileSizeBytes": 245678,
    "processingTimeMs": 1234,
    "metadata": {
      "mimeType": "image/png",
      "width": 1920,
      "height": 1080,
      "createdAt": 1703001234
    }
  }
}
```

## Response Fields

| Field     | Type        | Description                   |
| --------- | ----------- | ----------------------------- |
| `success` | boolean     | Whether the request succeeded |
| `error`   | object/null | Error details if failed       |
| `data`    | object/null | Response data if successful   |

## Data Object

| Field              | Type    | Description               |
| ------------------ | ------- | ------------------------- |
| `uuid`             | string  | Unique capture identifier |
| `fileUrl`          | string  | CDN URL to the capture    |
| `fromCache`        | boolean | Whether served from cache |
| `tokenCost`        | number  | Credits consumed          |
| `fileSizeBytes`    | number  | File size in bytes        |
| `processingTimeMs` | number  | Processing time in ms     |
| `metadata`         | object  | Capture metadata          |

## Metadata Object

| Field       | Type   | Description              |
| ----------- | ------ | ------------------------ |
| `mimeType`  | string | File MIME type           |
| `width`     | number | Image width in pixels    |
| `height`    | number | Image height in pixels   |
| `createdAt` | number | Unix timestamp (seconds) |

## Binary Response

When using `responseType: "file"`, the response is the raw file:

```bash theme={null}
curl -X POST https://api.snapopa.com/capture \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com", "responseType": "file"}' \
  -o screenshot.png
```

Response headers include:

* `Content-Type`: `image/png`, `image/jpeg`, `image/webp`, or `application/pdf`
* `Content-Length`: File size in bytes
* `X-Capture-UUID`: Capture identifier

## Error Response

```json theme={null}
{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid URL format"
  },
  "data": null
}
```

<Note>
  See [Error Handling](/responses/errors) for complete error codes.
</Note>

## HTTP Status Codes

| Status | Meaning                           |
| ------ | --------------------------------- |
| 200    | Success                           |
| 400    | Bad Request (validation error)    |
| 401    | Unauthorized (invalid API key)    |
| 402    | Payment Required (quota exceeded) |
| 429    | Too Many Requests (rate limited)  |
| 500    | Internal Server Error             |
