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

# API reference

> The Fibre HTTP API: base URL, authentication, request and response formats, status codes, errors, safe retries, pagination and streaming. Every endpoint has its own page with a live playground.

Everything Fibre does is available through one HTTP API. The [SDKs](https://docs.fibre.dev/sdks/overview.md) are built on top of it, and
you can also call it directly from any programming language.

This page explains the rules that apply to every request. After it, **each endpoint has its own page** in this
section, listing its parameters, its request body, every possible response with its status code, and a playground
where you can send a real request with your own key.

## Base URL

```text theme={null}
https://api.fibre.dev
```

Send every request to this address. Every path starts with `/v1`.

## Authentication

Every request must include your API key, sent as a *bearer token* in the `Authorization` header:

```bash title="curl" run theme={null}
curl -sS "$FIBRE_API_URL/v1/sandboxes?limit=1" -H "Authorization: Bearer $FIBRE_API_KEY"
```

> [accordion] Response
>
> ```json title="response" expected theme={null}
> {
>   "sandboxes": "…"
> }
> ```

Keys start with `fb_live_`. You can create keys that are limited to certain actions, to one sandbox, or to a set
lifetime: see [API keys](https://docs.fibre.dev/get-started/api-keys.md). The only request that works without a key is
[`GET /v1/pricing`](https://docs.fibre.dev/api-reference/pricing/get-pricing).

## Requests and responses

The API follows a few consistent conventions:

| | |
| - | - |
| Request bodies | JSON, with `Content-Type: application/json`. File uploads and command input are raw bytes |
| Responses | JSON. A file's content, and command output (newline-delimited JSON), are the exceptions |
| Times | ISO 8601, in UTC: `2026-11-21T02:31:07.512Z` |
| IDs | Sandboxes `sbx-` and 10 hex characters; commands, keys, webhooks and builds are UUIDs |
| Durations | Seconds, in fields ending `_sec` |
| Sizes | Bytes in fields ending `_bytes`, MB in `_mb`, GB in `_gb` |
| Money | US dollars, in fields ending `_usd` |

## Status codes

The HTTP status code tells you at a glance whether a request worked and, if not, what kind of problem occurred:

| Status | Means |
| - | - |
| `200`, `201`, `202` | Done (`201`: created; `202`: accepted, finishes in the background) |
| `400`, `422` | The request is wrong: fix it, do not retry |
| `401` | No key, or a wrong, revoked or expired one |
| `402` | Billing: out of credit, no plan, or outside the trial |
| `403` | The key may not do this |
| `404` | Not found, or not yours |
| `409` | The resource's state does not allow it now |
| `413` | Too large |
| `429` | A limit: wait, or free capacity, then retry |
| `5xx` | Temporary: retry with backoff |

## Errors

When a request fails, the answer always has the same JSON shape:

```json title="error" theme={null}
{
  "error": "Sandbox 'sbx-0000000000' not found",
  "code": "sandbox_not_found",
  "request_id": "req_8c2f1a9e04b7d311",
  "docs_url": "https://…/api-reference/errors#sandbox_not_found"
}
```

In your code, check `code`, which never changes, rather than `error`, which is a sentence meant for people and may
be reworded. If you ask us about a failure, include the `request_id`: it lets us find your exact request. Every
code is listed in the [error list](https://docs.fibre.dev/api-reference/errors.md), and [errors, retries and limits](https://docs.fibre.dev/production/errors-and-limits.md)
explains how to handle them.

## Safe retries

If a request to create a sandbox times out, you cannot tell whether the sandbox was created. To retry safely, send
an `Idempotency-Key` header with `POST /v1/sandboxes`. **If you send the same key again within 24 hours, Fibre
returns the first sandbox** instead of creating another one. Use a new key for each sandbox you mean to create.

## Pagination

Lists can be long, so they are returned one page at a time. `GET /v1/sandboxes` returns up to `limit` items (50 by
default, at most 200). When there are more, the answer includes a `next_cursor`. Send it back as `cursor` to get
the next page. The last page has no `next_cursor`.

## Streaming

Some answers arrive gradually rather than all at once. When you read
[a command's output](https://docs.fibre.dev/api-reference/commands/read-a-commands-output.md) with `follow=1`, the connection stays open and
Fibre sends one JSON object per line as the command writes output, ending with an `end` line. Read the answer line
by line, for example with `curl -N` or a streaming `fetch`.

## Waking

Sandboxes go to sleep when they are idle. Calls that need a sleeping sandbox (exec, commands, files, browser,
desktop) wake it first and then answer, so they take a moment longer than usual. Simply reading a sandbox's details
(`GET /v1/sandboxes/{id}`) does not wake it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.