Skip to content

REST API

Everything the dashboard does is an HTTPS call you can make yourself. API access is on the Cargo plan.

Create one in the dashboard under API Keys. It’s shown once. Send it on every request:

Authorization: Bearer <api-key>

Each key has a scope. Give it the narrowest that works:

Scope Can
Deploy (default) create projects, validate and deploy, start/stop/restart, env vars, logs, backups, park. Not delete projects, billing, team, keys or account settings
Read only every GET, plus validating a compose file and reading logs
Full access everything you can do

Keys expire after 90 days by default (1-365 days, or never). You can also cap a key’s monthly spend and number of containers; both count only what that key deployed. Everything a key does shows in the activity feed under its name.

Whatever its scope, a key can’t change two-factor sign-in, delete the account right away, or change its own limits.

Terminal window
API=https://api.cargoforge.dev
AUTH="Authorization: Bearer $CARGOFORGE_API_KEY"
# 1. A project (once). The Idempotency-Key makes a retry return the same one.
curl -s -X POST $API/projects -H "$AUTH" -H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" -d '{"name": "my-app"}'
# 2. Check the file without deploying (always 200; read "valid").
jq -Rs '{compose_yaml: .}' docker-compose.yml | curl -s -X POST \
$API/projects/$PROJECT/deployments/validate -H "$AUTH" -H "Content-Type: application/json" -d @-
# 3. Deploy it.
jq -Rs '{compose_yaml: .}' docker-compose.yml | curl -s -X POST \
$API/projects/$PROJECT/deployments -H "$AUTH" -H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" -d @-
# 4. Poll until actual_state is running, failed or degraded; then get the addresses.
curl -s $API/projects/$PROJECT/deployments/$DEPLOYMENT -H "$AUTH"
curl -s $API/projects/$PROJECT/endpoints -H "$AUTH"

Errors are JSON with a detail. When there’s something to act on it’s an object with a message and a machine-readable code, for example:

Code Means
api_access_requires_paid_plan (403) the account is on Freight
api_key_spend_limit_reached, api_key_container_limit_reached (403) the key’s own limit; stop something it deployed or raise the limit
region_unavailable (409) the region can’t take new projects right now
maintenance (503) the platform is in planned maintenance

An expired key gets 401 saying so. A call outside the key’s scope gets 403 naming the scope.