Nevercode Billing API

REST API endpoints for billing.

OpenAPI Specification

nevercode-billing-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Codemagic App Previews Billing API
  version: v3.0
  description: "\n# ℹ️ Overview\n\nWelcome to the Codemagic REST API. This API allows you to programmatically interact with [Codemagic's CI/CD](https://codemagic.io/) platform\nto manage your apps, trigger builds, access artifacts, and more.\n\n### Authentication\n\nAll API requests require authentication using a personal API token that is unique to each Codemagic user. The actions permitted by the token are determined by the user’s role within the team.\n\nYou can find your API token by navigating to **Teams > Personal Account > Integrations > Codemagic API > Show**.\n\nInclude your token in the request header:\n\n```\nx-auth-token: <your-api-token>\n```\n\n### Getting started\n\n1. Generate your API token from the Codemagic dashboard\n2. Explore the available endpoints in the sidebar\n3. Try out requests directly from this documentation\n\n### Rate limits\n\nCodemagic limits the number of API requests you can make within a specific amount of time to ensure the API remains\navailable for all users. Your personal rate limit is **5,000 requests per hour**.\n\nIf you exceed your rate limit, you will receive a `429` response, and the `ratelimit-remaining` header will be `0`.\nYou should not retry your request until after the time specified by the `ratelimit-reset` header.\n\n#### Checking the status of your rate limit\n\nYou can use the headers that are sent with each response to determine the current status of your rate limit.\n\n| **Header** | **Description** |\n| ---    | ---         |\n| ratelimit-limit | The maximum number of requests that you can make per hour. |\n| ratelimit-remaining | The number of requests remaining in the current rate limit window. |\n| ratelimit-reset | The number of seconds remaining until the current rate limit window resets. |\n\n### Help and support\n\n- Ask our [GitHub community](https://github.com/codemagic-ci-cd/codemagic-docs/discussions).\n- Our paying customers can get in touch with us via the in-app chat widget.\n  You have to be logged in to see the chat icon (note that some ad blockers may block the chat widget).\n\n---\n&copy; Nevercode Ltd. | All Rights Reserved | Codemagic is registered trademark of Nevercode Ltd. | [Terms](https://codemagic.io/terms)\n"
servers:
- url: https://codemagic.io/
  x-internal: false
security:
- api_key: []
tags:
- name: Billing
  description: REST API endpoints for billing.
  external_docs: null
paths:
  /api/v3/teams/{team_id}/subscriptions/{subscription_id}/promotion-code:
    post:
      tags:
      - Billing
      summary: Apply promotion code to subscription
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdPromotionCodeApplySubscriptionPromotionCode
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyPromotionCodeSchema'
        required: true
      responses:
        '204':
          description: Request fulfilled, nothing follows
          headers: {}
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Promotion code cannot be applied to this subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
  /api/v3/teams/{team_id}/subscriptions/{subscription_id}:
    get:
      tags:
      - Billing
      summary: Get subscription details
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdGetSubscription
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoPagination_api.routes.team_subscriptions.schemas.SubscriptionDetailsSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Subscription details are not available for this subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
    delete:
      tags:
      - Billing
      summary: Cancel team subscription
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdCancelSubscription
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '202':
          description: Request accepted, processing continues off-line
          headers: {}
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Subscription details are not available for this subscription.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
  /api/v3/teams/{team_id}/subscriptions:
    get:
      tags:
      - Billing
      summary: List team subscriptions
      operationId: ApiV3TeamsTeamIdSubscriptionsListTeamSubscriptions
      parameters:
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoPagination_list_api.routes.team_subscriptions.schemas.SubscriptionSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
      deprecated: false
    post:
      tags:
      - Billing
      summary: Create team subscription
      operationId: ApiV3TeamsTeamIdSubscriptionsCreateTeamSubscription
      parameters:
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSubscriptionSchema'
        required: true
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoPagination_api.routes.team_subscriptions.schemas.SubscriptionDetailsSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Billing is not configured for the team
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
  /api/v3/teams/{team_id}/subscriptions/{subscription_id}/invoice-preview:
    get:
      tags:
      - Billing
      summary: Get subscription invoice preview
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdInvoicePreviewGetSubscriptionInvoicePreview
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoPagination_api.routes.team_subscriptions.schemas.InvoicePreviewSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
      deprecated: false
  /api/v3/teams/{team_id}/subscriptions/{subscription_id}/invoices:
    get:
      tags:
      - Billing
      summary: List subscription invoices
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdInvoicesListSubscriptionInvoices
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: cursor
        in: query
        schema:
          oneOf:
          - type: string
          - type: 'null'
          description: A unique identifier after which the results should be returned.
        description: A unique identifier after which the results should be returned.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: page_size
        in: query
        schema:
          type: integer
          maximum: 100.0
          minimum: 1.0
          description: The maximum number of results per page.
          default: 30
        description: The maximum number of results per page.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CursorPagination_str_api.routes.team_subscriptions.schemas.InvoiceSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
      deprecated: false
  /api/v3/teams/{team_id}/subscriptions/{subscription_id}/default-payment-method:
    put:
      tags:
      - Billing
      summary: Set subscription default payment method
      operationId: ApiV3TeamsTeamIdSubscriptionsSubscriptionIdDefaultPaymentMethodSetSubscriptionDefaultPaymentMethod
      parameters:
      - name: subscription_id
        in: path
        schema:
          type: string
          examples:
          - 60a0b1c2d3e4f56789abcdef
        required: true
        deprecated: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PaymentMethodSchema'
        required: true
      responses:
        '204':
          description: Request fulfilled, nothing follows
          headers: {}
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Request could not be processed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
  /api/v3/teams/{team_id}/cards:
    get:
      tags:
      - Billing
      summary: List team cards
      operationId: ApiV3TeamsTeamIdCardsListTeamCards
      parameters:
      - name: cursor
        in: query
        schema:
          oneOf:
          - type: string
          - type: 'null'
          description: A unique identifier after which the results should be returned.
        description: A unique identifier after which the results should be returned.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: page_size
        in: query
        schema:
          type: integer
          maximum: 100.0
          minimum: 1.0
          description: The maximum number of results per page.
          default: 30
        description: The maximum number of results per page.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CursorPagination_str_api.routes.team_cards.schemas.CardSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
        '422':
          description: Billing is not configured for the team
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponseSchema'
      deprecated: false
  /api/v3/teams/{team_id}/invoice-preview:
    post:
      tags:
      - Billing
      summary: Generate invoice preview for chosen line items
      operationId: ApiV3TeamsTeamIdInvoicePreviewGenerateInvoicePreview
      parameters:
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateInvoicePreview'
        required: true
      responses:
        '201':
          description: Document created, URL follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NoPagination_api.routes.team_invoice_preview.schemas.Invoice_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
      deprecated: false
  /api/v3/teams/{team_id}/invoices:
    get:
      tags:
      - Billing
      summary: List team invoices
      operationId: ApiV3TeamsTeamIdInvoicesListTeamInvoices
      parameters:
      - name: cursor
        in: query
        schema:
          oneOf:
          - type: string
          - type: 'null'
          description: A unique identifier after which the results should be returned.
        description: A unique identifier after which the results should be returned.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: page_size
        in: query
        schema:
          type: integer
          maximum: 100.0
          minimum: 1.0
          description: The maximum number of results per page.
          default: 30
        description: The maximum number of results per page.
        required: false
        deprecated: false
        allowEmptyValue: false
        allowReserved: false
      - name: team_id
        in: path
        schema:
          type: string
        required: true
        deprecated: false
      responses:
        '200':
          description: Request fulfilled, document follows
          headers: {}
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CursorPagination_str_api.routes.team_invoices.schemas.InvoiceSchema_'
        '400':
          description: Bad request syntax or unsupported method
          content:
            application/json:
              schema:
                properties:
                  status_code:
                    type: integer
                  detail:
                    type: string
                  extra:
                    additionalProperties: {}
                    type:
                    - 'null'
                    - object
                    - array
                type: object
                required:
                - detail
                - status_code
                description: Validation Exception
                examples:
                - status_code: 400
                  detail: Bad Request
                  extra: {}
      deprecated: false
components:
  schemas:
    InvoiceLineItemSchema:
      properties:
        description:
          type: string
        amount:
          type: integer
        quantity:
          type: integer
        unit_amount:
          type: string
          description: Decimal value serialized as a string to avoid floating-point precision loss.
          examples:
          - '19.99'
        unit_label:
          oneOf:
          - type: string
          - type: 'null'
        currency:
          type: string
        interval:
          oneOf:
          - type: string
          - type: 'null'
      type: object
      required:
      - amount
      - currency
      - description
      - quantity
      - unit_amount
      title: InvoiceLineItemSchema
    ProductSlug:
      type: string
      enum:
      - codepush
      title: ProductSlug
    InvoiceLineItem:
      properties:
        description:
          type: string
        amount:
          type: integer
        unit_amount:
          type: string
          description: Decimal value serialized as a string to avoid floating-point precision loss.
          examples:
          - '19.99'
        quantity:
          type: integer
      type: object
      required:
      - amount
      - description
      - quantity
      - unit_amount
      title: InvoiceLineItem
    InvoicePreviewSchema:
      properties:
        provider_id:
          type: string
        status:
          oneOf:
          - $ref: '#/components/schemas/team_subscriptions_schemas_InvoiceStatus'
          - type: 'null'
        total:
          type: integer
        created_at:
          type: string
          format: date-time
        billing_reason:
          oneOf:
          - type: string
          - type: 'null'
        url:
          oneOf:
          - type: string
          - type: 'null'
        line_items:
          items:
            $ref: '#/components/schemas/InvoiceLineItemSchema'
          type: array
        currency:
          type: string
        period_start:
          type: string
          format: date-time
        period_end:
          type: string
          format: date-time
        subtotal:
          type: integer
        total_excluding_tax:
          type: integer
        taxes:
          items:
            $ref: '#/components/schemas/InvoicePreviewTaxSchema'
          type: array
        discounts:
          items:
            $ref: '#/components/schemas/InvoicePreviewDiscountSchema'
          type: array
      type: object
      required:
      - created_at
      - currency
      - discounts
      - line_items
      - period_end
      - period_start
      - provider_id
      - subtotal
      - taxes
      - total
      - total_excluding_tax
      title: InvoicePreviewSchema
    PaymentMethodSchema:
      properties:
        type:
          $ref: '#/components/schemas/PaymentMethodType'
        provider_id:
          type: string
      type: object
      required:
      - provider_id
      - type
      title: PaymentMethodSchema
    ApplyPromotionCodeSchema:
      properties:
        code:
          type: string
          minLength: 1
      type: object
      required:
      - code
      title: ApplyPromotionCodeSchema
    team_subscriptions_schemas_DiscountDuration:
      type: string
      enum:
      - forever
      - once
      - repeating
      title: DiscountDuration
    OwnerSchema:
      properties:
        name:
          oneOf:
          - type: string
          - type: 'null'
      type: object
      required: []
      title: OwnerSchema
    CreateSubscriptionPricingModel:
      type: string
      enum:
      - flat_rate
      - usage_based
      title: CreateSubscriptionPricingModel
    SubscriptionDetailsSchema:
      properties:
        id: {}
        pricing_model:
          $ref: '#/components/schemas/PricingModel'
        status:
          $ref: '#/components/schemas/SubscriptionStatus'
        category:
          $ref: '#/components/schemas/ProductCategory'
        trial_end_at:
          oneOf:
          - type: string
            format: date-time
          - type: 'null'
        default_payment_method:
          oneOf:
          - $ref: '#/components/schemas/PaymentMethodSchema'
          - type: 'null'
        provider_id:
          oneOf:
          - type: string
          - type: 'null'
        created_at:
          type: string
          format: date-time
        current_period_start_at:
          oneOf:
          - type: string
            format: date-time
          - type: 'null'
        current_period_end_at:
          oneOf:
          - type: string
            format: date-time
          - type: 'null'
        trial_start_at:
          oneOf:
          - type: string
            format: date-time
          - type: 'null'
        items:
          oneOf:
          - items:
              $ref: '#/components/schemas/SubscriptionItemSchema'
            type: array
          - type: 'null'
      type: object
      required:
      - category
      - created_at
      - id
      - pricing_model
      - status
      title: SubscriptionDetailsSchema
    CursorPagination_str_api.routes.team_invoices.schemas.InvoiceSchema_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/team_invoices_schemas_InvoiceSchema'
          type: array
        page_size:
          type: integer
        cursor:
          oneOf:
          - type: string
          - type: 'null'
      type: object
      required:
      - data
      - page_size
      title: CursorPagination[str, InvoiceSchema]
    CreateSubscriptionItemSchema:
      properties:
        product_slug:
          $ref: '#/components/schemas/ProductSlug'
      type: object
      required:
      - product_slug
      title: CreateSubscriptionItemSchema
    NoPagination_api.routes.team_subscriptions.schemas.SubscriptionDetailsSchema_:
      properties:
        data:
          $ref: '#/components/schemas/SubscriptionDetailsSchema'
      type: object
      required:
      - data
      title: NoPagination[SubscriptionDetailsSchema]
    BillingInterval:
      type: string
      enum:
      - monthly
      - annual
      title: BillingInterval
    team_invoice_preview_schemas_DiscountDuration:
      type: string
      enum:
      - forever
      - once
      - repeating
      title: DiscountDuration
    Discount:
      properties:
        name:
          oneOf:
          - type: string
          - type: 'null'
        source:
          type: string
        amount:
          type: integer
        amount_off:
          oneOf:
          - type: integer
          - type: 'null'
          description: Amount that will be taken off the subtotal.
        currency:
          oneOf:
          - type: string
          - type: 'null'
          description: Three-letter ISO code for the currency of the amount to take off.
        percent_off:
          oneOf:
          - type: string
          - type: 'null'
          description: Percent that will be taken off the subtotal.
        duration:
          $ref: '#/components/schemas/team_invoice_preview_schemas_DiscountDuration'
        duration_in_months:
          oneOf:
          - type: integer
          - type: 'null'
          description: If duration is repeating, the number of months the coupon applies, null otherwise.
      type: object
      required:
      - amount
      - amount_off
      - currency
      - duration
      - duration_in_months
      - percent_off
      - source
      title: Discount
    SubscriptionStatus:
      type: string
      enum:
      - disabled
      - active
      - incomplete
      - incomplete_expired
      - unpaid
      - paused
      - past_due
      - trialing
      - canceled
      title: SubscriptionStatus
    InvoicePreviewLineItem:
      properties:
        product_id: {}
        quantity:
          oneOf:
          - type: integer
          - type: 'null'
      type: object
      required:
      - product_id
      title: InvoicePreviewLineItem
    CursorPagination_str_api.routes.team_cards.schemas.CardSchema_:
      properties:
        data:
          items:
            $ref: '#/components/schemas/CardSchema'
          type: array
        page_size:
          type: integer
        cursor:
          oneOf:
          - type: string
          - type: 'null'
      type: object
      required:
      - data
      - page_size
      title: CursorPagination[str, CardSchema]
    Invoice:
      properties:
        currency:
          type: string
        period_start:
          type: string
          format: date-time
        period_end:
          type: string
          format: date-time
        line_items:
          items:
            $ref: '#/components/schemas/InvoiceLineItem'
          type: array
        subtotal:
          type: integer
        discounts:
          items:
            $ref: '#/components/schemas/Discount'
          type: array
        total_excluding_tax:
          type: integer
        taxes:
          items:
            $ref: '#/components/schemas/Tax'
          type: array
        total:
          type: integer
      type: object
      required:
      - currency
      - discounts
      - line_items
      - period_end
      - period_start
      - subtotal
      - taxe

# --- truncated at 32 KB (41 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/nevercode/refs/heads/main/openapi/nevercode-billing-api-openapi.yml