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

> ## Agent Instructions
> Integrating Pilot Status end to end? Follow https://docs.pilotstatus.com.br/guides/integrate-with-ai.md (pt-BR: https://docs.pilotstatus.com.br/pt-BR/guides/integrate-with-ai.md). No step requires contacting support: every credential is shown in the dashboard or in an API response, and a lost one is regenerated, not recovered.
> Webhook signing secret: shown ONCE in the Signing secret window right after creating the webhook on /webhooks, and in the `secret` field of the POST /v1/webhooks response (MCP: webhooks_create). Lost it: Edit Webhook → Generate a new secret, POST /v1/webhooks/{id}/rotate-secret, or webhooks_rotate_secret (the old one stops working at once). Verify `x-pilot-status-signature` = hex HMAC-SHA256 of the raw request body keyed with that secret.
> Meta verify token (number connected with the user's own Meta app credentials): Meta Number Created! window after connecting, then the number's card on Numbers (workspace Owner), or webhook.verifyToken in the POST /v1/numbers/meta response. It is not the webhook signing secret.
> REST auth: `x-api-key: ps_...` header, never Authorization: Bearer. MCP: https://mcp.pilotstatus.com.br/mcp (148 tools, OAuth 2.1 or x-api-key); Code Mode: https://mcp.pilotstatus.com.br/code. Destructive MCP tools return a preview and a confirm_token: show the preview and call again only after the user's explicit yes. Over OAuth, revealing or creating ps_ API keys is workspace Owner only.

# Listar líneas telefónicas

> Devuelve las líneas del workspace de la key, **de la compra más reciente a la más antigua**. Por defecto solo las líneas que todavía tienes (`ACTIVE`, `PAYMENT_PENDING`, `SUSPENDED`); agrega `includeClosed=true` para incluir las finalizadas (`RETURNED`, `CANCELED`). La lista **no tiene paginación**: siempre devuelve todas las líneas que coinciden. Cada elemento es el mismo objeto de línea que devuelve `GET /v1/phone-lines/{id}`.

Permisos: con un token OAuth / MCP, el usuario debe ser **Owner o Admin** (`phone_lines:read`); de lo contrario, `403 PERMISSION_DENIED`.

Todos los endpoints `/v1/phone-lines` aceptan solo una key **limitada al tenant**: una línea pertenece al workspace, no a un número de WhatsApp, así que una key limitada a un número (o un permiso OAuth por número) recibe `403 NUMBER_SCOPE_NOT_ALLOWED` antes de que se revise cualquier rol. Un `403 PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` se envía con `Cache-Control: no-store`.

**Requiere una key limitada al tenant.**



## OpenAPI

````yaml openapi.es.json GET /v1/phone-lines
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: >-
    API REST pública de Pilot Status. Autentícate con el encabezado `x-api-key:
    ps_...` (o `x-api-key-id`). URL base: https://pilotstatus.com.br
servers:
  - url: https://pilotstatus.com.br
security:
  - apiKey: []
  - apiKeyId: []
paths:
  /v1/phone-lines:
    get:
      tags:
        - Phone Lines
      summary: Listar líneas telefónicas
      description: >-
        Devuelve las líneas del workspace de la key, **de la compra más reciente
        a la más antigua**. Por defecto solo las líneas que todavía tienes
        (`ACTIVE`, `PAYMENT_PENDING`, `SUSPENDED`); agrega `includeClosed=true`
        para incluir las finalizadas (`RETURNED`, `CANCELED`). La lista **no
        tiene paginación**: siempre devuelve todas las líneas que coinciden.
        Cada elemento es el mismo objeto de línea que devuelve `GET
        /v1/phone-lines/{id}`.


        Permisos: con un token OAuth / MCP, el usuario debe ser **Owner o
        Admin** (`phone_lines:read`); de lo contrario, `403 PERMISSION_DENIED`.


        Todos los endpoints `/v1/phone-lines` aceptan solo una key **limitada al
        tenant**: una línea pertenece al workspace, no a un número de WhatsApp,
        así que una key limitada a un número (o un permiso OAuth por número)
        recibe `403 NUMBER_SCOPE_NOT_ALLOWED` antes de que se revise cualquier
        rol. Un `403 PERMISSION_DENIED` / `WORKSPACE_MEMBERSHIP_REQUIRED` se
        envía con `Cache-Control: no-store`.


        **Requiere una key limitada al tenant.**
      operationId: get_phone_lines
      parameters:
        - name: includeClosed
          in: query
          required: false
          description: >-
            `true` o `1` incluye las líneas finalizadas (`RETURNED`,
            `CANCELED`); `false`, `0` o ausente las deja fuera. Cualquier otro
            valor (distingue mayúsculas: `TRUE` se rechaza) → **400
            `INVALID_QUERY`**.
          schema:
            type: string
            enum:
              - 'true'
              - 'false'
              - '1'
              - '0'
            default: 'false'
          example: 'true'
      responses:
        '200':
          description: Las líneas del workspace, de la compra más reciente a la más antigua
          content:
            application/json:
              schema:
                type: object
                properties:
                  lines:
                    type: array
                    description: >-
                      Las líneas, de la compra más reciente a la más antigua.
                      Sin paginación.
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: >-
                            El id de la línea. Úsalo en todas las rutas
                            `/v1/phone-lines/{id}`.
                          example: cmg5k2l1n0001pl8example9x
                        name:
                          type: string
                          description: >-
                            El nombre que tu equipo le dio a la línea en el
                            panel, hasta 60 caracteres. **Nunca está vacío:**
                            una línea sin nombre devuelve su número con formato,
                            igual que `display`, y toda línea se compra sin
                            nombre. No se puede definir ni cambiar por la API.
                            Es una etiqueta: identifica la línea por su `id`.
                          example: Support SP
                        number:
                          type: string
                          description: Dígitos E.164 **sin** `+`, p. ej. `551148637200`.
                          example: '551148637200'
                        display:
                          type: string
                          description: 'El número con formato legible: `(11) 4863-7200`.'
                          example: (11) 4863-7200
                        ddd:
                          type: string
                          description: El código de área de dos dígitos.
                          example: '11'
                        status:
                          type: string
                          description: >-
                            `ACTIVE`, `PAYMENT_PENDING`, `SUSPENDED`, `RETURNED`
                            o `CANCELED`. El campo por el cual decidir.
                          example: ACTIVE
                          enum:
                            - ACTIVE
                            - PAYMENT_PENDING
                            - SUSPENDED
                            - RETURNED
                            - CANCELED
                        price:
                          type: number
                          description: >-
                            Lo que cuesta **esta** línea por mes: el precio de
                            su próxima renovación (p. ej. `33.9`), es decir, el
                            precio de compra, o el precio de línea propio del
                            workspace cuando el equipo de Pilot Status definió
                            uno (aplicado también a las líneas compradas antes).
                          example: 33.9
                        currency:
                          type: string
                          description: '`BRL` o `USD`: la moneda en la que se cobra `price`.'
                          example: BRL
                          enum:
                            - BRL
                            - USD
                        purchasedAt:
                          type: string
                          description: >-
                            ISO 8601: cuándo se compró la línea. Las
                            renovaciones se cuentan a partir de esa fecha.
                          example: '2026-10-01T14:03:11.000Z'
                          format: date-time
                        currentPeriodEnd:
                          type: string
                          description: >-
                            ISO 8601: fin del periodo pagado. La próxima
                            renovación se intenta en la primera ejecución
                            horaria de facturación posterior. Para una línea
                            cancelada al final del periodo, es cuándo pasa a
                            `CANCELED`. No cambia mientras una renovación esté
                            impaga.
                          example: '2026-11-01T14:03:11.000Z'
                          format: date-time
                        cancelAtPeriodEnd:
                          type: boolean
                          description: >-
                            `true` después de un `DELETE` sobre una línea
                            `ACTIVE`: no se renovará y pasará a `CANCELED` en
                            `currentPeriodEnd`.
                          example: false
                        paymentPendingSince:
                          type:
                            - string
                            - 'null'
                          description: >-
                            ISO 8601: cuándo falló el cobro de la renovación. La
                            línea se suspende 2 días después. `null` cuando una
                            renovación tiene éxito.
                          example: null
                          format: date-time
                        suspendedAt:
                          type:
                            - string
                            - 'null'
                          description: >-
                            ISO 8601: cuándo se suspendió la línea. Se devuelve
                            1 día después. `null` cuando una renovación tiene
                            éxito.
                          example: null
                          format: date-time
                        returnedAt:
                          type:
                            - string
                            - 'null'
                          description: >-
                            ISO 8601: cuándo se devolvió el número al operador
                            (`RETURNED`).
                          example: null
                          format: date-time
                        canceledAt:
                          type:
                            - string
                            - 'null'
                          description: >-
                            ISO 8601: cuándo una línea cancelada al final del
                            periodo pasó a `CANCELED`.
                          example: null
                          format: date-time
                        activationCount:
                          type: integer
                          description: >-
                            Cuántas solicitudes de código se abrieron en esta
                            línea hasta ahora. Un `POST …/activations` que
                            respondió `503` no se cuenta.
                          example: 1
                        amountDue:
                          type:
                            - number
                            - 'null'
                          description: >-
                            En una línea `PAYMENT_PENDING` o `SUSPENDED`, lo que
                            se cobra al pagarla ahora: el monto de su periodo
                            vencido, fijado cuando ese periodo se cobró por
                            primera vez. `null` en cualquier otra línea.
                          example: null
              example:
                lines:
                  - id: cmg5k2l1n0001pl8example9x
                    name: Support SP
                    number: '551148637200'
                    display: (11) 4863-7200
                    ddd: '11'
                    status: ACTIVE
                    price: 33.9
                    currency: BRL
                    purchasedAt: '2026-10-01T14:03:11.000Z'
                    currentPeriodEnd: '2026-11-01T14:03:11.000Z'
                    cancelAtPeriodEnd: false
                    paymentPendingSince: null
                    suspendedAt: null
                    returnedAt: null
                    canceledAt: null
                    activationCount: 1
                    amountDue: null
        '400':
          description: '`includeClosed` no es `true`, `false`, `1` ni `0` (`INVALID_QUERY`)'
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  includeClosed must be true or false. | includeClosed deve ser
                  true ou false.
                code: INVALID_QUERY
        '401':
          description: >-
            Credencial ausente o inválida (`x-api-key`, `x-api-key-id` o
            `Authorization: Bearer`). El cuerpo trae solo `error`, sin `code`.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                missing:
                  summary: No credential
                  value:
                    error: >-
                      Missing x-api-key, x-api-key-id or Authorization Bearer
                      token
                invalid:
                  summary: Invalid API key
                  value:
                    error: Invalid API key
        '403':
          description: >-
            Key limitada a un número (`NUMBER_SCOPE_NOT_ALLOWED`), token
            OAuth/MCP de un usuario que no es Owner ni Admin
            (`PERMISSION_DENIED`) o que ya no es miembro activo
            (`WORKSPACE_MEMBERSHIP_REQUIRED`), o workspace archivado
            (`WORKSPACE_ARCHIVED`). `TENANT_REQUIRED`: credencial no ligada a
            ningún workspace
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              examples:
                numberScope:
                  summary: Number-scoped key
                  value:
                    error: This endpoint requires a tenant-scoped API key
                    code: NUMBER_SCOPE_NOT_ALLOWED
                permissionDenied:
                  summary: OAuth/MCP user who is not Owner or Admin
                  value:
                    error: >-
                      Your workspace role does not allow this action
                      (phone_lines:read).
                    code: PERMISSION_DENIED
                notMember:
                  summary: OAuth/MCP user no longer a member
                  value:
                    error: >-
                      The user behind this token is not an active member of this
                      workspace.
                    code: WORKSPACE_MEMBERSHIP_REQUIRED
                archived:
                  summary: Workspace archived
                  value:
                    error: >-
                      This workspace has been archived and its API is closed. |
                      Este workspace foi arquivado e sua API está encerrada.
                    code: WORKSPACE_ARCHIVED
                tenantRequired:
                  summary: Credential not bound to a workspace
                  value:
                    error: This credential is not bound to a workspace.
                    code: TENANT_REQUIRED
        '404':
          description: >-
            Se envió un header `x-whatsapp-number-id` que no corresponde a
            ningún número de WhatsApp de tu cuenta (`NUMBER_NOT_FOUND`). Este
            endpoint no necesita ese header: quítalo.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: >-
                  x-whatsapp-number-id does not name a WhatsApp number of this
                  account | x-whatsapp-number-id não indica um número de
                  WhatsApp desta conta
                code: NUMBER_NOT_FOUND
        '500':
          description: Falla inesperada (`INTERNAL_ERROR`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
              example:
                error: Unexpected error. | Erro inesperado.
                code: INTERNAL_ERROR
components:
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Tu API key ps_
    apiKeyId:
      type: apiKey
      in: header
      name: x-api-key-id
      description: Id de la API key (alternativa a x-api-key)

````

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