HTTP API
Everything the SDKs and the CLI do goes through this API. Keys, scopes, ids, errors, retries and rate limits.
The base address is https://api.foxdeploy.ai/v1. Bodies and answers are JSON, times are RFC 3339 in UTC, and money fields carry a currency and an amount. The API reference lists every operation with its fields, read from the OpenAPI contract.
A first call
curl -s https://api.foxdeploy.ai/v1/computers \
-H "Authorization: Bearer $FOXDEPLOY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: docs-first-call" \
-d '{"size":"small","region":"sgp","image":"ubuntu-24.04"}'The answer is 201 with the computer's id (cm_ and six letters or digits), its state and started_in_ms. Then run a command in it:
id=$(curl -s "https://api.foxdeploy.ai/v1/computers?state=running" \
-H "Authorization: Bearer $FOXDEPLOY_API_KEY" | python3 -c 'import json,sys; print(json.load(sys.stdin)["items"][0]["id"])')
curl -s https://api.foxdeploy.ai/v1/computers/$id/exec \
-H "Authorization: Bearer $FOXDEPLOY_API_KEY" \
-H "Content-Type: application/json" \
-d '{"cmd":"uname -a","timeout_s":60}'
curl -s -X POST https://api.foxdeploy.ai/v1/computers/$id/pause \
-H "Authorization: Bearer $FOXDEPLOY_API_KEY"With "stream": true, exec answers server sent events: stdout and stderr with {"d": "text"}, then exit with the exit code.
Keys and scopes
A key starts with fd_live_ and is shown once when it is made. We keep only a keyed hash of it. Send it as Authorization: Bearer fd_live_..., never in the address: a key found in a URL is refused with key_in_url, and you should revoke it.
| Scope | What a key with it may do |
|---|---|
| Full access | everything below, plus previews, resume, snapshots, stop, start and destroy |
| Create and exec only | create, read one computer, run commands and the terminal, files, ports and pause |
| Read only | list and read computers, read files, ports, images and regions |
A key may also carry a largest size, a spend limit of its own and an expiry date. A revoked key stops working within seconds, and anything it had open (a terminal, a stream, a running command) is ended. Revoked keys stay listed for 30 days with who revoked them.
Ids
| Prefix | What |
|---|---|
cm_ | a computer |
snap_ | a snapshot |
key_ | an API key |
org_ | an organisation |
An id that is not in your organisation answers 404, exactly as an id that does not exist.
Creates are safe to repeat
Send an Idempotency-Key header with a create. A repeat with the same key and the same body answers the first create instead of starting a second computer. The same key with another body is refused with 409 idempotency_conflict. Keys are kept 24 hours.
Rate limits and sizes
| What | Limit |
|---|---|
| Requests per key or member | 600 a minute |
| Creates per key or member | 60 a minute |
| A JSON body | 1 MiB |
| One file written | 100 MiB |
| One upload | 1 GiB |
A command's timeout_s | 1 to 3600 seconds, 600 by default |
A request over a rate limit answers 429 with Retry-After. More on request.
Errors
Every error has the same body: code, a word your code can test; message, a sentence for a person; and fields, the field errors of a request that did not validate.
{ "code": "limit_concurrent", "message": "...", "fields": {} }| Status | Codes | What to do |
|---|---|---|
| 400 | bad_request, key_in_url | fix the request |
| 401 | unauthenticated | check the key; it may be revoked |
| 402 | starts_blocked | credit is empty: add credit |
| 403 | forbidden, limit_concurrent, limit_size, limit_monthly, kill_switch | a scope or a limit: the message says which |
| 404 | not_found | no such id in your organisation |
| 409 | invalid_state, idempotency_conflict | not now, for example a command while paused |
| 413 | payload_too_large | send less |
| 422 | validation_failed | see fields |
| 429 | too_many_requests | wait for Retry-After |
| 502, 503, 504 | upstream_error, capacity, unavailable, timeout | try again later |
The full list of codes is on the API reference.
When to retry
The SDKs and the CLI already follow these rules. If you call the API yourself:
- Retry any call answered
429, afterRetry-After. - Retry a call that is safe to repeat (a read, a whole file write, a delete, a create with an
Idempotency-Key) after a5xxor a network error. - Retry anything else (
exec, pause, resume) only on a503with the codecapacityorunavailable: those say nothing started. A bare503from a proxy may follow a command that ran. - Wait 0.25 seconds before the first retry and double it each time, up to 8 seconds, with up to a quarter more at random. Stop after 3 retries.
Account, keys and usage
Your account, keys, usage and the team are on the control plane at https://api.foxdeploy.ai/api/v1, used by the dashboard with your signed in session. Making keys from code is not offered yet: make them on the API keys page.