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

# Assinar ou mudar plano

> Cria ou altera assinatura. `tierIndex`: 0=Free, 1=Basic, 2=Pro, 3=Business. Com cartão salvo use `paymentMethodId`; com PIX a resposta pode incluir QR/copia-e-cola.



## OpenAPI

````yaml /es/platform-api/api-reference/openapi-platform.json post /v1/platform/workspaces/{id}/subscription
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/workspaces/{id}/subscription:
    post:
      tags:
        - 'Platform: Billing'
      summary: Assinar ou mudar plano
      description: >-
        Cria ou altera assinatura. `tierIndex`: 0=Free, 1=Basic, 2=Pro,
        3=Business. Com cartão salvo use `paymentMethodId`; com PIX a resposta
        pode incluir QR/copia-e-cola.
      operationId: ntfPlatform_subscribeWorkspace
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NtfPlatform_SubscribeBody'
            example:
              tierIndex: 1
              billingType: PIX
              cpfCnpj: string
              mobilePhone: '5511999999999'
              paymentMethodId: clxx...
              couponCode: string
      responses:
        '200':
          description: Assinatura criada ou atualizada.
          content:
            application/json:
              example:
                success: true
                data:
                  tierIndex: 1
                  status: ACTIVE
                  billingType: CREDIT_CARD
                  paymentMethodId: pm_01H...
              schema:
                $ref: '#/components/schemas/ntfPlatform_SubscribeWorkspaceResponse'
        '400':
          $ref: '#/components/responses/NtfPlatform_BadRequest'
        '402':
          description: Pagamento recusado ou pendente.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NtfPlatform_Error'
              example:
                success: false
                code: PAYMENT_FAILED
        '403':
          $ref: '#/components/responses/NtfPlatform_Forbidden'
components:
  schemas:
    NtfPlatform_SubscribeBody:
      type: object
      required:
        - tierIndex
        - billingType
      properties:
        tierIndex:
          type: integer
          minimum: 0
          maximum: 10
          description: Índice do tier em PRICING_TIERS (0–10). Índice 0 = BASIC, não Free.
        billingType:
          $ref: '#/components/schemas/NtfPlatform_BillingType'
        cpfCnpj:
          type: string
          description: CPF ou CNPJ do titular.
        mobilePhone:
          type: string
          example: '5511999999999'
        paymentMethodId:
          type: string
          description: >-
            ID de cartão já tokenizado (`pm_...`). Obrigatório com `CREDIT_CARD`
            se não envia dados de cartão novos.
        couponCode:
          type: string
      example:
        tierIndex: 1
        billingType: PIX
        cpfCnpj: string
        mobilePhone: '5511999999999'
        paymentMethodId: clxx...
        couponCode: string
    ntfPlatform_SubscribeWorkspaceResponse:
      type: object
      properties:
        success:
          type: boolean
        data:
          type: object
          properties:
            tierIndex:
              type: integer
            status:
              type: string
            billingType:
              type: string
            paymentMethodId:
              type: string
      example:
        success: true
        data:
          tierIndex: 1
          status: string
          billingType: string
          paymentMethodId: clxx...
    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
    NtfPlatform_BillingType:
      type: string
      enum:
        - PIX
        - CREDIT_CARD
      description: Forma de pagamento.
  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_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.

````