---
title: "Get subscription invoice preview"
method: GET
path: "/api/v3/teams/{team_id}/subscriptions/{subscription_id}/invoice-preview"
tags: ["Billing"]
---

# Get subscription invoice preview

`GET /api/v3/teams/{team_id}/subscriptions/{subscription_id}/invoice-preview`

## Request

- Base URL: `https://codemagic.io`
- URL: `https://codemagic.io/api/v3/teams/{team_id}/subscriptions/{subscription_id}/invoice-preview`
- Auth: API key in header `x-auth-token`
- TypeScript: <https://skmtc.dev/codemagic/apis/codemagic-api/docs/api/v3/teams/:team_id/subscriptions/:subscription_id/invoice-preview/get.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `subscription_id` string, required
- `team_id` string, required

## Response `200`

Request fulfilled, document follows

- InvoicePreviewSchemaNoPagination
  - `data` InvoicePreviewSchema, required
    - `provider_id` string, required
    - `status` 'draft' | 'open' | 'paid' | 'uncollectible' | 'void', required: The stage an invoice is at: being prepared, awaiting payment, paid, written off as uncollectible, or voided.
    - `total` integer, required
    - `created_at` string, date-time, required
    - `billing_reason` string, nullable, required
    - `url` string, nullable, required
    - `line_items` InvoiceLineItemSchema[], required
      - `description` string, required
      - `amount` integer, required
      - `quantity` integer, required
      - `unit_amount` string, required: Decimal value serialized as a string to avoid floating-point precision loss.
      - `unit_label` string, nullable, required
      - `currency` string, required
      - `interval` string, nullable, required
    - `currency` string, required
    - `period_start` string, date-time, required
    - `period_end` string, date-time, required
    - `subtotal` integer, required
    - `total_excluding_tax` integer, required
    - `taxes` InvoicePreviewTaxSchema[], required
      - `description` string, required
      - `percentage` string, required: Decimal value serialized as a string to avoid floating-point precision loss.
      - `effective_percentage` string, nullable, required: Optional decimal value serialized as a string to avoid floating-point precision loss.
      - `amount` integer, required
      - `taxable_amount` integer, required
    - `discounts` InvoicePreviewDiscountSchema[], required
      - `name` string, nullable, required
      - `source` string, required
      - `amount` integer, required
      - `amount_off` integer, nullable, required: Amount that will be taken off the subtotal.
      - `currency` string, nullable, required: Three-letter ISO code for the currency of the amount to take off.
      - `percent_off` string, nullable, required: Percent that will be taken off the subtotal.
      - `duration` 'forever' | 'once' | 'repeating', required: How long a discount applies: to one invoice, for a fixed number of months, or indefinitely.
      - `duration_in_months` integer, nullable, required: If duration is repeating, the number of months the coupon applies, null otherwise.

## Other responses

- `400`: The request could not be validated
- `401`: Authentication is missing or invalid
- `403`: The caller lacks the required permission
- `404`: The requested resource does not exist
- `429`: The rate limit has been exceeded

---

[API](https://skmtc.dev/codemagic/apis/codemagic-api.md) - [All operations](https://skmtc.dev/codemagic/apis/codemagic-api/llms.txt) - [OpenAPI document](https://skmtc.dev/codemagic/apis/codemagic-api/revisions/be09630f65e2?raw)
