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

# Update an API key

> Updates an API key identified by `id`. Only the provided fields are changed.



## OpenAPI

````yaml https://wavix.github.io/wavix-openapi/wavix-api.yaml patch /v1/api-keys/{id}
openapi: 3.1.0
info:
  title: Wavix APIs
  description: >-
    Wavix provides robust APIs that let you integrate voice and text messaging
    features directly into your app. Send text, place calls, and access detailed
    reports  programmatically.
  termsOfService: https://wavix.com/terms-and-conditions
  license:
    name: MIT
    identifier: MIT
  contact:
    name: Wavix
    url: https://wavix.com
    email: support@wavix.com
  version: '1.0'
servers:
  - url: https://api.wavix.com
    description: https://api.wavix.com
    variables: {}
security:
  - bearerAuth: []
tags:
  - name: SIP trunks
    description: SIP trunks
  - name: Buy
    description: Numbers
  - name: Cart
    description: Numbers
  - name: My numbers
    description: Numbers
  - name: Billing
    description: Billing, transactions, and invoices
  - name: Profile
    description: Account profile and customer information
  - name: CDRs
    description: Call detail records and call history
  - name: Speech Analytics
    description: Call transcription and speech analytics
  - name: SMS and MMS
    description: Messaging
  - name: Number Validator
    description: Phone number validation
  - name: Link shortener
    description: Short link and click metrics
  - name: 2FA
    description: Two-factor authentication
  - name: 10DLC
    description: 10DLC Campaigns and Brands
  - name: API Keys
    description: API key management
  - name: Call webhooks
    description: Webhook configuration for call events
  - name: Call control
    description: Programmable Voice
  - name: Call streaming
    description: Real-time call audio streaming over WebSocket
  - name: Call recording
    description: Call recording
  - name: Sub-accounts
    description: Sub-account management
  - name: Voice campaigns
    description: Outbound voice campaigns
  - name: Wavix Embeddable
    description: WebRTC embeddable widget
paths:
  /v1/api-keys/{id}:
    patch:
      tags:
        - API Keys
      summary: Update an API key
      description: >-
        Updates an API key identified by `id`. Only the provided fields are
        changed.
      operationId: api_keys_update
      parameters:
        - in: path
          name: id
          schema:
            type: integer
          required: true
          description: The unique ID of the API key.
          example: 123
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyUpdateRequest'
            example:
              active: true
              restricted: true
              scopes_enabled: true
              permitted_ips:
                - 192.168.1.1
                - 10.0.0.1
              label: Production API Key
        required: false
      responses:
        '200':
          description: Returns the updated API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKey'
        '400':
          $ref: '#/components/responses/BadRequestErrorResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedErrorResponse'
        '403':
          $ref: '#/components/responses/ForbiddenErrorResponse'
        '404':
          $ref: '#/components/responses/NotFoundErrorResponse'
        '422':
          $ref: '#/components/responses/ValidationErrorResponse'
components:
  schemas:
    ApiKeyUpdateRequest:
      title: ApiKeyUpdateRequest
      type: object
      additionalProperties: false
      description: >-
        Fields to update on an API key. All fields are optional; only the
        provided fields are changed.
      properties:
        active:
          type: boolean
          description: Indicates whether the API key is active.
          example: true
        restricted:
          type: boolean
          description: >-
            Indicates whether the API key is restricted to the listed permitted
            IPs.
          example: true
        scopes_enabled:
          type: boolean
          description: >-
            Indicates whether per-resource scope permissions are enforced for
            the API key.
          example: true
        permitted_ips:
          type: array
          items:
            type: string
          description: IP addresses allowed to use the API key when restriction is enabled.
          example:
            - 192.168.1.1
            - 10.0.0.1
        label:
          type: string
          description: Human-readable label for the API key.
          example: Production API Key
        numbers:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            View, buy, release, and configure phone numbers, browse inventory,
            and manage the cart.
        trunks:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: View, create, update, and delete SIP trunks and their settings.
        calls:
          allOf:
            - $ref: '#/components/schemas/ApiKeyCallsScopePermission'
          description: >-
            Access call records and active calls, and control live call actions
            such as starting, answering, ending, audio playback, DTMF,
            streaming, and transcription requests.
        messages:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            Access message history and Sender IDs, send messages, manage
            opt-outs, and create or delete Sender IDs.
        recordings:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: List, download, and delete call recordings.
        campaigns:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            View campaign analytics and Sender ID or Brand status, schedule bulk
            voice or SMS campaigns, register Brands, and create short links.
        two_fa:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            View 2FA service details and verification logs, trigger OTPs by
            voice or SMS, and validate verification codes.
        validator:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            View number validation results and trigger single or bulk validation
            or HLR lookup requests.
        webhooks:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: List, create, and delete webhooks.
        embeddable:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            Manage widget tokens, including listing, viewing, creating,
            updating, and deleting them.
        billing:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            Access statements, balance, payment methods, usage reports, and
            billing settings, including payment method updates.
        account:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: View and update account profile information and timezone.
        subaccounts:
          allOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
          description: >-
            Manage subaccounts: list and view them, create, update, and suspend
            them.
    ApiKey:
      type: object
      description: API key details including IP restrictions and scope permissions.
      required:
        - id
        - label
        - value
        - active
        - restricted
        - permitted_ips
        - scopes_enabled
        - last_used_at
        - numbers
        - trunks
        - calls
        - messages
        - recordings
        - campaigns
        - two_fa
        - validator
        - webhooks
        - embeddable
        - billing
        - account
        - subaccounts
        - created_at
      properties:
        id:
          type: integer
          description: API key ID.
          example: 123
        label:
          type: string
          description: API key label.
          example: Production API Key
        value:
          type: string
          description: API key value.
          example: abc123def456ghi789jkl012mno345pqr678stu901vwx234yz
        active:
          type: boolean
          description: Indicates whether the API key is active.
          example: true
        restricted:
          type: boolean
          description: |-
            Indicates whether IP restrictions are enabled. When enabled,
             the API key works only from IP addresses in `permitted_ips`.
          example: true
        permitted_ips:
          type: array
          items:
            type: string
          description: |-
            List of permitted IP addresses. If `restricted` is false,
             an empty list means no IP restrictions. If `restricted` is true,
              an empty list prevents all requests.
          example:
            - 192.168.1.1
            - 10.0.0.1
        scopes_enabled:
          type: boolean
          description: |-
            When `true`, the key is restricted to the permissions defined in the
            scope fields below. When `false`, the key has full access.
          example: true
        last_used_at:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            Timestamp of the most recent authenticated request made with this
            key.
          example: '2026-04-20T15:42:11Z'
        numbers:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            View, buy, release, and configure phone numbers, browse inventory,
            and manage the cart.
        trunks:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: View, create, update, and delete SIP trunks and their settings.
        calls:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyCallsScopePermission'
            - type: 'null'
          description: >-
            Access call records and active calls, and control live call actions
            such as starting, answering, ending, audio playback, DTMF,
            streaming, and transcription requests.
        messages:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            Access message history and Sender IDs, send messages, manage
            opt-outs, and create or delete Sender IDs.
        recordings:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: List, download, and delete call recordings.
        campaigns:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            View campaign analytics and Sender ID or Brand status, schedule bulk
            voice or SMS campaigns, register Brands, and create short links.
        two_fa:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            View 2FA service details and verification logs, trigger OTPs by
            voice or SMS, and validate verification codes.
        validator:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            View number validation results and trigger single or bulk validation
            or HLR lookup requests.
        webhooks:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: List, create, and delete webhooks.
        embeddable:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            Manage widget tokens, including listing, viewing, creating,
            updating, and deleting them.
        billing:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            Access statements, balance, payment methods, usage reports, and
            billing settings, including payment method updates.
        account:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: View and update account profile information and timezone.
        subaccounts:
          anyOf:
            - $ref: '#/components/schemas/ApiKeyScopePermission'
            - type: 'null'
          description: >-
            Manage subaccounts: list and view them, create, update, and suspend
            them.
        created_at:
          type: string
          format: date-time
          description: Creation date and time in ISO 8601 format.
          example: '2024-01-15T10:30:00Z'
    ApiKeyScopePermission:
      type: object
      description: Permission level for an API key scope group.
      properties:
        allow:
          type: string
          enum:
            - none
            - read
            - write
          default: none
          description: |-
            Permission level:
            - `none`: no access
            - `read`: GET only
            - `write`: all methods (includes read)
          example: read
    ApiKeyCallsScopePermission:
      type: object
      description: Permission level for the `calls` scope group.
      properties:
        allow:
          type: string
          enum:
            - none
            - read
            - write
          default: none
          description: |-
            Permission level:
            - `none`: no access
            - `read`: GET requests, `POST /v1/cdrs`
            - `write`: all methods (includes read)
          example: read
    ValidationErrorResponse:
      title: ValidationErrorResponse
      type: object
      properties:
        success:
          type: boolean
          description: >-
            Indicates whether the request was successful. Always `false` for
            this error.
          example: false
        message:
          type: string
          description: >-
            Human-readable description naming the missing or invalid request
            parameter.
          example: Missing or invalid parameter <param_name>
    UnauthorizedErrorResponse:
      title: UnauthorizedErrorResponse
      type: object
      properties:
        success:
          type: boolean
          description: >-
            Indicates whether the request was successful. Always `false` for
            this error.
          example: false
        error:
          type: boolean
          description: >-
            Indicates that the response represents an error. Always `true` for
            this error.
          example: true
        message:
          type: string
          description: >-
            Human-readable description stating that authentication is missing or
            invalid.
          example: Unauthorized
    ForbiddenErrorResponse:
      title: ForbiddenErrorResponse
      type: object
      properties:
        success:
          type: boolean
          description: >-
            Indicates whether the request was successful. Always `false` for
            this error.
          example: false
        message:
          type: string
          description: Human-readable description of why access is forbidden.
          example: The service is not provisioned for your account.
    NotFoundErrorResponse:
      title: NotFoundErrorResponse
      type: object
      properties:
        success:
          type: boolean
          description: >-
            Indicates whether the request was successful. Always `false` for
            this error.
          example: false
        message:
          type: string
          description: >-
            Human-readable description stating that no resource matches the
            given ID.
          example: Record not found
  responses:
    BadRequestErrorResponse:
      description: Request failed. Missing or invalid parameter <param_name>
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
    UnauthorizedErrorResponse:
      description: Unauthorized
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/UnauthorizedErrorResponse'
    ForbiddenErrorResponse:
      description: Request failed. The feature is disabled for your account.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ForbiddenErrorResponse'
    NotFoundErrorResponse:
      description: Request failed. An object with the specified ID is not found.
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NotFoundErrorResponse'
    ValidationErrorResponse:
      description: Validation error
      headers: {}
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Wavix API key. Pass as `Authorization: Bearer <api_key>`. Keys support
        per-resource scopes (none / read / write). See [Restricted keys and
        scopes](https://docs.wavix.com/api-reference/authentication#restricted-keys-and-scopes).

````