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

# Update inbound routing policy

> Updates one or more fields for an existing policy. If scope or target IDs change, PHONE_NUMBER requires phone_number_id, AGENT requires agent_id, and PARTNER clears both target IDs.



## OpenAPI

````yaml /openapi.json patch /inbound-route-policies/{id}
openapi: 3.1.0
info:
  title: Vocobase Partner API
  version: '2.0'
  description: >-
    API for managing voice AI agents, documents, and calls on the Vocobase
    platform.
servers:
  - url: https://api.vocobase.com/api/v2
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Config
    description: >-
      Read and update partner configuration, webhook settings, and telephony
      credentials.
  - name: Agents
    description: Create, read, update, and delete voice AI agents.
  - name: Voices
    description: >-
      List voice tiers, available voices, and stream preview audio for agent
      configuration.
  - name: Documents
    description: Upload, manage, and delete knowledge base documents.
  - name: Agent Documents
    description: Link and unlink documents to agents for knowledge base integration.
  - name: Calls
    description: Initiate outbound calls and view call history.
  - name: Phone Numbers
    description: >-
      Import DIDs, assign agents for inbound routing, and re-sync carrier
      Application bindings.
  - name: Inbound Routing Policies
    description: >-
      Define pre-answer routing decisions for inbound calls before AI sessions
      are created.
  - name: Telephony Connections
    description: Create, list, rename, and disconnect named V2 telephony connections.
  - name: VoiceLink Management
    description: Manage VoiceLink reseller clients, DID mapping, and readiness sync.
  - name: Projects
    description: Organize agents into projects. Every agent belongs to exactly one project.
  - name: Dictionaries
    description: Speech-recognition dictionary CRUD and agent attachment.
  - name: Sessions
    description: Browser-initiated WebRTC voice sessions for in-app voice agents.
paths:
  /inbound-route-policies/{id}:
    patch:
      tags:
        - Inbound Routing Policies
      summary: Update inbound routing policy
      description: >-
        Updates one or more fields for an existing policy. If scope or target
        IDs change, PHONE_NUMBER requires phone_number_id, AGENT requires
        agent_id, and PARTNER clears both target IDs.
      operationId: updateInboundRoutePolicy
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Opaque policy ID.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InboundRoutePolicyUpdateRequest'
      responses:
        '200':
          description: Policy updated.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  data:
                    type: object
                    properties:
                      policy:
                        $ref: '#/components/schemas/InboundRoutePolicy'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: A policy already exists for this scope target.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: POLICY_ALREADY_EXISTS
                  message: A policy already exists for this scope target
        '500':
          $ref: '#/components/responses/InternalError'
components:
  schemas:
    InboundRoutePolicyUpdateRequest:
      type: object
      description: >-
        Patch a webhook-backed inbound routing policy. If scope or target IDs
        change, PHONE_NUMBER requires phone_number_id, AGENT requires agent_id,
        and PARTNER clears both target IDs.
      properties:
        scope:
          $ref: '#/components/schemas/InboundRoutePolicyScope'
        phone_number_id:
          type: string
          format: uuid
          description: PHONE_NUMBER target DID. Use only with scope PHONE_NUMBER.
        agent_id:
          type: string
          format: uuid
          description: AGENT target. Use only with scope AGENT.
        name:
          type: string
          minLength: 1
          maxLength: 200
          description: Policy label used in partner admin tooling.
        enabled:
          type: boolean
          description: When false, the policy is stored but not evaluated.
        webhook_url:
          type: string
          format: uri
          description: HTTPS endpoint that receives the `inbound.route` event.
        webhook_secret:
          type:
            - string
            - 'null'
          description: Optional webhook signing secret. Write-only; `null` clears it.
          writeOnly: true
        timeout_ms:
          type: integer
          minimum: 250
          maximum: 5000
          description: Policy decision webhook timeout in milliseconds.
        failure_action:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/InboundRoutePolicyFailureAction'
          description: Fallback action when webhook fails.
        allowed_actions:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/InboundRouteAction'
          description: >-
            Optional allowlist for webhook response actions. Use `null` to clear
            and allow all.
      minProperties: 1
    InboundRoutePolicy:
      type: object
      description: Normalized inbound routing policy object.
      properties:
        id:
          type: string
          description: Opaque policy ID.
        scope:
          $ref: '#/components/schemas/InboundRoutePolicyScope'
        phone_number_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Policy target when scope is PHONE_NUMBER. Null for AGENT and PARTNER
            policies.
        partner_config_id:
          type: string
          format: uuid
        agent_id:
          type:
            - string
            - 'null'
          format: uuid
          description: >-
            Policy target when scope is AGENT. Null for PHONE_NUMBER and PARTNER
            policies.
        name:
          type: string
          maxLength: 200
        enabled:
          type: boolean
        webhook_url:
          type: string
          format: uri
        has_webhook_secret:
          type: boolean
          description: Whether a webhook secret exists (secret itself is never returned).
        timeout_ms:
          type: integer
          minimum: 250
          maximum: 5000
        failure_action:
          $ref: '#/components/schemas/InboundRoutePolicyFailureAction'
        allowed_actions:
          oneOf:
            - type: 'null'
            - type: array
              items:
                $ref: '#/components/schemas/InboundRouteAction'
        phone_number:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                id:
                  type: string
                  format: uuid
                number:
                  type: string
        agent:
          oneOf:
            - type: 'null'
            - type: object
              properties:
                id:
                  type: string
                  format: uuid
                name:
                  type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          const: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
          required:
            - code
            - message
      required:
        - success
        - error
    InboundRoutePolicyScope:
      type: string
      description: >-
        Policy scope. Runtime resolution priority is PHONE_NUMBER, then AGENT,
        then PARTNER.
      enum:
        - PHONE_NUMBER
        - AGENT
        - PARTNER
    InboundRoutePolicyFailureAction:
      type: string
      description: >-
        Fallback action used when the policy webhook times out, fails, or
        returns an invalid response.
      enum:
        - ANSWER_WITH_AI
        - REJECT
    InboundRouteAction:
      type: string
      description: Action values supported by inbound route policy responses.
      enum:
        - ANSWER_WITH_AI
        - SELECT_AGENT
        - TRANSFER
        - REJECT
  responses:
    ValidationError:
      description: Validation error in request body or parameters.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: VALIDATION_ERROR
              message: agent_name is required and must be max 50 characters
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: UNAUTHORIZED
              message: Invalid or missing API key
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: NOT_FOUND
              message: Resource not found
    InternalError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            success: false
            error:
              code: INTERNAL_ERROR
              message: An unexpected error occurred
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key in format: `rg_live_xxxx`. Pass as a Bearer token in the
        Authorization header.

````