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

# Capture a screenshot with options (format, quality, region)

> Screenshot as base64-encoded image

### Path parameters

<ParamField path="id" type="string (uuid)" required>
  Sandbox identifier
</ParamField>

### Request body

`ScreenshotRequest`

<ParamField body="format" type="string" required />

<ParamField body="quality" type="integer" />

<ParamField body="region" type="object" />

### Response

`object`

<ResponseField name="image" type="string (byte)" required>
  Base64-encoded image data
</ResponseField>

<ResponseField name="format" type="string" required />

### Status codes

| Code  | Meaning                            |
| ----- | ---------------------------------- |
| `200` | Screenshot as base64-encoded image |
| `400` | Invalid request                    |
| `404` | Sandbox not found                  |
| `500` | Screenshot capture failed          |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.sandbox.stateset.app/api/v1/sandbox/{id}/screenshot' \
    --header "Authorization: Bearer $STATESET_SANDBOX_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "format": "png",
    "quality": 85,
    "region": {
      "x": 1,
      "y": 1,
      "width": 1,
      "height": 1
    }
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "image": "aGVsbG8=",
    "format": "png"
  }
  ```
</ResponseExample>
