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

# Update API key

> Update an API key's name, permissions, allowed_subaccounts, allowed_ips, expires_at, or is_active. The response includes an `updated_fields` array showing which fields changed. You cannot update the API key currently being used to authenticate the request — doing so returns 409. Note: sending an empty `permissions` array is silently ignored — permissions cannot be cleared via this endpoint. Permission: `account:apikeys:update`.



## OpenAPI

````yaml /openapi-account.json put /v4/account/api-keys/{id}
openapi: 3.0.3
info:
  title: ProxyScrape Account API
  description: Account API — authenticate with the api-token header.
  version: 1.0.0
servers:
  - url: https://api.proxyscrape.com
    description: ProxyScrape API
security:
  - apiToken: []
tags:
  - name: API key management
    description: Create, list, update, regenerate, and revoke API keys
  - name: Subaccounts
    description: List subaccounts and manage preferences
  - name: Datacenter
    description: 'Datacenter shared and dedicated: overview, proxy list, usage, whitelist'
  - name: Residential
    description: 'Residential (bandwidth): overview, subusers, usage'
  - name: Residential unlimited
    description: 'Residential unlimited: overview, statistics, password'
  - name: SERP API
    description: 'SERP API: overview, subusers, search'
  - name: API ordering
    description: >-
      Place wallet-paid orders and read the wallet balance via the headless API
      ordering surface.
paths:
  /v4/account/api-keys/{id}:
    put:
      tags: []
      summary: Update API key
      description: >-
        Update an API key's name, permissions, allowed_subaccounts, allowed_ips,
        expires_at, or is_active. The response includes an `updated_fields`
        array showing which fields changed. You cannot update the API key
        currently being used to authenticate the request — doing so returns 409.
        Note: sending an empty `permissions` array is silently ignored —
        permissions cannot be cleared via this endpoint. Permission:
        `account:apikeys:update`.
      operationId: updateApiKey
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              description: At least one field must be provided.
              properties:
                name:
                  type: string
                  maxLength: 100
                permissions:
                  type: array
                  items:
                    type: string
                  description: >-
                    Array of permission strings. Empty arrays are silently
                    ignored — permissions cannot be cleared via this endpoint.
                allowed_subaccounts:
                  type: array
                  items:
                    type: string
                  description: >-
                    Subaccount UUIDs this key can act on. Empty array means all
                    subaccounts.
                allowed_ips:
                  type: array
                  items:
                    type: string
                  description: >-
                    IP addresses or CIDR ranges allowed to use this key. Empty
                    array means no IP restriction.
                expires_at:
                  type: integer
                  nullable: true
                  description: Unix timestamp for key expiry. Must be in the future.
                is_active:
                  type: boolean
                  description: Enable or disable the key without deleting it.
      responses:
        '200':
          description: Updated API key
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    example: API key updated successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      name:
                        type: string
                      permissions:
                        type: array
                        items:
                          type: string
                      allowed_subaccounts:
                        type: array
                        items:
                          type: string
                      allowed_ips:
                        type: array
                        items:
                          type: string
                      expires_at:
                        type: integer
                        nullable: true
                      is_active:
                        type: boolean
                      last_used_at:
                        type: integer
                        nullable: true
                        description: >-
                          Unix timestamp of when the key was last used. Null if
                          never used.
                      token_preview:
                        type: string
                        nullable: true
                      created_at:
                        type: integer
                        description: Unix timestamp of when the key was created.
                      updated_fields:
                        type: array
                        items:
                          type: string
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Unauthorized
        '403':
          description: >-
            Permission not allowed for your account, or permission escalation
            attempt
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  invalid_permissions:
                    type: array
                    items:
                      type: string
                    description: Present when the error is a permission scope violation.
                  excess_permissions:
                    type: array
                    items:
                      type: string
                    description: Present when the error is a permission escalation attempt.
        '404':
          description: API key not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: API key not found
        '409':
          description: Cannot update the API key currently in use
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Cannot modify the API key currently in use
        '422':
          description: >-
            Validation error — invalid permissions, invalid subaccounts, invalid
            IPs, or no fields provided
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                  messages:
                    type: object
                    description: >-
                      Field-level validation errors. Present when error is
                      'Validation failed'.
                  invalid_permissions:
                    type: array
                    items:
                      type: string
                    description: Present when unknown permission strings are provided.
                  invalid_subaccounts:
                    type: array
                    items:
                      type: string
                    description: Present when subaccount IDs don't belong to your account.
                  invalid_ips:
                    type: array
                    items:
                      type: string
                    description: Present when IP addresses or CIDR ranges are malformed.
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: false
                  error:
                    type: string
                    example: Failed to update API key
      security:
        - apiToken: []
components:
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: api-token
      description: >-
        API key. Create and manage keys at /v4/account/api-keys or in the
        dashboard.

````