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

# Criar API key

> Cria chave delegada. Escopo: `api_keys:manage`. `scopes` obrigatório.



## OpenAPI

````yaml /es/platform-api/api-reference/openapi-platform.json post /v1/platform/api-keys
openapi: 3.0.3
info:
  title: Notifique API Platform
  description: >-
    Conta, billing, API keys, equipe e tudo que o painel faz — via API. Rotas
    públicas: `register`, `verify`, `login`. Autentique o restante com
    `Authorization: Bearer sk_live_...` ou `x-api-key`. Escopos: `api_keys:*`,
    `billing:*`, `workspace:members:*` conforme a rota.
  version: 1.0.0
servers:
  - url: https://api.notifique.dev
    description: Produção
security:
  - ntfPlatformBearerAuth: []
  - ntfPlatformApiKeyHeader: []
tags:
  - name: 'Platform: Conta'
    description: Registro, verificação de telefone e login.
  - name: 'Platform: Billing'
    description: >-
      Assinatura, saldo, recarga e histórico de uso de créditos (`billing:read`
      / `billing:manage`).
  - name: 'Platform: API Keys'
    description: Gestão de chaves do workspace (`api_keys:read` / `api_keys:manage`).
  - name: 'Platform: Workspace'
    description: Listagem de workspaces (sessão) e recursos por workspace.
  - name: 'Platform: Equipe'
    description: >-
      Membros e convites (`workspace:members:read` /
      `workspace:members:manage`).
  - name: Sandbox
    description: Mensajes de prueba interceptados en el entorno sandbox.
paths:
  /v1/platform/api-keys:
    post:
      tags:
        - 'Platform: API Keys'
      summary: Criar API key
      description: 'Cria chave delegada. Escopo: `api_keys:manage`. `scopes` obrigatório.'
      operationId: ntfPlatform_createApiKey
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfPlatform_ApiKeyCreate'
            example:
              name: Bot staging
              environment: LIVE
              scopes:
                - whatsapp:send
                - sms:send
              instanceIds:
                - clinst_01H...
              spendLimitMode: CREDITS
              spendLimitCredits: 30000
      responses:
        '200':
          description: Chave criada.
          content:
            application/json:
              example:
                success: true
                data:
                  id: clkey_01HNEW...
                  key: sk_live_full_key_shown_once
                  prefix: sk_live_x7f2
                  name: Bot staging
                  environment: LIVE
                  scopes:
                    - whatsapp:send
                    - sms:send
              schema:
                $ref: '#/components/schemas/ntfPlatform_CreateApiKeyResponse'
        '400':
          $ref: '#/components/responses/NtfPlatform_BadRequest'
        '401':
          $ref: '#/components/responses/NtfPlatform_Unauthorized'
        '403':
          $ref: '#/components/responses/NtfPlatform_Forbidden'
components:
  schemas:
    NtfPlatform_ApiKeyCreate:
      type: object
      required:
        - name
        - environment
      properties:
        name:
          type: string
        environment:
          type: string
          enum:
            - LIVE
            - SANDBOX
          description: LIVE = produção; SANDBOX = ambiente de teste.
        scopes:
          type: array
          items:
            type: string
          description: 'Vazio = acesso ADMIN (tudo). Ex.: `whatsapp:send`, `billing:read`.'
        instanceIds:
          type: array
          items:
            type: string
        domainIds:
          type: array
          items:
            type: string
        pushAppIds:
          type: array
          items:
            type: string
        spendLimitMode:
          type: string
          enum:
            - UNLIMITED
            - CREDITS
            - CENTS
          default: UNLIMITED
        spendLimitCredits:
          type: integer
        spendLimitCents:
          type: integer
      example:
        name: Exemplo
        environment: LIVE
        scopes:
          - string
        instanceIds:
          - clxx...
        domainIds:
          - clxx...
        pushAppIds:
          - clxx...
        spendLimitMode: UNLIMITED
        spendLimitCredits: 1
        spendLimitCents: 1
    ntfPlatform_CreateApiKeyResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
          properties:
            id:
              type: string
            key:
              type: string
            prefix:
              type: string
            name:
              type: string
            environment:
              type: string
            scopes:
              type: array
              items:
                type: string
      example:
        success: true
        data:
          id: clxx...
          key: string
          prefix: string
          name: Exemplo
          environment: string
          scopes:
            - string
    NtfPlatform_Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
        code:
          type: string
        message:
          type: string
          example: Campo inválido ou ausente.
        retryAfter:
          type: integer
          example: 60
      example:
        success: false
        error: string
        code: string
  responses:
    NtfPlatform_BadRequest:
      description: Corpo inválido, enum incorreto ou campo inesperado.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfPlatform_Error'
          examples:
            invalid_enum:
              value:
                success: false
                error: plannedChannels[0] inválido
                code: VALIDATION_ERROR
            unexpected_fields:
              value:
                success: false
                code: UNEXPECTED_FIELDS
    NtfPlatform_Unauthorized:
      description: Credenciais ou token inválidos.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfPlatform_Error'
          example:
            success: false
            code: VERIFICATION_TOKEN_INVALID
    NtfPlatform_Forbidden:
      description: Escopo ausente ou sem acesso ao workspace.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/NtfPlatform_Error'
          example:
            success: false
            code: FORBIDDEN
  securitySchemes:
    ntfPlatformBearerAuth:
      type: http
      scheme: bearer
      description: API key (`sk_live_...`) ou `sessionToken` de login.
    ntfPlatformApiKeyHeader:
      type: apiKey
      in: header
      name: x-api-key
      description: Alternativa ao Bearer.

````