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

# Update routing rule

> Updates a routing rule. Send only the fields you want to change. Everything except `type` can be changed.

<Note>
`phoneNumbers` and `room` replace what's there. Send the full list of numbers (`[]` detaches them all), and a `room` without `pin` clears the pin.
</Note>




## OpenAPI

````yaml /api-reference/rest/openapi.yaml patch /v2/sip/routing-rule/{ruleId}
openapi: 3.1.0
info:
  title: Zero Runtime REST API
  version: '1.0'
  description: >-
    Create, configure, version and deploy agents, and wire SIP telephony to
    them.
servers:
  - url: https://api.zeroruntime.ai
security:
  - token: []
tags:
  - name: Agents
  - name: Versions
  - name: Deployment
  - name: Phone numbers
  - name: Routing rules
  - name: Calls
  - name: Batch calls
  - name: Knowledge bases
  - name: Knowledge base folders
paths:
  /v2/sip/routing-rule/{ruleId}:
    parameters:
      - name: ruleId
        in: path
        required: true
        schema:
          type: string
        example: rr_8k2m1x
    patch:
      tags:
        - Routing rules
      summary: Update routing rule
      description: >
        Updates a routing rule. Send only the fields you want to change.
        Everything except `type` can be changed.


        <Note>

        `phoneNumbers` and `room` replace what's there. Send the full list of
        numbers (`[]` detaches them all), and a `room` without `pin` clears the
        pin.

        </Note>
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/RoutingRuleInput'
                - type: object
                  properties:
                    metadata:
                      type: object
                      additionalProperties:
                        type: string
                      description: Write-only. Stored, but not returned in the response.
            example:
              name: Support inbound (EU)
              phoneNumbers:
                - '+14155550100'
                - '+14155550101'
              agentId: ag_5d81b0
              agentMetadata:
                queue: renewals
              room:
                type: dynamic
                prefix: participantNumber
              includeHeaders: ALL
              recording: true
              tags:
                - support
                - eu
      responses:
        '200':
          description: The updated rule.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RoutingRule'
        '400':
          description: >-
            The body didn't validate, or it was empty (`No editable fields
            provided`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Message'
components:
  schemas:
    RoutingRuleInput:
      type: object
      properties:
        name:
          type: string
        phoneNumbers:
          type: array
          items:
            type: string
          description: >-
            E.164 numbers already on your account. Leave it out to attach
            numbers later.
        apiKey:
          type: string
          description: >-
            Optional. On create, leave it out to use the API key of the token
            you call with.
        agentId:
          type: string
          description: Agent to dispatch. Omit to dispatch none.
        agentMetadata:
          type: object
          additionalProperties:
            type: string
          description: Flat string map handed to the agent.
        room:
          $ref: '#/components/schemas/Room'
        includeHeaders:
          type: string
          enum:
            - ALL
            - SIP_X_HEADERS
            - NONE
          default: NONE
        headers:
          type: object
          additionalProperties:
            type: string
          description: Outbound only. Extra SIP headers to send.
        headersToAttributes:
          type: object
          additionalProperties:
            type: string
          description: Inbound only. Maps an incoming header onto a call attribute.
        allowedNumbers:
          type: array
          items:
            type: string
          description: Empty means no restriction.
        allowedIpAddresses:
          type: array
          items:
            type: string
          description: Empty means no restriction.
        tags:
          type: array
          items:
            type: string
        recording:
          type: boolean
          default: false
        dtmf:
          type: boolean
          default: false
        noiseCancellation:
          type: boolean
          default: false
        hidePhoneNumber:
          type: boolean
          default: false
    RoutingRule:
      allOf:
        - type: object
          properties:
            id:
              type: string
              example: rr_8k2m1x
            type:
              type: string
              enum:
                - inbound
                - outbound
            numbers:
              type: array
              items:
                type: string
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
        - $ref: '#/components/schemas/RoutingRuleInput'
    Message:
      type: object
      properties:
        message:
          type: string
    Room:
      type: object
      default:
        type: dynamic
        prefix: blank
      properties:
        type:
          type: string
          enum:
            - dynamic
            - static
        prefix:
          type: string
          enum:
            - blank
            - participantNumber
            - sipNumber
            - random
        id:
          type: string
          description: Static rooms only.
        pin:
          type: string
          description: Static rooms only.
  securitySchemes:
    token:
      type: apiKey
      in: header
      name: Authorization
      description: Your API token, sent raw (no `Bearer` prefix).
      x-default: <auth-token>

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.