> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.cloudraker.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.cloudraker.com/_mcp/server.

# Approve or reject a step

POST https://api.cloudraker.com/v1/agent-runs/{id}/approvals/{approvalId}
Content-Type: application/json

Answers a sign-off an agent run is waiting on, and lets the run carry on.

Read the outstanding ones from `approvals[]` on [the run](https://docs.cloudraker.com/api/cloud-raker-api/agents/get-agent-run) — each carries the step's name, the files it touches and, for a `before` gate, the `params` it proposes.

```json
{ "decision": "approve" }
```

**Rejecting needs a reason.** `{ "decision": "reject", "note": "Wrong signer." }` — a rejection without a `note` is a `400`.

**Editing before you approve.** Send `params` to replace the proposed inputs, `files` to replace the files the step works on (ids from [POST /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file) or the run's own inputs). The two together must stay under 1 MiB.

The response carries the decision plus `run.status`, so you know whether the run moved on, finished, or is blocked on the next thing. `?wait=` holds the request while the run picks the work back up, releasing early the moment it finishes or blocks again.

Deciding the same sign-off twice is a `409` — the first answer stands.

<Note>
An API key has no person behind it, so the run records your organization's key as the actor rather than a named individual.
</Note>

**Learn more:** [Agents guide](https://docs.cloudraker.com/capabilities/agents)

Reference: https://docs.cloudraker.com/api/cloud-raker-api/agents/decide-agent-run-approval

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: CloudRaker API
  version: 1.0.0
paths:
  /v1/agent-runs/{id}/approvals/{approvalId}:
    post:
      operationId: decide-agent-run-approval
      summary: Approve or reject a step
      description: >-
        Answers a sign-off an agent run is waiting on, and lets the run carry
        on.


        Read the outstanding ones from `approvals[]` on [the
        run](https://docs.cloudraker.com/api/cloud-raker-api/agents/get-agent-run)
        — each carries the step's name, the files it touches and, for a `before`
        gate, the `params` it proposes.


        ```json

        { "decision": "approve" }

        ```


        **Rejecting needs a reason.** `{ "decision": "reject", "note": "Wrong
        signer." }` — a rejection without a `note` is a `400`.


        **Editing before you approve.** Send `params` to replace the proposed
        inputs, `files` to replace the files the step works on (ids from [POST
        /v1/files](https://docs.cloudraker.com/api/cloud-raker-api/files/create-file)
        or the run's own inputs). The two together must stay under 1 MiB.


        The response carries the decision plus `run.status`, so you know whether
        the run moved on, finished, or is blocked on the next thing. `?wait=`
        holds the request while the run picks the work back up, releasing early
        the moment it finishes or blocks again.


        Deciding the same sign-off twice is a `409` — the first answer stands.


        <Note>

        An API key has no person behind it, so the run records your
        organization's key as the actor rather than a named individual.

        </Note>


        **Learn more:** [Agents
        guide](https://docs.cloudraker.com/capabilities/agents)
      tags:
        - agents
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: approvalId
          in: path
          required: true
          schema:
            type: string
        - name: wait
          in: query
          description: >-
            How many seconds to hold the request open. Releases early the moment
            the run finishes **or** blocks on a person. Maximum 120; `0` returns
            immediately.
          required: false
          schema:
            type: integer
            default: 60
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The decision, and where the run stands after it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/V1AgentRunApprovalDecision'
        '400':
          description: A rejection with no reason, or edits over 1 MiB (`invalid_request`).
          content:
            application/json:
              schema:
                description: Any type
        '404':
          description: >-
            Unknown run id (`not_found`), unknown sign-off
            (`approval_not_found`), or a file id that is not yours
            (`not_found`).
          content:
            application/json:
              schema:
                description: Any type
        '409':
          description: >-
            Already decided (`approval_decided`), the run has not started yet
            (`run_not_started`), or it is no longer running (`run_not_running`).
          content:
            application/json:
              schema:
                description: Any type
        '429':
          description: >-
            Rate limited. The `/v1` API allows at least **67 requests per minute
            per organization** (about 1,000 requests per 15 minutes) — a
            guaranteed floor, enforced per edge location, so a geographically
            spread caller may get more. Wait for the `Retry-After` interval and
            retry — the error is `retryable`.
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/DecideAgentRunApprovalRequestTooManyRequestsError
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/V1DecideAgentRunApprovalBody'
servers:
  - url: https://api.cloudraker.com
    description: Production
  - url: https://api.staging.raker.one
    description: Staging
  - url: https://api.dev.raker.one
    description: Development
components:
  schemas:
    V1DecideAgentRunApprovalBodyDecision:
      type: string
      enum:
        - approve
        - reject
      description: >-
        Approve to let the step run (or its result stand), reject to refuse it.
        A rejection needs a `note`.
      title: V1DecideAgentRunApprovalBodyDecision
    V1DecideAgentRunApprovalBody:
      type: object
      properties:
        decision:
          $ref: '#/components/schemas/V1DecideAgentRunApprovalBodyDecision'
          description: >-
            Approve to let the step run (or its result stand), reject to refuse
            it. A rejection needs a `note`.
        note:
          type: string
          description: Why. Required on a rejection, recorded on the run either way.
        params:
          type: object
          additionalProperties:
            description: Any type
          description: Replace the inputs proposed for the step before it runs.
        files:
          type: array
          items:
            type: string
          description: Replace the files the step works on, by file id.
      required:
        - decision
      title: V1DecideAgentRunApprovalBody
    V1AgentRunApprovalDecisionKind:
      type: string
      enum:
        - before
        - output
      title: V1AgentRunApprovalDecisionKind
    V1AgentRunApprovalDecisionStatus:
      type: string
      enum:
        - pending
        - approved
        - rejected
        - void
      title: V1AgentRunApprovalDecisionStatus
    V1AgentRunPointerStatus:
      type: string
      enum:
        - queued
        - processing
        - waiting
        - paused
        - completed
        - failed
        - cancelled
        - expired
      description: >-
        Where the agent run is in its life.


        | Status | Meaning |

        | --- | --- |

        | `queued` | Accepted; its files are still being prepared |

        | `processing` | The agent is working |

        | `waiting` | Blocked on a person — see `waiting`, `approvals` and
        `tasks[]` |

        | `paused` | Stopped short of finishing and resumable; not a failure |

        | `completed` | Finished; `result` and `output` are populated |

        | `failed` | Finished without producing a result |

        | `cancelled` | Stopped on request |

        | `expired` | Reached its `expiresAt` without finishing |


        `completed`, `failed`, `cancelled` and `expired` are terminal. A
        `completed` run that still had outstanding work also carries
        `incomplete: true`.
      title: V1AgentRunPointerStatus
    V1AgentRunPointer:
      type: object
      properties:
        id:
          type: string
        status:
          $ref: '#/components/schemas/V1AgentRunPointerStatus'
          description: >-
            Where the agent run is in its life.


            | Status | Meaning |

            | --- | --- |

            | `queued` | Accepted; its files are still being prepared |

            | `processing` | The agent is working |

            | `waiting` | Blocked on a person — see `waiting`, `approvals` and
            `tasks[]` |

            | `paused` | Stopped short of finishing and resumable; not a failure
            |

            | `completed` | Finished; `result` and `output` are populated |

            | `failed` | Finished without producing a result |

            | `cancelled` | Stopped on request |

            | `expired` | Reached its `expiresAt` without finishing |


            `completed`, `failed`, `cancelled` and `expired` are terminal. A
            `completed` run that still had outstanding work also carries
            `incomplete: true`.
        statusUrl:
          type: string
      required:
        - id
        - status
        - statusUrl
      title: V1AgentRunPointer
    V1AgentRunApprovalDecision:
      type: object
      properties:
        object:
          type: string
          enum:
            - agent_run_approval
        id:
          type: string
        kind:
          $ref: '#/components/schemas/V1AgentRunApprovalDecisionKind'
        action:
          type: string
        status:
          $ref: '#/components/schemas/V1AgentRunApprovalDecisionStatus'
        requestedAt:
          type: string
        decidedAt:
          type:
            - string
            - 'null'
        note:
          type:
            - string
            - 'null'
        run:
          $ref: '#/components/schemas/V1AgentRunPointer'
      required:
        - object
        - id
        - kind
        - action
        - status
        - requestedAt
        - decidedAt
        - note
        - run
      title: V1AgentRunApprovalDecision
    V1AgentRunsIdApprovalsApprovalIdPostResponsesContentApplicationJsonSchemaCode:
      type: string
      enum:
        - rate_limited
      title: >-
        V1AgentRunsIdApprovalsApprovalIdPostResponsesContentApplicationJsonSchemaCode
    DecideAgentRunApprovalRequestTooManyRequestsError:
      type: object
      properties:
        code:
          $ref: >-
            #/components/schemas/V1AgentRunsIdApprovalsApprovalIdPostResponsesContentApplicationJsonSchemaCode
        message:
          type: string
        retryable:
          type: boolean
        requestId:
          type: string
        docUrl:
          type: string
      required:
        - code
        - message
        - retryable
        - requestId
      title: DecideAgentRunApprovalRequestTooManyRequestsError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```

## Examples



**Request**

```json
{
  "decision": "approve"
}
```

**Response**

```json
{
  "object": "agent_run_approval",
  "id": "a1b2c3d4-e5f6-7890-ab12-cd34ef567890",
  "kind": "before",
  "action": "deploy",
  "status": "approved",
  "requestedAt": "2024-06-10T15:20:30Z",
  "decidedAt": "2024-06-10T15:22:00Z",
  "note": "Approved after review.",
  "run": {
    "id": "run-9876543210",
    "status": "processing",
    "statusUrl": "https://app.cloudraker.com/runs/run-9876543210/status"
  }
}
```

**SDK Code**

```typescript
import { CloudRakerClient } from "@cloudraker/api";

async function main() {
    const client = new CloudRakerClient({
        token: "YOUR_TOKEN_HERE",
    });
    await client.agents.decideAgentRunApproval("id", "approvalId", {
        decision: "approve",
    });
}
main();

```

```python
from cloudraker import CloudRaker

client = CloudRaker(
    token="YOUR_TOKEN_HERE",
)

client.agents.decide_agent_run_approval(
    id="id",
    approval_id="approvalId",
    decision="approve",
)

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId"

	payload := strings.NewReader("{\n  \"decision\": \"approve\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"decision\": \"approve\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"decision\": \"approve\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId', [
  'body' => '{
  "decision": "approve"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"decision\": \"approve\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["decision": "approve"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.cloudraker.com/v1/agent-runs/id/approvals/approvalId")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```