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

# Update API key

> Update an existing API key for a service account



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/service-accounts/{service_account_user_id}/api-keys/{api_key_id}
openapi: 3.1.0
info:
  title: Threetone API
  description: >-
    APIs for the Threetone Agents Platform and shared workspace resources.
    Authenticate programmatic requests with an API key in the x-api-key header.
  version: '1.0'
servers:
  - url: https://api.threetone.in
    description: Production
security: []
paths:
  /v1/service-accounts/{service_account_user_id}/api-keys/{api_key_id}:
    patch:
      tags:
        - workspace
      summary: Update API key
      description: Update an existing API key for a service account
      operationId: edit_service_account_api_key
      parameters:
        - name: service_account_user_id
          in: path
          required: true
          schema:
            type: string
            title: Service Account User Id
        - name: api_key_id
          in: path
          required: true
          schema:
            type: string
            title: Api Key Id
        - name: x-api-key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Your API key for programmatic access. Send it in the x-api-key
              header; you can create and manage keys from the Developers page.
            title: X-Api-Key
          description: >-
            Your API key for programmatic access. Send it in the x-api-key
            header; you can create and manage keys from the Developers page.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/Body_edit_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys__api_key_id__patch
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Body_edit_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys__api_key_id__patch:
      properties:
        is_enabled:
          anyOf:
            - type: boolean
            - type: string
              const: no_update
          title: Is Enabled
          description: Whether to enable or disable the API key.
          default: no_update
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
          description: >-
            The name of the X API key to use (used for identification purposes
            only).
          examples:
            - Support Bot
        permissions:
          anyOf:
            - items:
                $ref: '#/components/schemas/PermissionType'
              type: array
            - type: string
              enum:
                - all
                - no_update
          title: Permissions
          description: The permissions of the X API key.
          default: no_update
        credit_limit:
          anyOf:
            - type: integer
            - type: string
              enum:
                - clear
                - no_update
            - type: 'null'
          title: Credit Limit
          description: >-
            The credit limit of the X API key. If provided, requests that incur
            charges will fail after reaching this limit in the current billing
            period. Pass "clear" to remove the limit.
          default: no_update
        allowed_ips:
          anyOf:
            - items:
                type: string
              type: array
              maxItems: 100
              minItems: 1
            - type: string
              enum:
                - clear
                - no_update
          title: Allowed Ips
          description: >-
            List of IP addresses or CIDR ranges allowed to use this API key.
            Each entry may be a CIDR range (e.g. '10.0.0.0/24') or a bare IP
            address (normalized to /32 or /128). On create, omit or pass null to
            allow all IPs. On update, omit to leave the allowlist unchanged, or
            pass "clear" to remove it.
          default: no_update
        third_party_disable_allowed:
          anyOf:
            - type: boolean
            - type: string
              enum:
                - clear
                - no_update
          title: Third Party Disable Allowed
          description: >-
            Whether the holder of this key may disable it via the self-disable
            endpoint. On create, omit or pass null to use the workspace's
            default (enabled for non-Enterprise plans, disabled for Enterprise
            plans). On update, omit to leave it unchanged, or pass "clear" to
            reset it to the workspace default. Only honored for workspaces with
            self-disable access enabled.
          default: no_update
        tts_concurrency_limit:
          anyOf:
            - type: integer
            - type: string
              enum:
                - clear
                - no_update
            - type: 'null'
          title: Tts Concurrency Limit
          description: >-
            Maximum concurrent text-to-speech/speech-to-speech requests for this
            API key. Only available for enterprise customers.
          default: no_update
        expires_at_unix:
          anyOf:
            - type: integer
            - type: string
              enum:
                - clear
                - no_update
          title: Expires At Unix
          description: >-
            Unix timestamp (in seconds) after which this API key stops working.
            When set, it must be at least 15 minutes and at most 90 days in the
            future. On create, omit or pass null for a key that never expires.
            On update, omit to leave it unchanged, or pass "clear" to remove the
            expiry (never expires). A workspace may disallow never-expiring
            keys, or allow them only on service account API keys; creating one
            or clearing an expiry then fails.
          default: no_update
          examples:
            - 1735689600
      type: object
      title: >-
        Body_edit_service_account_api_key_v1_service_accounts__service_account_user_id__api_keys__api_key_id__patch
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    PermissionType:
      type: string
      enum:
        - models_read
        - voices_read
        - voices_write
        - workspace_read
        - workspace_write
        - convai_read
        - convai_write
        - agents_architect
        - agents_environment_variables_write
        - create_user_api_key
        - workspace_analytics_full_read
        - webhooks_write
        - service_account_write
        - group_members_manage
        - workspace_members_read
        - workspace_members_invite
        - workspace_members_remove
        - terms_of_service_accept
        - audit_log_read
        - conversation_privacy_manage
        - copy_resources_cross_workspace
      title: PermissionType
      description: Public API-key permission universe supported by Threetone.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

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