---
title: "Approve a waiting revision"
method: POST
path: "/code/automations/{automationId}/revisions/{revisionId}/approve"
---

# Approve a waiting revision

`POST /code/automations/{automationId}/revisions/{revisionId}/approve`

## Request

- Base URL: `https://api.caveman.so/api/v1`
- URL: `https://api.caveman.so/api/v1/code/automations/{automationId}/revisions/{revisionId}/approve`
- Auth: one of:
  - OAuth 2
    - Authorization code: `/api/v1/oauth/authorize`
    - Token URL: `/api/v1/oauth/token` scopes: `code:write`
  - HTTP bearer
  - API key in cookie `cave_access`
  - API key in cookie `__Secure-cave_identity.session_token`

POST /api/v1/code/automations/{automationId}/revisions/{revisionId}/approve on the Caveman Cloud control plane. Requires the code:write scope. Not exposed to autonomous agents: Cloud automations are applied from a repository's .caveman/ files by the Code app, a code:run key or a push to the default branch, and a person approves wider authority (ADR 0133). An agent works inside a run's session and never applies, approves, enables or fires automations from a control-plane connection.

## Request body

- object
  - `service_account_id` string, uuid

## Response `200`

The automation, the now-active revision and, once, its hook

- object
  - `automation` CodeAutomation, required
    - `id` string, uuid, required
    - `organization_id` string, uuid
    - `repo` string, required
    - `path` string, required
    - `name` string, required
    - `host` 'cloud', required
    - `enabled` boolean, required
    - `owner_user_id` string, uuid, nullable
    - `service_account_id` string, uuid, nullable
    - `active_revision_id` string, uuid, nullable
    - `trigger_kinds` string[], required
    - `hook_id` string, nullable
    - `removed_at` string, date-time, nullable
    - `created_at` string, date-time, required
    - `updated_at` string, date-time, required
    - `active_revision` CodeAutomationRevision
      - `id` string, uuid, required
      - `automation_id` string, uuid, required
      - `sha256` string, required
      - `commit_sha` string, required
      - `state` 'active' | 'pending_approval' | 'superseded', required
      - `source` 'api' | 'push', required
      - `authority` object, required: The authority-bearing keys Cloud read: host, on, triggers, outputs, output_config (where and how each output posts), engines, agents, secrets, mcp, budget.
      - `authority_diff` object, required: What a revision adds over the active one. widens: it waits for approval.
        - `widens` boolean, required
        - `new` boolean
        - `changes` object[], required
          - `key` string, required
          - `change` 'added' | 'removed' | 'changed', required
          - `before` unknown
          - `after` unknown
          - `widens` boolean, required
      - `created_by_user_id` string, uuid, nullable
      - `created_by_service_account_id` string, uuid, nullable
      - `approved_by_user_id` string, uuid, nullable
      - `approved_at` string, date-time, nullable
      - `activated_at` string, date-time, nullable
      - `created_at` string, date-time, required
      - `files` object: The revision's files by path; on a single revision read.
    - `pending_revision` CodeAutomationRevision
      - `id` string, uuid, required
      - `automation_id` string, uuid, required
      - `sha256` string, required
      - `commit_sha` string, required
      - `state` 'active' | 'pending_approval' | 'superseded', required
      - `source` 'api' | 'push', required
      - `authority` object, required: The authority-bearing keys Cloud read: host, on, triggers, outputs, output_config (where and how each output posts), engines, agents, secrets, mcp, budget.
      - `authority_diff` object, required: What a revision adds over the active one. widens: it waits for approval.
        - `widens` boolean, required
        - `new` boolean
        - `changes` object[], required
          - `key` string, required
          - `change` 'added' | 'removed' | 'changed', required
          - `before` unknown
          - `after` unknown
          - `widens` boolean, required
      - `created_by_user_id` string, uuid, nullable
      - `created_by_service_account_id` string, uuid, nullable
      - `approved_by_user_id` string, uuid, nullable
      - `approved_at` string, date-time, nullable
      - `activated_at` string, date-time, nullable
      - `created_at` string, date-time, required
      - `files` object: The revision's files by path; on a single revision read.
    - `revisions` CodeAutomationRevision[]
      - `id` string, uuid, required
      - `automation_id` string, uuid, required
      - `sha256` string, required
      - `commit_sha` string, required
      - `state` 'active' | 'pending_approval' | 'superseded', required
      - `source` 'api' | 'push', required
      - `authority` object, required: The authority-bearing keys Cloud read: host, on, triggers, outputs, output_config (where and how each output posts), engines, agents, secrets, mcp, budget.
      - `authority_diff` object, required: What a revision adds over the active one. widens: it waits for approval.
        - `widens` boolean, required
        - `new` boolean
        - `changes` object[], required
          - `key` string, required
          - `change` 'added' | 'removed' | 'changed', required
          - `before` unknown
          - `after` unknown
          - `widens` boolean, required
      - `created_by_user_id` string, uuid, nullable
      - `created_by_service_account_id` string, uuid, nullable
      - `approved_by_user_id` string, uuid, nullable
      - `approved_at` string, date-time, nullable
      - `activated_at` string, date-time, nullable
      - `created_at` string, date-time, required
      - `files` object: The revision's files by path; on a single revision read.
  - `revision` CodeAutomationRevision, required
    - `id` string, uuid, required
    - `automation_id` string, uuid, required
    - `sha256` string, required
    - `commit_sha` string, required
    - `state` 'active' | 'pending_approval' | 'superseded', required
    - `source` 'api' | 'push', required
    - `authority` object, required: The authority-bearing keys Cloud read: host, on, triggers, outputs, output_config (where and how each output posts), engines, agents, secrets, mcp, budget.
    - `authority_diff` object, required: What a revision adds over the active one. widens: it waits for approval.
      - `widens` boolean, required
      - `new` boolean
      - `changes` object[], required
        - `key` string, required
        - `change` 'added' | 'removed' | 'changed', required
        - `before` unknown
        - `after` unknown
        - `widens` boolean, required
    - `created_by_user_id` string, uuid, nullable
    - `created_by_service_account_id` string, uuid, nullable
    - `approved_by_user_id` string, uuid, nullable
    - `approved_at` string, date-time, nullable
    - `activated_at` string, date-time, nullable
    - `created_at` string, date-time, required
    - `files` object: The revision's files by path; on a single revision read.
  - `hook` object

## Other responses

- `401`: A person's sign-in or a code:run key is required.
- `403`: The role, the key's scope, or an inactive service account (cave_code_service_account_inactive) refuses.
- `409`: Not waiting, or no service account named and none to default to (cave_code_automation_service_account_required; the message names the choices).
- `2XX`: Successful response. Exact status depends on synchronous or durable delivery outcome.
- `4XX`: Structured failure. `error.code` is stable; `error.request_id` is echoed in the x-cave-request-id header.
- `5XX`: Structured failure. `error.code` is stable; `error.request_id` is echoed in the x-cave-request-id header.

---

[API](https://skmtc.dev/caveman/apis/caveman-cloud-api.md) - [All operations](https://skmtc.dev/caveman/apis/caveman-cloud-api/llms.txt) - [OpenAPI document](https://skmtc.dev/caveman/apis/caveman-cloud-api/revisions/508312d01cfc?raw)
