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

# Assign a plan to an account

> Puts the account on a plan without going through a payment gateway, which is what Super Admin does for a courtesy plan, a contract invoiced outside the platform, or a trial. Any subscription the account had is closed, the entitlements and the monthly AI Action allowance of the new plan are applied, and a suspension raised by billing is lifted. Answers with the billing state of the account after the change.



## OpenAPI

````yaml /openapi/platform.json post /platform/api/v1/accounts/{account_id}/billing/subscription
openapi: 3.1.0
info:
  title: WiseApp API — Plataforma
  description: >-
    Referência completa da API do WiseApp: plataforma (provisionamento),
    aplicação (conta), cliente (canais públicos) e MCP.
  version: 1.1.0
servers:
  - url: https://chat.wiseapp360.com
    description: Sua instalação WiseApp
security: []
paths:
  /platform/api/v1/accounts/{account_id}/billing/subscription:
    parameters:
      - $ref: '#/components/parameters/account_id'
        schema:
          type: string
        example: sample
    post:
      tags:
        - Billing Administration
      summary: Assign a plan to an account
      description: >-
        Puts the account on a plan without going through a payment gateway,
        which is what Super Admin does for a courtesy plan, a contract invoiced
        outside the platform, or a trial. Any subscription the account had is
        closed, the entitlements and the monthly AI Action allowance of the new
        plan are applied, and a suspension raised by billing is lifted. Answers
        with the billing state of the account after the change.
      operationId: assign-account-billing-plan
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/billing_admin_assign_plan_payload'
            example:
              plan_id: 3
              source: trial
              trial_days: 30
              note: Pilot agreed with the customer until the end of the quarter
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/billing_admin_assign_plan_payload'
            example:
              plan_id: 3
              source: trial
              trial_days: 30
              note: Pilot agreed with the customer until the end of the quarter
      responses:
        '201':
          description: Plan assigned
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/billing_summary'
              example:
                provider: stripe
                state: active
                plan:
                  name: Growth
                  handle: growth
                amount: 9400
                currency: USD
                billing_period: month
                trial_ends_at: null
                current_period_end: '2026-10-01T00:00:00Z'
                last_verified_at: null
                catalog: native
                source: gateway
                billing_profile_required: false
                suspension: null
                allowed_actions:
                  start_subscription: false
                  manage_subscription: true
                  select_billing_currency: false
                  change_plan: true
                  buy_addons: true
                  purchase_credits: true
                  manage_payment_methods: true
                  cancel: true
                  resume: false
                ai_actions:
                  total_count: 7000
                  current_available: 5157
                  consumed: 1843
                  next_expiry: '2026-10-01T00:00:00Z'
                  buckets:
                    plan:
                      available: 3157
                    package:
                      available: 2000
                subscription:
                  id: 91
                  plan_id: 3
                  price_id: 11
                  gateway: stripe
                  interval: month
                  amount_cents: 9400
                  remaining_period_ratio: 0.4194
                  limits:
                    agents: 13
                    inboxes: 5
                    ai_actions: 5000
                    captain_documents: 50
                  usage:
                    agents: 7
                    inboxes: 4
                  addons:
                    - slug: extra_agents
                      name: Extra agents
                      kind: agent
                      quantity: 3
                      scheduled_quantity: null
                  grace_ends_at: null
                  cancel_at: null
                  ends_at: null
                  scheduled_change: null
                  next_charge:
                    amount_cents: 9400
                    due_at: '2026-10-01T00:00:00Z'
                  payment_url: null
        '401':
          description: >-
            Unauthorized. The token is not a valid platform app token, or the
            account was not granted to this platform app.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/bad_request_error'
              example:
                error: Unauthorized
        '404':
          description: >-
            Native billing is not enabled, the account was not found, or the
            plan was not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/bad_request_error'
              example:
                error: Resource not found
        '422':
          description: >-
            The assignment source or one of the dates is invalid, returned with
            the code `invalid_source` or `invalid_date`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/billing_error'
              example:
                message: Validation failed
                attributes:
                  - name cannot be blank
      security:
        - platformAppApiKey: []
components:
  parameters:
    account_id:
      in: path
      name: account_id
      schema:
        type: integer
      required: true
      description: The numeric ID of the account
  schemas:
    billing_admin_assign_plan_payload:
      type: object
      required:
        - plan_id
      description: >-
        Assigns a plan without a gateway. Any subscription the account already
        had is closed. Entitlements and the monthly AI Action allowance are
        applied right away, and a suspension raised by billing is lifted.
      properties:
        plan_id:
          type: integer
          description: Plan to assign. It does not need to be public.
        source:
          type: string
          default: courtesy
          enum:
            - courtesy
            - manual
            - trial
          description: >-
            `courtesy` is a free plan, `manual` is a contract invoiced outside
            the platform, `trial` starts a trial that expires.
        ends_at:
          type: string
          format: date
          description: >-
            Day the subscription ends, taken to the end of that day. For a trial
            it is the end of the trial.
        trial_days:
          type: integer
          description: >-
            Length of the trial when `source` is `trial` and no `ends_at` is
            given. Defaults to 15.
        note:
          type: string
          description: >-
            Kept with the subscription. Defaults to a note naming the platform
            app that made the call.
      example:
        plan_id: 3
        source: trial
        trial_days: 30
        note: Pilot agreed with the customer until the end of the quarter
    billing_summary:
      type: object
      description: >-
        Billing state of the account. The provider-agnostic keys are always
        present; the `catalog`, `subscription`, `ai_actions` and `suspension`
        keys are added when native billing is enabled.
      properties:
        provider:
          type: string
          enum:
            - stripe
            - asaas
            - dlocal_go
            - paypal
            - shopify
        state:
          type: string
          description: >-
            Status of the current subscription, or `legacy` when the account has
            none under the native catalog.
          enum:
            - legacy
            - pending
            - incomplete
            - trialing
            - active
            - past_due
            - canceled
            - expired
            - suspended
        plan:
          type:
            - object
            - 'null'
          properties:
            name:
              type: string
            handle:
              type: string
        amount:
          type:
            - integer
            - 'null'
          description: Recurring amount in cents, add-ons included.
        currency:
          type:
            - string
            - 'null'
        billing_period:
          type:
            - string
            - 'null'
          enum:
            - month
            - semester
            - year
            - null
        trial_ends_at:
          type:
            - string
            - 'null'
          format: date-time
        current_period_end:
          type:
            - string
            - 'null'
          format: date-time
        last_verified_at:
          type:
            - string
            - 'null'
          format: date-time
        catalog:
          type: string
          description: Present and set to `native` when native billing is enabled.
          enum:
            - native
        source:
          type:
            - string
            - 'null'
          description: How the subscription was created.
          enum:
            - gateway
            - courtesy
            - manual
            - trial
            - null
        billing_profile_required:
          type: boolean
        suspension:
          type:
            - object
            - 'null'
          description: Present only while the account is suspended.
          properties:
            category:
              type: string
            suspended_at:
              type: string
              format: date-time
            billing:
              type: boolean
              description: Whether the suspension was raised by billing.
        allowed_actions:
          type: object
          description: >-
            What the current user interface is allowed to offer for this
            account.
          properties:
            start_subscription:
              type: boolean
            manage_subscription:
              type: boolean
            select_billing_currency:
              type: boolean
            change_plan:
              description: True, false, or the Shopify URL where the plan is changed.
              oneOf:
                - type: boolean
                - type: string
                  format: uri
            buy_addons:
              type: boolean
            purchase_credits:
              type: boolean
            manage_payment_methods:
              type: boolean
            cancel:
              type: boolean
            resume:
              type: boolean
        ai_actions:
          type:
            - object
            - 'null'
          description: AI Actions balance of the account.
          properties:
            total_count:
              type: integer
            current_available:
              type: integer
            consumed:
              type: integer
            next_expiry:
              type:
                - string
                - 'null'
              format: date-time
            buckets:
              type: object
              description: Balance broken down by grant bucket.
              additionalProperties: true
        subscription:
          type:
            - object
            - 'null'
          properties:
            id:
              type: integer
            plan_id:
              type: integer
            price_id:
              type:
                - integer
                - 'null'
            gateway:
              type:
                - string
                - 'null'
            interval:
              type: string
              enum:
                - month
                - semester
                - year
            amount_cents:
              type: integer
            remaining_period_ratio:
              type: number
              description: >-
                Fraction of the paid period still to run, used for plan upgrade
                prorations.
            limits:
              type: object
              description: Entitlements granted by the plan plus its add-ons.
              additionalProperties: true
            usage:
              type: object
              properties:
                agents:
                  type: integer
                inboxes:
                  type: integer
            addons:
              type: array
              items:
                type: object
                properties:
                  slug:
                    type: string
                  name:
                    type: string
                  kind:
                    type: string
                    enum:
                      - agent
                      - inbox
                  quantity:
                    type: integer
                  scheduled_quantity:
                    type:
                      - integer
                      - 'null'
            grace_ends_at:
              type:
                - string
                - 'null'
              format: date-time
            cancel_at:
              type:
                - string
                - 'null'
              format: date-time
            ends_at:
              type:
                - string
                - 'null'
              format: date-time
            scheduled_change:
              type:
                - object
                - 'null'
              properties:
                plan:
                  type: string
                at:
                  type: string
                  format: date-time
            next_charge:
              type:
                - object
                - 'null'
              properties:
                amount_cents:
                  type: integer
                due_at:
                  type:
                    - string
                    - 'null'
                  format: date-time
            payment_url:
              type:
                - string
                - 'null'
              format: uri
              description: Hosted page of the oldest open or overdue invoice.
      example:
        provider: stripe
        state: active
        plan:
          name: Growth
          handle: growth
        amount: 9400
        currency: USD
        billing_period: month
        trial_ends_at: null
        current_period_end: '2026-10-01T00:00:00Z'
        last_verified_at: null
        catalog: native
        source: gateway
        billing_profile_required: false
        suspension: null
        allowed_actions:
          start_subscription: false
          manage_subscription: true
          select_billing_currency: false
          change_plan: true
          buy_addons: true
          purchase_credits: true
          manage_payment_methods: true
          cancel: true
          resume: false
        ai_actions:
          total_count: 7000
          current_available: 5157
          consumed: 1843
          next_expiry: '2026-10-01T00:00:00Z'
          buckets:
            plan:
              available: 3157
            package:
              available: 2000
        subscription:
          id: 91
          plan_id: 3
          price_id: 11
          gateway: stripe
          interval: month
          amount_cents: 9400
          remaining_period_ratio: 0.4194
          limits:
            agents: 13
            inboxes: 5
            ai_actions: 5000
            captain_documents: 50
          usage:
            agents: 7
            inboxes: 4
          addons:
            - slug: extra_agents
              name: Extra agents
              kind: agent
              quantity: 3
              scheduled_quantity: null
          grace_ends_at: null
          cancel_at: null
          ends_at: null
          scheduled_change: null
          next_charge:
            amount_cents: 9400
            due_at: '2026-10-01T00:00:00Z'
          payment_url: null
    bad_request_error:
      title: data
      type: object
      properties:
        description:
          type: string
        errors:
          type: array
          items:
            $ref: '#/components/schemas/request_error'
    billing_error:
      type: object
      description: >-
        A billing error, with a stable machine-readable code next to the
        translated message.
      properties:
        error:
          type: string
          description: Message already translated to the locale of the account.
        code:
          type: string
          enum:
            - addon_not_available
            - addon_max_exceeded
            - invalid_quantity
            - billing_profile_required
            - provider_action_unavailable
            - price_unavailable
            - gateway_unavailable
            - subscription_required
            - cancellation_not_scheduled
            - payment_refused
            - invalid_profile
            - gateway_error
            - invalid_record
            - invalid_source
            - invalid_date
            - parameter_missing
      example:
        error: An active subscription is required.
        code: subscription_required
    request_error:
      type: object
      properties:
        field:
          type: string
        message:
          type: string
        code:
          type: string
  securitySchemes:
    platformAppApiKey:
      type: apiKey
      in: header
      name: api_access_token
      description: >-
        Token de um Platform App, gerado pelo super admin. Usado para
        provisionar contas, usuários, papéis e bots.

````

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