# Estimate the cost of a job

Checks a job like POST /v2/jobs and returns what it would cost: credits per task, in total and as a price, and whether it still fits into today's free quota. Nothing is created or charged. Works with sandbox keys too.

`POST https://api.switchfile.io/v2/jobs/estimate`

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

## Example

cURL:

```bash
curl "https://api.switchfile.io/v2/jobs/estimate" \
  -H "Authorization: Bearer $SWITCHFILE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "tasks": {
      "import-1": {
        "operation": "import/url",
        "url": "https://example.com/report.pdf"
      },
      "thumb-1": {
        "operation": "thumbnail",
        "input": "import-1",
        "input_format": "pdf",
        "output_format": "png",
        "width": 300
      },
      "optimize-1": {
        "operation": "optimize",
        "input": "import-1",
        "profile": "web"
      }
    }
  }'
```

Node.js:

```js
const res = await fetch("https://api.switchfile.io/v2/jobs/estimate", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.SWITCHFILE_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    tasks: {
      "import-1": {
        operation: "import/url",
        url: "https://example.com/report.pdf"
      },
      "thumb-1": {
        operation: "thumbnail",
        input: "import-1",
        input_format: "pdf",
        output_format: "png",
        width: 300
      },
      "optimize-1": {
        operation: "optimize",
        input: "import-1",
        profile: "web"
      }
    }
  }),
});
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/v2/jobs/estimate');
curl_setopt_array($ch, [
    CURLOPT_POST => true,
    CURLOPT_POSTFIELDS => json_encode([
        'tasks' => [
            'import-1' => [
                'operation' => 'import/url',
                'url' => 'https://example.com/report.pdf',
            ],
            'thumb-1' => [
                'operation' => 'thumbnail',
                'input' => 'import-1',
                'input_format' => 'pdf',
                'output_format' => 'png',
                'width' => 300,
            ],
            'optimize-1' => [
                'operation' => 'optimize',
                'input' => 'import-1',
                'profile' => 'web',
            ],
        ],
    ]),
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer ' . getenv('SWITCHFILE_API_KEY'),
        'Content-Type: application/json',
    ],
    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.post(
    "https://api.switchfile.io/v2/jobs/estimate",
    headers={"Authorization": f"Bearer {os.environ['SWITCHFILE_API_KEY']}"},
    json={
        "tasks": {
            "import-1": {
                "operation": "import/url",
                "url": "https://example.com/report.pdf",
            },
            "thumb-1": {
                "operation": "thumbnail",
                "input": "import-1",
                "input_format": "pdf",
                "output_format": "png",
                "width": 300,
            },
            "optimize-1": {
                "operation": "optimize",
                "input": "import-1",
                "profile": "web",
            },
        },
    },
)
res.raise_for_status()
print(res.json())
```

## Request body

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `redirect` | boolean | no | Sync requests only: redirect to the URL of the first exported file |
| `store` | boolean | no | false: convert without storing the input or the result (POST /sync/v2/jobs only, exactly import/base64, convert and export/url). The export task returns the files as base64 in content; with redirect true the response is the file itself. The job is not kept. With only this field the usual 16 MB request limit applies; send the header Switchfile-Store: false for files up to 50 MB |
| `tag` | string \| null | no | (at most 255 characters) |
| `tasks` | map of ImportUrlTask \| ImportUploadTask \| ImportBase64Task \| ConvertTask \| AccessibilityCheckTask \| CaptureWebsiteTask \| MergeTask \| SplitPagesTask \| ExtractPagesTask \| RotatePagesTask \| EncryptTask \| DecryptTask \| ThumbnailTask \| OptimizeTask \| ExportUrlTask \| ImportS3Task \| ExportS3Task \| ExportUploadTask | yes | The tasks of the job. Each key is the task name (1 to 200 entries; keys match ^[A-Za-z0-9_-]{1,100}$) |
| `webhook_url` | string \| null | no | (at most 4096 characters; matches ^https?://) |

### ImportUrlTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | (1 to 255 characters) |
| `headers` | map of string | no | (keys match ^(.*)$) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `operation` | string | yes | (one of "import/url") |
| `url` | string | yes | (at most 4096 characters; matches ^https?://) |

### ImportUploadTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `operation` | string | yes | (one of "import/upload") |

### ImportBase64Task

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `file` | string | yes | File content as base64, at most 10 MiB after decoding (50 MB with store false, see CreateJob) (1 to 69905324 characters) |
| `filename` | string | yes | (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `operation` | string | yes | (one of "import/base64") |

### ConvertTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `engine` | string | no | Use only this engine (value as in GET /v2/convert/formats). Internal identifier, may change; usually left out |
| `engine_version` | string | no | Accepted and ignored. Internal identifier, may change; usually left out |
| `filename` | string | no | (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `input_format` | string | no | File format, for example pdf or tar.gz (1 to 20 characters) |
| `operation` | string | yes | (one of "convert") |
| `output_format` | string | yes | File format, for example pdf or tar.gz (1 to 20 characters) |
| `timeout` | number | no | Time limit for this task in seconds. With a limit shorter than the default, an incomplete result counts like a complete one (greater than 0) |

### AccessibilityCheckTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the PDF. Exactly one file (at least 1 characters) |
| `operation` | string | yes | (one of "accessibility/check") |
| `profile` | string | no | PDF/UA part to check against. auto picks it from the file and falls back to PDF/UA-1 (one of "auto", "ua1", "ua2") |
| `report_pdf` | string | no | Also store the report as an accessible PDF in this language (report.pdf) (one of "en") |

### CaptureWebsiteTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `close_cookie_banners` | boolean | no | Only false is accepted: cookie banners are not closed automatically |
| `cookies` | object[] | no | Cookies for the host of url only, for example a login session. Stored encrypted, shown as [redacted] (at most 50 items) |
| `cookies[].domain` | string | no | The host of url (default) or one of its parent domains |
| `cookies[].name` | string | yes | (1 to 256 characters) |
| `cookies[].path` | string | no | Default / |
| `cookies[].value` | string | yes | (at most 4096 characters) |
| `css_media_type` | string | no | print (default) uses the print styles of the page, screen the screen styles. Only for output_format pdf. (one of "print", "screen") |
| `device` | string | no | desktop (default) or mobile: phone screen width, touch and the user agent of a phone browser (one of "desktop", "mobile") |
| `device_scale_factor` | string (integer) \| integer | no | Pixels per CSS pixel, 1 to 3 (default 2). Only for output_format png, jpg and webp. (1 to 3) |
| `display_header_footer` | boolean | no | Add a header with date and title and a footer with address and page numbers (default false). Only for output_format pdf. |
| `engine` | string | no | Internal identifier, may change; leave it out |
| `filename` | string | no | File name of the result; the extension is added if missing (1 to 255 characters) |
| `fit` | string | no | Resizing with width and height: max (fit inside, never enlarge; default), crop (fill and cut) or scale (stretch). Only for output_format png, jpg and webp. (one of "max", "crop", "scale") |
| `footer_template` | string | no | HTML of the footer on every page, like header_template; without header_template the header stays empty. Only for output_format pdf. (at most 20480 characters) |
| `header_template` | string | no | HTML of the header on every page, at most 20 KB. Elements with the classes date, title, url, pageNumber and totalPages get these values. Scripts do not run and only data URLs load as images. Turns on display_header_footer; without footer_template the footer stays empty. Only for output_format pdf. (at most 20480 characters) |
| `headers` | map of string | no | Extra request headers, for example Authorization. They are sent with every request of the page, also to other sites it loads; a Cookie header is sent to the host of url only. Stored encrypted, shown as [redacted] (at most 30 entries; keys match ^(.*)$) |
| `height` | string (integer) \| integer | no | Height of the image in pixels; the capture is resized. Only for output_format png, jpg and webp. (1 to 20000) |
| `html` | string | no | An HTML document to capture instead of a web page, at most 1 MB; larger files through input. Use absolute URLs for images and styles, or data URLs (1 to 1048576 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | no | Name of a task whose result is an HTML file (.html, .htm, at most 5 MB) to capture instead of url |
| `margin_bottom` | number | no | Bottom margin in mm. Only for output_format pdf. (0 to 100) |
| `margin_left` | number | no | Left margin in mm. Only for output_format pdf. (0 to 100) |
| `margin_right` | number | no | Right margin in mm. Only for output_format pdf. (0 to 100) |
| `margin_top` | number | no | Top margin in mm. Only for output_format pdf. (0 to 100) |
| `operation` | string | yes | (one of "capture-website") |
| `output_format` | string | yes | Format of the result. A pdf keeps the text selectable; png, jpg and webp give one image (one of "pdf", "png", "jpg", "webp") |
| `page_format` | string | no | Paper size; wins over page_width and page_height. Only for output_format pdf. (one of "letter", "legal", "tabloid", "ledger", "a0", "a1", "a2", "a3", "a4", "a5", "a6") |
| `page_height` | number | no | Page height in cm. Only for output_format pdf. (2 to 250) |
| `page_orientation` | string | no | portrait (default) or landscape. Only for output_format pdf. (one of "portrait", "landscape") |
| `page_width` | number | no | Page width in cm. Only for output_format pdf. (2 to 250) |
| `pages` | string | no | Page range like 1-3 or list like 1,2,5 (pages 1 to 200). Only for output_format pdf. (at most 400 characters) |
| `print_background` | boolean | no | Print background colors and images (default true). Only for output_format pdf. |
| `quality` | string (integer) \| integer | no | Image quality, 1 to 100 (default 80). Only for output_format jpg and webp. (1 to 100) |
| `screen_height` | string (integer) \| integer | no | Height of the browser window in CSS pixels. Without it the whole page is captured, at most 20000 pixels high. Only for output_format png, jpg and webp. (200 to 20000) |
| `screen_width` | string (integer) \| integer | no | Width of the browser window in CSS pixels (desktop 1440, mobile 390). Only for output_format png, jpg and webp. (320 to 3840) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |
| `transparent_background` | boolean | no | Transparent instead of white background (default false). Only for output_format png and webp. |
| `url` | string | no | Address of the public web page (http or https, ports 80 and 443). Use url, html or input (at most 4096 characters; matches ^https?://) |
| `wait_for_element` | string | no | CSS selector of an element to wait for, within the 30 seconds (1 to 500 characters) |
| `wait_time` | string (integer) \| integer | no | Extra milliseconds to wait after loading, at most 10000 (0 to 10000) |
| `wait_until` | string | no | When the page counts as loaded: load (default), domcontentloaded, networkidle0 (no network connections for 500 ms) or networkidle2 (at most 2 connections for 500 ms). Loading may take at most 30 seconds (one of "load", "domcontentloaded", "networkidle0", "networkidle2") |
| `width` | string (integer) \| integer | no | Width of the image in pixels; the capture is resized. Only for output_format png, jpg and webp. (1 to 10000) |
| `zoom` | number | no | Zoom factor of the page, 0.1 to 2 (default 1). Only for output_format pdf. (0.1 to 2) |

### MergeTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "merge") |
| `output_format` | string | no | Always pdf (one of "pdf") |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### SplitPagesTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "pdf/split-pages") |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### ExtractPagesTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "pdf/extract-pages") |
| `pages` | string | yes | The pages to keep. Pages like 1-3, a list like 1,3,5 or 8- (page 8 to the end) (1 to 400 characters) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### RotatePagesTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "pdf/rotate-pages") |
| `pages` | string | no | The pages to rotate; all pages if left out. Pages like 1-3, a list like 1,3,5 or 8- (page 8 to the end) (1 to 400 characters) |
| `rotation` | string \| string (integer) \| integer | yes | Clockwise angle: +90, +180 or -90 (90, 180 and 270 work too) (matches ^[+-]?(90\|180\|270)$) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### EncryptTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `allow_accessibility` | boolean | no | Accepted; screen readers can always read files protected with AES-256 |
| `allow_extract` | boolean | no | Allow copying text and images. Default: true |
| `allow_modify` | string | no | all, annotate, form, assembly or none. Default: all (one of "all", "annotate", "form", "assembly", "none") |
| `allow_print` | string | no | full, low (low resolution only) or none. Default: allowed (one of "full", "low", "none") |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "pdf/encrypt") |
| `set_owner_password` | string | no | Password needed to change the permissions. Without it a random one is set, so nobody can lift the restrictions (4 to 127 characters) |
| `set_password` | string | no | Password needed to open the file (4 to 127 characters) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### DecryptTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "pdf/decrypt") |
| `password` | string | no | Password that opens the file (user or owner password) (1 to 127 characters) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### ThumbnailTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `auto_orient` | boolean | no | Images: turn upright from the camera orientation. Default true |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `fit` | string | no | max (fit inside width and height; default), crop (fill and cut from the center; smartcrop works the same) or scale (stretch) (one of "max", "crop", "smartcrop", "scale") |
| `height` | string (integer) \| integer | no | Height in pixels (1 to 10000) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `input_format` | string | no | File format, for example pdf or tar.gz (1 to 20 characters) |
| `operation` | string | yes | (one of "thumbnail") |
| `output_format` | string | yes | (one of "png", "jpg", "jpeg", "webp") |
| `page` | string (integer) \| integer | no | Page of a PDF or document, default 1 (at least 1) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |
| `width` | string (integer) \| integer | no | Width in pixels (1 to 10000) |

### OptimizeTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `filename` | string | no | File name of the result when there is exactly one (1 to 255 characters) |
| `flatten_signatures` | boolean | no | Accepted, no effect: signatures stay in the file but become invalid when a PDF is rewritten |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `input_format` | string | no | File format, for example pdf or tar.gz (1 to 20 characters) |
| `operation` | string | yes | (one of "optimize") |
| `profile` | string | no | web (default; PDFs also load page by page in the browser), print and archive (higher image quality), max and mrc (smallest images). For PDFs only web differs (one of "web", "print", "archive", "mrc", "max") |
| `quality` | string (integer) \| integer | no | Images: quality from 1 to 100; overrides the profile (1 to 100) |
| `timeout` | number | no | Time limit for this task in seconds (greater than 0) |

### ExportUrlTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `archive_multiple_files` | boolean | no |  |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `inline` | boolean | no |  |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "export/url") |

### ImportS3Task

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `access_key_id` | string | yes | (1 to 256 characters) |
| `bucket` | string | yes | (matches ^[A-Za-z0-9._-]{1,255}$) |
| `endpoint` | string | no | https endpoint of an S3-compatible storage; without it AWS (at most 2048 characters; matches ^https?://) |
| `filename` | string | no | (1 to 255 characters) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `key` | string | no | (1 to 1024 characters) |
| `key_prefix` | string | no | Instead of key: all objects under it (1 to 1024 characters) |
| `operation` | string | yes | (one of "import/s3") |
| `region` | string | no | Required without endpoint. R2: auto (matches ^[A-Za-z0-9-]{1,50}$) |
| `secret_access_key` | string | yes | (1 to 512 characters) |
| `session_token` | string | no | (1 to 4096 characters) |

### ExportS3Task

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `access_key_id` | string | yes | (1 to 256 characters) |
| `acl` | string | no | Canned ACL such as public-read; not sent when left out (one of "private", "public-read", "public-read-write", "authenticated-read", "bucket-owner-read", "bucket-owner-full-control") |
| `bucket` | string | yes | (matches ^[A-Za-z0-9._-]{1,255}$) |
| `cache_control` | string | no | (at most 1024 characters; matches ^[^\r\n]*$) |
| `content_disposition` | string | no | (at most 1024 characters; matches ^[^\r\n]*$) |
| `content_type` | string | no | (at most 255 characters; matches ^[^\r\n]*$) |
| `endpoint` | string | no | https endpoint of an S3-compatible storage; without it AWS (at most 2048 characters; matches ^https?://) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `key` | string | no | Only for one file (1 to 1024 characters) |
| `key_prefix` | string | no | (1 to 1024 characters) |
| `metadata` | map of string | no | (at most 50 entries; keys match ^[A-Za-z0-9_-]{1,128}$) |
| `operation` | string | yes | (one of "export/s3") |
| `region` | string | no | Required without endpoint. R2: auto (matches ^[A-Za-z0-9-]{1,50}$) |
| `secret_access_key` | string | yes | (1 to 512 characters) |
| `server_side_encryption` | string | no | (one of "AES256", "aws:kms") |
| `session_token` | string | no | (1 to 4096 characters) |
| `tagging` | map of string | no | (at most 10 entries; keys match ^(.*)$) |

### ExportUploadTask

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `headers` | map of string | no | (at most 50 entries; keys match ^[A-Za-z0-9!#$%&'*+.^_`\|~-]{1,128}$) |
| `ignore_error` | boolean | no | If true, the job does not fail when this task fails |
| `input` | string \| string[] | yes | Name of the task that provides the input, or a list of names (at least 1 characters) |
| `operation` | string | yes | (one of "export/upload") |
| `url` | string | yes | https URL for the PUT request, stored like credentials (at most 8192 characters; matches ^https?://) |

## Responses

### 200: OK

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `credits` | object | yes |  |
| `credits.max` | string (integer) \| integer | yes | The most it can cost: one credit per started minute of the time limit. null when the number of files is only known while the job runs, for example after pdf/split-pages |
| `credits.min` | string (integer) \| integer | yes | Minimum credits |
| `free` | boolean | yes | Whether the job still fits into today's free quota; false when the cost is open (max null). Always true with a sandbox key |
| `object` | string | yes | (one of "estimate") |
| `price` | object | yes | Price at the package price per credit |
| `price.currency` | string | yes | (one of "EUR") |
| `price.max` | number \| null | yes |  |
| `price.min` | number | yes |  |
| `tasks` | map of object | yes | Credits per task that uses credits (convert, thumbnail, optimize, merge, pdf/… and others) (keys match ^(.*)$) |
| `tasks.<key>.credits` | object | yes |  |
| `tasks.<key>.credits.max` | string (integer) \| integer | yes | The most it can cost: one credit per started minute of the time limit. null when the number of files is only known while the job runs, for example after pdf/split-pages |
| `tasks.<key>.credits.min` | string (integer) \| integer | yes | Minimum credits |
| `tasks.<key>.operation` | string | yes |  |

Example (application/json):

```json
{
  "object": "estimate",
  "tasks": {
    "thumb-1": {
      "operation": "thumbnail",
      "credits": {
        "min": 1,
        "max": 6
      }
    },
    "optimize-1": {
      "operation": "optimize",
      "credits": {
        "min": 1,
        "max": 6
      }
    }
  },
  "credits": {
    "min": 2,
    "max": 12
  },
  "price": {
    "currency": "EUR",
    "min": 0.02,
    "max": 0.12
  },
  "free": true
}
```

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

Example (application/json):

```json
{
  "message": "Missing or invalid API key. Send it as Authorization: Bearer <key>. No key yet? Follow get_a_key.",
  "code": "UNAUTHENTICATED",
  "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"
  }
}
```

### 404: Does not exist for this account

### 411: The request has a body but no Content-Length header

### 413: The request or the file is too large

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

Example (application/json):

```json
{
  "message": "Task convert-1: The output format field is required.",
  "code": "INVALID_DATA",
  "errors": {
    "tasks.convert-1.output_format": [
      "The output format field is required."
    ]
  }
}
```

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

Example (application/json):

```json
{
  "message": "Too many requests. Try again in 12 seconds.",
  "code": "RATE_LIMIT_EXCEEDED"
}
```

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