API Reference
Environments

Environments

Environments represent individual Odoo instances (development, staging, production) within a project. Each environment has its own database, containers, and URL.

Base URL: https://api.oec.sh/api/public/v1


Environment Status Values

StatusMeaning
pendingNewly created, waiting to be provisioned.
deployingInitial provisioning or redeployment in progress.
runningEnvironment is up and serving traffic.
stoppedDeliberately stopped (containers are down, data is preserved).
pausedPaused by the platform (e.g. quota exceeded).
failedLast deploy or provisioning attempt failed.
errorRuntime error detected.
destroyingDeletion is in progress.
deletedEnvironment has been destroyed.

List Environments

GET /projects/{project_id}/environments

Returns all active environments for a project, ordered by creation time (oldest first).

Path Parameters

ParameterTypeDescription
project_idUUIDThe project ID.

Query Parameters

ParameterTypeDescription
statusstringFilter by status. Case-insensitive. Example: ?status=running.

Response — 200 OK

Returns an array of Environment objects.

Example

# List all environments for a project
curl "https://api.oec.sh/api/public/v1/projects/YOUR_PROJECT_ID/environments" \
  -H "Authorization: Bearer YOUR_API_KEY"
 
# Filter to running environments only
curl "https://api.oec.sh/api/public/v1/projects/YOUR_PROJECT_ID/environments?status=running" \
  -H "Authorization: Bearer YOUR_API_KEY"

Create Environment

POST /projects/{project_id}/environments

Creates a new environment inside a project and immediately enqueues an initial deployment. Requires a full_access API key.

This endpoint supports idempotency. Supply an X-Idempotency-Key header to safely retry on network errors without creating duplicate environments.

The environment is created with status deploying and a deployment is queued automatically. Poll GET /environments/{id}/status or use webhooks to track when it reaches running.

Path Parameters

ParameterTypeDescription
project_idUUIDThe project ID.

Headers

HeaderRequiredDescription
X-Idempotency-KeyNoA unique string (UUID recommended). Duplicate requests with the same key return the original response within 24 hours.

Request Body

FieldTypeRequiredDescription
namestringYesDisplay name for the environment. Max 255 characters.
branchstringNoGit branch to deploy. Defaults to the project's default_branch, then "main".
environment_typestringNoOne of development, staging, production. Defaults to development.

Response — 201 Created

Returns the created Environment object. The status field will be "deploying".

Example

curl -X POST "https://api.oec.sh/api/public/v1/projects/YOUR_PROJECT_ID/environments" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Idempotency-Key: $(uuidgen)" \
  -d '{
    "name": "staging",
    "branch": "release/17.0",
    "environment_type": "staging"
  }'

Get Environment

GET /environments/{env_id}

Returns a single environment by ID.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Response — 200 OK

Returns the Environment object.

Environment Object Fields

FieldTypeDescription
idUUIDEnvironment identifier.
namestringDisplay name.
statusstringCurrent status. See Status Values.
urlstring|nullPublic HTTPS URL. Uses custom domain if verified, otherwise the platform subdomain.
odoo_versionstring|nullOdoo version inherited from the parent project.
branchstring|nullGit branch currently deployed.
last_commitstring|nullSHA of the last deployed commit (not yet implemented — always null).
cpu_coresfloat|nullAllocated CPU cores.
ram_mbinteger|nullAllocated RAM in megabytes.
disk_gbinteger|nullAllocated disk in gigabytes.
project_idUUIDID of the parent project.
server_idUUID|nullID of the server hosting this environment.
created_atISO 8601Creation timestamp.
updated_atISO 8601|nullLast update timestamp.

Example

curl "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID" \
  -H "Authorization: Bearer YOUR_API_KEY"

Update Environment

PATCH /environments/{env_id}

Updates the environment's name or deployed Git branch. Requires a full_access API key. Omit any field to leave it unchanged. Changes to branch take effect on the next deploy.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Request Body

FieldTypeRequiredDescription
namestringNoNew display name. Max 255 characters.
branchstringNoNew Git branch to deploy on next deploy. Max 255 characters.

Response — 200 OK

Returns the updated Environment object.

Example

curl -X PATCH "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"branch": "hotfix/invoice-fix"}'

Delete Environment

DELETE /environments/{env_id}

Enqueues an environment destruction task. The environment and all its data (containers, database) are permanently removed. Requires a full_access API key.

⚠️

This is irreversible. All data in the environment (database, filestore) is permanently deleted. Back up any data you need before proceeding.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Headers

HeaderRequiredDescription
X-Confirm-DeleteYesMust be exactly "true".

Response — 202 Accepted

Deletion is asynchronous. The response contains a task_id to track progress.

{
  "task_id": "a1b2c3d4-...",
  "status": "queued",
  "environment_id": "YOUR_ENV_ID",
  "poll_url": "/api/public/v1/deployments/a1b2c3d4-..."
}

Example

curl -X DELETE "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "X-Confirm-Delete: true"

Get Environment Status

GET /environments/{env_id}/status

Returns a lightweight health snapshot for an environment. Use this for quick polling without fetching the full environment object.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Response — 200 OK

{
  "environment_id": "YOUR_ENV_ID",
  "status": "running",
  "url": "https://staging.yourapp.com",
  "container_running": true,
  "db_ready": true,
  "http_ok": true,
  "last_deploy": {
    "id": "task-uuid",
    "status": "completed",
    "started_at": "2026-03-01T12:00:00Z",
    "completed_at": "2026-03-01T12:05:00Z"
  }
}

Response Fields

FieldTypeDescription
environment_idUUIDThe environment ID.
statusstringCurrent environment status.
urlstring|nullPublic HTTPS URL.
container_runningbooleantrue when the environment is running or paused.
db_readybooleanBest-effort: true when the container is running.
http_okbooleanBest-effort: true when the container is running.
last_deployobject|nullSummary of the most recent deployment task, or null if none.
last_deploy.idUUIDTask ID.
last_deploy.statusstringTask status: pending, queued, running, completed, failed.
last_deploy.started_atISO 8601|nullWhen the task started.
last_deploy.completed_atISO 8601|nullWhen the task completed.

Example

curl "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID/status" \
  -H "Authorization: Bearer YOUR_API_KEY"

Get Environment Logs

GET /environments/{env_id}/logs

Returns deployment log text for the most recent (or a specified) task.

Path Parameters

ParameterTypeDescription
env_idUUIDThe environment ID.

Query Parameters

ParameterTypeDescription
task_idUUIDSpecific deployment task ID. Defaults to the most recent task.
linesintegerMaximum number of log lines to return. Min 1, max 5000. Default 200.

Response — 200 OK

{
  "task_id": "task-uuid",
  "log": "Step 1/12: Connecting to server...\nStep 2/12: Pulling image...\n...",
  "lines": 42,
  "truncated": false
}

Response Fields

FieldTypeDescription
task_idstring|nullThe task ID whose logs are returned. null if no task found.
logstringFull log text. Lines are joined with \n.
linesintegerNumber of lines in the returned log.
truncatedbooleantrue if there were more lines than requested and the log was cut. The most recent lines are kept.

Example

curl "https://api.oec.sh/api/public/v1/environments/YOUR_ENV_ID/logs?lines=500" \
  -H "Authorization: Bearer YOUR_API_KEY"