> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cerca.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Create approval



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/cerca/openapi.documented.yml post /agents/{agentId}/threads/{threadId}/approvals/{approvalId}
openapi: 3.1.0
info:
  description: API-key accessible routes for Cerca agents.
  title: Cerca API
  version: 0.0.0
servers:
  - url: https://api.cerca.dev
security:
  - bearerAuth: []
paths:
  /agents/{agentId}/threads/{threadId}/approvals/{approvalId}:
    post:
      tags:
        - Approvals
      summary: Create approval
      parameters:
        - schema:
            type: string
            minLength: 1
            example: agent_abc123
          required: true
          in: path
          name: agentId
        - schema:
            type: string
            minLength: 1
            example: thread_abc123
          required: true
          in: path
          name: threadId
        - schema:
            type: string
            minLength: 1
            example: approval_abc123
          required: true
          in: path
          name: approvalId
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovalResolutionRequest'
      responses:
        '200':
          description: Resolved approval request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApprovalRequest'
        '400':
          description: Invalid runtime request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Authentication required.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: >-
            Access denied or non-transient quota exceeded. Limit errors include
            a stable code field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Runtime resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '409':
          description: Approval lifecycle conflict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Transient capacity limit exceeded. Limit errors include a stable
            code field.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Required runtime dependency unavailable.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          description: Runtime error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - bearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Cerca from '@cerca-dev/sdk';

            const client = new Cerca({
              apiKey: process.env['CERCA_API_KEY'], // This is the default and can be omitted
            });

            const approvalRequest = await client.approvalRequests.resolve(
              'agent_abc123',
              'thread_abc123',
              'approval_abc123',
              { decision: 'approve' },
            );

            console.log(approvalRequest.id);
        - lang: Python
          source: |-
            import os
            from cerca import Cerca

            client = Cerca(
                api_key=os.environ.get("CERCA_API_KEY"),  # This is the default and can be omitted
            )
            approval_request = client.approval_requests.resolve(
                agent_id="agent_abc123",
                thread_id="thread_abc123",
                approval_id="approval_abc123",
                decision="approve",
            )
            print(approval_request.id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/matrices/cerca-go\"\n\t\"github.com/matrices/cerca-go/option\"\n)\n\nfunc main() {\n\tclient := cercago.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tapprovalRequest, err := client.ApprovalRequests.Resolve(\n\t\tcontext.TODO(),\n\t\t\"agent_abc123\",\n\t\t\"thread_abc123\",\n\t\t\"approval_abc123\",\n\t\tcercago.ApprovalRequestResolveParams{\n\t\t\tDecision: cercago.F(cercago.ApprovalRequestResolveParamsDecisionApprove),\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", approvalRequest.ID)\n}\n"
        - lang: Ruby
          source: >-
            require "cerca"


            cerca = Cerca::Client.new(api_key: "My API Key")


            approval_request = cerca.approval_requests.resolve("agent_abc123",
            "thread_abc123", "approval_abc123", decision: :approve)


            puts(approval_request)
        - lang: CLI
          source: |-
            cerca approval-requests resolve \
              --api-key 'My API Key' \
              --agent-id agent_abc123 \
              --thread-id thread_abc123 \
              --approval-id approval_abc123 \
              --decision approve
components:
  schemas:
    ApprovalResolutionRequest:
      type: object
      properties:
        decision:
          type: string
          enum:
            - approve
            - deny
            - cancel
        grant:
          type: string
          enum:
            - thread
            - agent
      required:
        - decision
      additionalProperties:
        x-stainless-any: true
    ApprovalRequest:
      type: object
      properties:
        createdAt:
          type: string
        id:
          type: string
        input:
          $ref: '#/components/schemas/ApprovalToolInput'
        resolvedAt:
          type:
            - string
            - 'null'
        runtimeToolName:
          $ref: '#/components/schemas/RuntimeToolName'
        status:
          type: string
          enum:
            - pending
            - approved
            - denied
            - cancelled
            - timed_out
        threadId:
          type: string
        timeoutAt:
          type:
            - string
            - 'null'
        timeoutMs:
          type:
            - number
            - 'null'
        toolIndex:
          type: number
        toolName:
          type: string
        toolSourceId:
          type: string
        toolSourceVersion:
          type: number
        toolUseId:
          type: string
        turnId:
          type: string
      required:
        - createdAt
        - id
        - input
        - resolvedAt
        - runtimeToolName
        - status
        - threadId
        - timeoutAt
        - timeoutMs
        - toolIndex
        - toolName
        - toolUseId
        - turnId
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        code:
          type: string
          description: Stable machine-readable error code when the API can provide one.
          example: MONTHLY_TOKEN_BUDGET_EXCEEDED
      required:
        - error
    ApprovalToolInput:
      description: >-
        Parsed JSON tool input from the original tool call. Generated SDKs may
        expose this as unknown or Any.
      x-stainless-any: true
    RuntimeToolName:
      type: string
      enum:
        - get_time
        - sub_thread
        - wait
        - tool.call
        - tool.discover
        - artifact.read
        - agent.threads.list
        - agent.threads.get
        - agent.approvals.cancel
        - agent.approvals.grant_thread
        - agent.approvals.grant_agent
        - agent.create
        - agent.approvals.update
        - tool.connect
        - sandbox.exec
        - sandbox.read
        - sandbox.write_file
        - sandbox.read_file
        - sandbox.spawn
        - sandbox.stdin
        - sandbox.session_read
        - sandbox.kill
        - sandbox.list_sessions
        - sandbox.sync_artifact
        - memory.read
        - memory.list
        - memory.search
        - memory.write
        - memory.delete
        - db.query
        - web.search
        - web.fetch
        - agent.schedule.list
        - agent.schedule.create
        - agent.schedule.update
        - agent.schedule.delete
        - agent.schedule.trigger
  securitySchemes:
    bearerAuth:
      bearerFormat: Cerca API key
      scheme: bearer
      type: http

````