# Show a capture

Status and result of a capture. ?wait=true (or a number of seconds, at most 30) waits until it is done.

`GET https://api.switchfile.io/v1/captures/{id}`

Needs an API key: `Authorization: Bearer YOUR_API_KEY`. See [Authentication](https://switchfile.io/docs/authentication).

## Example

cURL:

```bash
curl "https://api.switchfile.io/v1/captures/d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76?wait=true" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY"
```

Node.js:

```js
const res = await fetch("https://api.switchfile.io/v1/captures/d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76?wait=true", {
  headers: {
    Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
  },
});
if (!res.ok) throw new Error(`HTTP ${res.status}: ${await res.text()}`);
console.log(await res.json());
```

PHP:

```php
<?php
$ch = curl_init('https://api.switchfile.io/v1/captures/d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76?wait=true');
curl_setopt_array($ch, [
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('SWITCHFILE_API_KEY'),
    ],
    CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($ch);
$status = curl_getinfo($ch, CURLINFO_RESPONSE_CODE);
curl_close($ch);

if ($status >= 400) {
    throw new RuntimeException("HTTP $status: $response");
}
print_r(json_decode($response, true));
```

Python:

```python
import os
import requests

res = requests.get(
    "https://api.switchfile.io/v1/captures/d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76?wait=true",
    headers={"Authorization": f"Bearer {os.environ['SWITCHFILE_API_KEY']}"},
)
res.raise_for_status()
print(res.json())
```

## Parameters

### Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string (uuid) | yes | ID of the capture |

### Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `wait` | string \| number | no | true or a number of seconds: wait until the capture is done, at most 30 seconds (one of "true"; example: true) |

### Headers

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `X-End-User` | string | no | Service keys only: an ID for the visitor you act for (1 to 128 characters: letters, digits and . _ : @ -). Quotas and rate limits then count per visitor. |
| `X-End-User-Ip` | string | no | Required with X-End-User: the IP address of the visitor. |

## Responses

### 200: OK

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `created_at` | string | yes | ISO 8601 timestamp, for example 2026-11-06T18:00:00+00:00 |
| `credits` | string (integer) \| integer | yes | Credits used, set once the capture is done |
| `error` | object \| null | yes |  |
| `error.code` | string | yes |  |
| `error.message` | string | yes |  |
| `expires_at` | string \| null | yes | The result is deleted at this time |
| `finished_at` | string \| null | yes | ISO 8601 timestamp, for example 2026-11-06T18:00:00+00:00 |
| `id` | string (uuid) | yes |  |
| `links` | object | yes |  |
| `links.self` | string | yes |  |
| `object` | string | yes | (one of "website_capture") |
| `options` | map of any | yes | The settings as sent; headers and cookies as [redacted] (keys match ^(.*)$) |
| `output_format` | string | yes | (one of "pdf", "png", "jpg", "webp") |
| `result` | object \| null | yes |  |
| `result.file` | object | yes |  |
| `result.file.filename` | string | yes |  |
| `result.file.size` | string (integer) \| integer | yes | (at least 0) |
| `result.file.url` | string | yes | Signed download URL, valid until expires_at |
| `result.height` | string (integer) \| integer | yes | Image height in pixels (png, jpg, webp) |
| `result.notes` | string[] | yes | Notes, for example when a very tall page was cut at the height limit |
| `result.pages` | string (integer) \| integer | yes | Number of pages (pdf) |
| `result.title` | string \| null | yes | Title of the page |
| `result.width` | string (integer) \| integer | yes | Image width in pixels (png, jpg, webp) |
| `status` | string | yes | (one of "queued", "processing", "finished", "failed") |
| `url` | string \| null | yes | The address as sent; null when html was sent |

Example (application/json):

```json
{
  "id": "d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76",
  "object": "website_capture",
  "status": "finished",
  "url": "https://example.com/pricing",
  "output_format": "pdf",
  "options": {
    "page_format": "a4"
  },
  "result": {
    "file": {
      "filename": "pricing.pdf",
      "size": 184213,
      "url": "https://api.switchfile.io/files/2a6f8e1c-4b3d-4e7a-9c5f-8d1b0e2a4c67/pricing.pdf?expires=1762538401&signature=3f9c2a7d41e8b6c05d1f9e2a7b4c8d3e6f0a1b2c3d4e5f60718293a4b5c6d7e8"
    },
    "width": null,
    "height": null,
    "pages": 3,
    "title": "Pricing",
    "notes": []
  },
  "error": null,
  "credits": 1,
  "created_at": "2026-11-06T18:00:00+00:00",
  "finished_at": "2026-11-06T18:00:02+00:00",
  "expires_at": "2026-11-07T18:00:02+00:00",
  "links": {
    "self": "https://api.switchfile.io/v1/captures/d4b7e2a9-6c1f-4e83-a05d-3f9b8c2e1a76"
  }
}
```

### 401: The API key is missing or not valid (`UNAUTHENTICATED`)

Example (application/problem+json):

```json
{
  "type": "https://switchfile.io/docs/api/v1#errors-unauthenticated",
  "title": "Unauthenticated",
  "status": 401,
  "code": "UNAUTHENTICATED",
  "detail": "Missing or invalid API key. Send it as Authorization: Bearer <key>. No key yet? Follow get_a_key.",
  "get_a_key": {
    "summary": "No API key yet? Get one with two requests, without a browser.",
    "steps": [
      {
        "method": "POST",
        "url": "https://api.switchfile.io/v1/signup",
        "body": {
          "email": "you@example.com",
          "accept_terms": true
        },
        "result": "We email a code with 8 digits to the address."
      },
      {
        "method": "POST",
        "url": "https://api.switchfile.io/v1/signup/verify",
        "body": {
          "email": "you@example.com",
          "code": "12345678",
          "accept_terms": true
        },
        "result": "Your API key, shown once. Send it as Authorization: Bearer <key>."
      }
    ],
    "terms_url": "https://switchfile.io/terms",
    "privacy_url": "https://switchfile.io/privacy",
    "docs_url": "https://switchfile.io/docs/authentication#get-an-api-key-without-a-browser"
  }
}
```

### 403: Not allowed: a signed URL is wrong or expired, or X-End-User was sent without a service key (`END_USER_NOT_ALLOWED`)

Example (application/problem+json):

```json
{
  "type": "https://switchfile.io/docs/api/v1#errors-end-user-not-allowed",
  "title": "End user not allowed",
  "status": 403,
  "code": "END_USER_NOT_ALLOWED",
  "detail": "The X-End-User header is only allowed with a service key."
}
```

### 404: Does not exist for this account (`NOT_FOUND`)

Example (application/problem+json):

```json
{
  "type": "https://switchfile.io/docs/api/v1#errors-not-found",
  "title": "Not found",
  "status": 404,
  "code": "NOT_FOUND",
  "detail": "Capture not found."
}
```

### 422: Invalid data. errors names the fields (`INVALID_DATA`)

Example (application/problem+json):

```json
{
  "type": "https://switchfile.io/docs/api/v1#errors-invalid-data",
  "title": "Invalid data",
  "status": 422,
  "code": "INVALID_DATA",
  "detail": "The request contains invalid data.",
  "errors": {
    "id": [
      "Expected string to match 'uuid' format"
    ]
  }
}
```

### 429: Too many requests or a daily quota is used up. See Retry-After (`RATE_LIMIT_EXCEEDED`)

Example (application/problem+json):

```json
{
  "type": "https://switchfile.io/docs/api/v1#errors-rate-limit-exceeded",
  "title": "Rate limit exceeded",
  "status": 429,
  "code": "RATE_LIMIT_EXCEEDED",
  "detail": "Too many requests. Try again in 12 seconds."
}
```

Error bodies and codes are explained in [Errors](https://switchfile.io/docs/errors).
