On this page

Runtime Env API

Runtime env variables are encrypted environment values inherited by MIOSA runtime surfaces. They can be scoped to a tenant, workspace, or project and targeted to all, sandbox, computer, or agent.

Base path: /api/v1/runtime-env

Endpoints

MethodPathDescription
GET/api/v1/runtime-envList runtime env vars
POST/api/v1/runtime-envCreate or upsert a runtime env var
GET/api/v1/runtime-env/{id}Fetch metadata for one runtime env var
PATCH/api/v1/runtime-env/{id}Update a runtime env var
PUT/api/v1/runtime-env/{id}Update a runtime env var
DELETE/api/v1/runtime-env/{id}Delete a runtime env var

List

GET /api/v1/runtime-env?scope=workspace&workspace_id=ws_123&target=sandbox
Authorization: Bearer msk_live_...

Query parameters:

ParameterTypeDescription
scopestringtenant, workspace, or project
workspace_idstringRequired when filtering workspace scope
project_idstringRequired when filtering project scope
targetstringall, sandbox, computer, or agent

Response:

{
  "data": [
    {
      "id": "env_123",
      "tenant_id": "tenant_123",
      "workspace_id": "ws_123",
      "project_id": null,
      "scope": "workspace",
      "target": "sandbox",
      "name": "ANTHROPIC_API_KEY",
      "preview": "sk-ant...abcd",
      "enabled": true,
      "metadata": { "provider": "anthropic" },
      "created_at": "2026-06-15T15:16:00Z",
      "updated_at": "2026-06-15T15:16:00Z"
    }
  ]
}

Create or upsert

POST /api/v1/runtime-env
Authorization: Bearer msk_live_...
Content-Type: application/json
{
  "scope": "workspace",
  "workspace_id": "ws_123",
  "target": "sandbox",
  "name": "ANTHROPIC_API_KEY",
  "value": "sk-ant-...",
  "metadata": {
    "provider": "anthropic"
  }
}

Request fields:

FieldTypeRequiredDescription
scopestringyestenant, workspace, or project
workspace_idstringconditionalRequired for workspace scope
project_idstringconditionalRequired for project scope
targetstringnoall, sandbox, computer, or agent; defaults to all
namestringyesUppercase environment variable name
valuestringyesPlaintext value to encrypt
enabledbooleannoWhether this value should be materialized
metadataobjectnoProvider, owner, rollout, or product metadata

Unique identity:

ScopeUnique by
tenanttenant_id, name, target
workspacetenant_id, workspace_id, name, target
projecttenant_id, project_id, name, target

Update

PATCH /api/v1/runtime-env/env_123
Authorization: Bearer msk_live_...
Content-Type: application/json
{
  "value": "sk-ant-new",
  "enabled": true
}

Delete

DELETE /api/v1/runtime-env/env_123
Authorization: Bearer msk_live_...

Response:

{
  "ok": true,
  "id": "env_123"
}

Materialization behavior

Runtime env is materialized when MIOSA prepares command or agent environment for sandboxes, computers, and prompt-driven agent runs. The current merge order is:

  1. tenant all
  2. tenant target-specific
  3. workspace all
  4. workspace target-specific
  5. project all
  6. project target-specific
  7. per-resource env
  8. per-run env

More specific values override earlier values with the same variable name.

Examples

Was this helpful?