> ## 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.

# Create API key

> Create a new API key with a name, permissions, and optional scopes (allowed_subaccounts, allowed_ips, expires_at). The full 64-character token is returned **only once** in this response — store it securely. Permission: `account:apikeys:create`.



## OpenAPI

````yaml /openapi-account.json post /v4/account/api-keys
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:
    post:
      tags: []
      summary: Create API key
      description: >-
        Create a new API key with a name, permissions, and optional scopes
        (allowed_subaccounts, allowed_ips, expires_at). The full 64-character
        token is returned **only once** in this response — store it securely.
        Permission: `account:apikeys:create`.
      operationId: createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - permissions
              properties:
                name:
                  type: string
                  maxLength: 100
                  description: Human-readable label for the key.
                permissions:
                  type: array
                  minItems: 1
                  items:
                    type: string
                  description: >-
                    List of permission strings. Use GET
                    /v4/account/api-keys/allowed-permissions to see what your
                    account can grant.
                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. Omit
                    or null for no expiry.
      responses:
        '201':
          description: >-
            Created API key. The `data.token` field contains the 64-character
            secret — store it securely, it is only shown once.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  message:
                    type: string
                    example: API key created successfully
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      token:
                        type: string
                        description: 64-character secret. Only returned once at creation.
                      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
                      created_at:
                        type: integer
                        description: Unix timestamp of when the key was created.
                  warning:
                    type: string
                    example: This token will only be shown once. Please copy it now.
        '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.
        '422':
          description: >-
            Validation error — invalid permissions, invalid subaccounts, invalid
            IPs, or no valid permissions 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 create 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.

````