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

# Regenerate a number's API key

> REGENERATES the default API key of a single number (the product keeps exactly one default key per number — there is no "create another key"). Tenant-scoped only (403 NUMBER_SCOPE_NOT_ALLOWED for a number key). Pass the number in whatsappNumberId: its previous key is rotated/invalidated and the new raw value (`key` field) is returned ONLY ONCE — store it. Unknown number → 404 NUMBER_NOT_FOUND.

**Requires a tenant-scoped key.**



## OpenAPI

````yaml openapi.json POST /v1/api-keys
openapi: 3.1.0
info:
  title: Pilot Status API
  version: 1.0.0
  license:
    name: Pilot Status Terms of Service
    url: https://pilotstatus.com.br/terms
  description: >-
    Public REST API for Pilot Status. Authenticate with the `x-api-key: ps_...`
    header (or `x-api-key-id`). Base URL: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/api-keys:
    post:
      tags:
        - API Keys
      summary: Regenerate a number's API key
      description: >-
        REGENERATES the default API key of a single number (the product keeps
        exactly one default key per number — there is no "create another key").
        Tenant-scoped only (403 NUMBER_SCOPE_NOT_ALLOWED for a number key). Pass
        the number in whatsappNumberId: its previous key is rotated/invalidated
        and the new raw value (`key` field) is returned ONLY ONCE — store it.
        Unknown number → 404 NUMBER_NOT_FOUND.


        **Requires a tenant-scoped key.**
      operationId: post_api-keys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                whatsappNumberId:
                  type: string
                  description: Id of the number whose default key will be regenerated.
                  example: wn_1
              required:
                - whatsappNumberId
            example:
              whatsappNumberId: wn_1
      responses:
        '200':
          description: Regenerate the number's key
          content:
            application/json:
              example:
                numberId: wn_1
                keyId: k_new
                keyPrefix: ps_
                keyLast4: wxyz
                key: ps_...newreal...
                createdAt: '2026-06-28T10:00:00.000Z'
        '400':
          description: Invalid payload or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Validation error
        '401':
          description: Missing or invalid `x-api-key` / `x-api-key-id` header
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unauthorized
        '403':
          description: Number-scoped key used on a tenant-only endpoint
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Number-scoped keys cannot call tenant endpoints
                code: NUMBER_SCOPE_NOT_ALLOWED
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Too many requests
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Your ps_ API key
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: API key id (alternative to x-api-key)

````