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

# Next Invoice

> Retrieve the upcoming invoice for the given subscription including any upcoming one time charges.



## OpenAPI

````yaml https://api.getmeasure.com/api/v1/docs/api_spec.json post /companies/{company_id}/invoices/next
openapi: 3.1.0
info:
  title: Measure API
  description: APIs to communicate with Measure
  version: 1.0.0
servers:
  - url: https://api.getmeasure.com/api/v1
security: []
paths:
  /companies/{company_id}/invoices/next:
    post:
      tags:
        - Invoices
      summary: Next Invoice
      description: >-
        Retrieve the upcoming invoice for the given subscription including any
        upcoming one time charges.
      operationId: Next_Invoice
      parameters:
        - name: company_id
          in: path
          description: 'The company ID with the prefix ''cmp_''. '
          required: true
          schema:
            description: 'The company ID with the prefix ''cmp_''. '
            type: string
        - name: Idempotency-Key
          in: header
          description: >-
            The idempotency key that will be used to ensure the request is only
            performed once
          schema:
            description: >-
              The idempotency key that will be used to ensure the request is
              only performed once
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RequestNextInvoiceRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResponseAPIInvoiceFindRepresentation'
      deprecated: false
      security:
        - apiKey:
            - ''
components:
  schemas:
    RequestNextInvoiceRequest:
      properties:
        cancel_config:
          $ref: '#/components/schemas/RequestCancelSubscriptionRequest'
        change_config:
          $ref: '#/components/schemas/RequestChangeSubscriptionRequest'
        currency:
          description: The currency for the invoice
          type: string
        customer_id:
          description: The customer for the invoice
          type: string
        include_taxes:
          description: Whether to include taxes in the invoice
          type: boolean
        subscription_id:
          description: The subscription ID for the invoice
          type:
            - 'null'
            - string
      required:
        - customer_id
        - currency
        - subscription_id
      type: object
    ResponseAPIInvoiceFindRepresentation:
      properties:
        auto_charges:
          description: >-
            Whether the invoice is automatically charged to the payment method
            on file for the customer
          type: boolean
        billed_customer:
          $ref: '#/components/schemas/ResponseCustomerLiteRepresentation'
          description: The expanded billed customer details for the invoice
        billed_customer_id:
          description: >-
            The billed customer ID for the invoice. This matches the customer_id
            by default, but can be set to another parent customer ID
          type: string
        created_at:
          description: The date the invoice was created
          format: date-time
          type: string
        currency:
          description: The currency of the invoice
          type: string
        customer:
          $ref: '#/components/schemas/ResponseCustomerLiteRepresentation'
          description: The expanded customer details for the invoice
        customer_id:
          description: The customer ID for the invoice
          type: string
        due:
          $ref: '#/components/schemas/ModelAmount'
          description: The total amount due on the invoice after any payments
        due_date:
          description: The date the invoice total is due
          format: date-time
          type: string
        hosted_link:
          description: >-
            The hosted link for the invoice. Includes a 1-day authentication
            token in the URL query parameter.
          type:
            - 'null'
            - string
        invoice_date:
          description: The date for the invoice
          format: date-time
          type: string
        name:
          description: The name of the invoice
          type: string
        number:
          description: The invoice number for the invoice
          type: string
        paid:
          $ref: '#/components/schemas/ModelAmount'
          description: The total amount paid against the invoice
        paid_date:
          description: The date the invoice was paid
          format: date-time
          type:
            - 'null'
            - string
        pdf_link:
          description: >-
            The PDF link for the invoice. Includes a 1-day authentication token
            in the URL query parameter.
          type:
            - 'null'
            - string
        prorated_amount:
          $ref: '#/components/schemas/ModelAmount'
          description: Any prorated amounts for the invoice
        refunded_amount:
          $ref: '#/components/schemas/ModelAmount'
          description: The total amount refunded against the invoice
        revenue:
          $ref: '#/components/schemas/ModelAmount'
          description: The revenue amount of the invoice (total minus credits)
        status:
          description: The status of the invoice such as PAID, DRAFT, VOID or PENDING
          type: string
        sub_total:
          $ref: '#/components/schemas/ModelAmount'
          description: The subtotal of the invoice which is prior to applying credits
        subscription_id:
          description: The subscription ID for the invoice, if is not a one-time invoice
          type:
            - 'null'
            - string
        total:
          $ref: '#/components/schemas/ModelAmount'
          description: >-
            The final total of the invoice after applying all credits, discounts
            and taxes
        updated_at:
          description: The last date the invoice was updated
          format: date-time
          type: string
        uuid:
          description: The unique identifier for the invoice
          type: string
      type: object
    RequestCancelSubscriptionRequest:
      description: The cancellation configuration for the subscription
      properties:
        cancel_pending_invoices:
          description: Whether to cancel the pending invoices in the subscription
          type: boolean
        charge_remaining_balance:
          description: >-
            Whether to charge the remaining balance on the subscription. This
            option cannot be combined with other refund types
          type:
            - boolean
        custom_end_date:
          description: >-
            The date for the cancellation in RFC-3339 format when the timing is
            CUSTOM
          format: date-time
          type:
            - 'null'
            - string
        custom_refund_amount:
          $ref: '#/components/schemas/ModelAmount'
          description: The amount for the refund when the refund type is CUSTOM
        customer_cancel_reason:
          description: An optional reason provided by the customer for the cancellation
          type:
            - 'null'
            - string
        reason:
          description: The reason for the subscription cancellation
          enum:
            - subscription.revoked
            - subscription.cancelled
            - subscription.expired
          type:
            - 'null'
            - string
        refund_type:
          description: >-
            This is one of PRORATED, NONE, LAST_PAYMENT or CUSTOM based on
            whether the refund needs to be the prorated price of the
            subscription, no refund, the last payment from the customer for this
            subscription or any custom amount respectively
          enum:
            - PRORATED
            - NONE
            - LAST_PAYMENT
            - CUSTOM
          type: string
        send_customer_receipt:
          description: Whether to email the cancellation receipt to the customer
          type:
            - 'null'
            - boolean
        timing:
          description: >-
            This is one of IMMEDIATE, CUSTOM, PERIOD_END or RENEWAL based on
            whether the cancellation needs to happen immediately, at a custom
            date, at the end of the current period or at the renewal date
            respectively
          enum:
            - IMMEDIATE
            - CUSTOM
            - PERIOD_END
            - RENEWAL
          type: string
      required:
        - timing
        - refund_type
        - charge_remaining_balance
      type: object
    RequestChangeSubscriptionRequest:
      description: The change configuration for subscription
      properties:
        auto_charges:
          description: >-
            Whether the subscription is automatically charged to the payment
            method
          type:
            - 'null'
            - boolean
        auto_renews:
          description: Whether the subscription is automatically renewing
          type:
            - 'null'
            - boolean
        config_items:
          description: The mapping of the product metric pricings to their quantity
          items:
            $ref: '#/components/schemas/ModelSubscriptionConfigItem'
          type:
            - array
        custom_change_date:
          description: >-
            The custom change date for the change if the timing is set to
            CUSTOM. This will be ignored otherwise
          format: date-time
          type:
            - 'null'
            - string
        discounts:
          description: >-
            The discounts attached to the change. If no discounts are sent, the
            original discounts on the subscription will remain
          items:
            $ref: '#/components/schemas/RequestDiscountParams'
          type:
            - array
            - 'null'
        metadata:
          additionalProperties: true
          description: >-
            Any additional data as key-value pairs that needs to be attached to
            the changed subscription
          type: object
        minimum_spend:
          $ref: '#/components/schemas/ModelAmount'
          description: >-
            The minimum amount of spend that needs to be attached to the
            subscription
        onetime_items:
          description: Any one time charges to be attached to the change
          items:
            $ref: '#/components/schemas/ModelOneTimeParams'
          type:
            - array
            - 'null'
        payment_method_id:
          description: The payment method for the subscription on change
          type:
            - 'null'
            - string
        product_pricing_ids:
          description: The list of product pricings that form the subscription
          items:
            type: string
          type:
            - array
        proration_type:
          description: >-
            This is one of NEXT, IMMEDIATE or NONE based on whether the
            proration is charged on the next invoice, immediately or no
            proration is applied respectively
          enum:
            - NEXT
            - IMMEDIATE
            - NONE
          type: string
        reset_billing_anchor:
          description: Whether to reset the billing anchor of the subscription
          type:
            - 'null'
            - boolean
        term:
          $ref: '#/components/schemas/ModelTerm'
          description: >-
            The term for the subscription, defaults to the largest product
            pricing frequency
        timing:
          description: >-
            This is one of IMMEDIATE, PERIOD_END, RENEWAL or CUSTOM based on
            whether the change timing needs to be immediate, at the end of the
            current period, on renewal, or at a custom date respectively
          enum:
            - IMMEDIATE
            - PERIOD_END
            - RENEWAL
            - CUSTOM
          type: string
        trial:
          description: Whether the subscription is a trial
          type:
            - 'null'
            - boolean
        trial_term:
          $ref: '#/components/schemas/ModelTerm'
      required:
        - timing
        - proration_type
        - product_pricing_ids
        - config_items
      type: object
    ResponseCustomerLiteRepresentation:
      properties:
        address:
          $ref: '#/components/schemas/ModelAddress'
          description: The address of the customer
        arr:
          $ref: '#/components/schemas/ModelAmount'
          description: The ARR of the customer
        billing_emails:
          description: The additional emails to cc on customer's invoices
          items:
            type: string
          type:
            - array
            - 'null'
        company_id:
          description: The company ID of the customer
          type: string
        computed_entitlements:
          description: The computed entitlements for the customer
          items:
            $ref: '#/components/schemas/ResponseEntitlementDataRepresentation'
          type:
            - array
            - 'null'
        created_at:
          description: The date the customer was created
          format: date-time
          type: string
        customer_integration_metadata:
          additionalProperties:
            $ref: '#/components/schemas/ModelCustomerIntegrationMetadata'
          type: object
        display_name:
          description: The computed display name of the customer
          type: string
        email:
          description: The email of the customer
          type: string
        exclude_from_metrics:
          description: >-
            Whether to exclude this customer and related fields from any metrics
            in Measure
          type: boolean
        id:
          description: The ID of the customer in Measure
          type: string
        identifier:
          description: >-
            The unique identifier for the customer that ties back to your
            system. You can query for a customer using this identifier
          type: string
        integration_references:
          description: >-
            The integration references of this customer in third-party
            applications connected to Measure
          items:
            $ref: '#/components/schemas/ResponseCustomerIntegrationRefs'
          type: array
        locale:
          description: The locale of the customer
          type: string
        managed_externally:
          description: Whether this customer is managed outside of Measure
          type: boolean
        metadata:
          additionalProperties: true
          description: The metadata as key-value pairs attached to this customer
          type: object
        mrr:
          $ref: '#/components/schemas/ModelAmount'
          description: The MRR of the customer
        name:
          description: The name of the customer
          type: string
        org_name:
          description: >-
            The name of the company or the organization this customer is a part
            of
          type: string
        owner_id:
          description: >-
            The company user ID of person in Measure assigned to manage this
            customer
          type:
            - 'null'
            - string
        parent_customer_id:
          description: The customer ID of the parent customer assigned in Measure
          type:
            - 'null'
            - string
        phone:
          description: The phone number of the customer
          type: string
        status:
          description: The status of the customer such as ACTIVE or ARCHIVED
          type: string
        title:
          description: The title of the customer, such as CEO, VP
          type: string
        updated_at:
          description: The date the customer was last updated
          format: date-time
          type: string
      type: object
    ModelAmount:
      description: The amount which has value in cents and a currency
      properties:
        currency:
          type: string
        value_in_cents:
          format: int64
          type: integer
      type: object
    ModelSubscriptionConfigItem:
      description: >-
        The configuration for pricing components which can be license counts or
        minimum usage units
      properties:
        hide_at_checkout:
          description: >-
            Whether the pricing row will be hidden at checkout, defaults to
            false
          type:
            - 'null'
            - boolean
        minimum_units:
          description: The number of minimum units for this usage-based component
          format: double
          minimum: 0
          type: number
        num_licenses:
          description: The number of licenses for this license-based component
          format: double
          minimum: 0
          type: number
        product_metric_pricing_id:
          description: The product metric pricing ID to which this config applies.
          type:
            - 'null'
            - string
        product_pricing_id:
          description: >-
            The product pricing ID to which this config applies. If the product
            pricing contains multiple components, the same config will apply to
            all of them
          type:
            - 'null'
            - string
        quantity_config:
          $ref: '#/components/schemas/ModelQuantityConfig'
        sort_order:
          description: The sort index
          type:
            - 'null'
            - number
        upsell_product_metric_pricing_id:
          type:
            - 'null'
            - string
      type: object
    RequestDiscountParams:
      properties:
        amount:
          $ref: '#/components/schemas/ModelAmount'
          description: The amount of the discount
        cap:
          $ref: '#/components/schemas/ModelAmount'
          description: The cap on the total discount amount, if needed
        expiration_date:
          description: The expiration date in RFC-3339 format for the discount, if needed
          format: date-time
          type:
            - 'null'
            - string
        name:
          description: The name for the discount
          type: string
        percent:
          description: The percent rate of the discount in decimal, less than 1
          format: double
          maximum: 1
          type: number
        product_pricing_id:
          description: >-
            The specific product pricing in the subscription that the discount
            is associated with, if not, the discount is applied to the whole
            subscription
          type:
            - 'null'
            - string
        type:
          description: >-
            The type of discount that can be one of DISCOUNT_AMOUNT or
            DISCOUNT_PERCENT
          enum:
            - DISCOUNT_AMOUNT
            - DISCOUNT_PERCENT
            - DISCOUNT_AMOUNT_PER_UNIT
          type: string
      required:
        - name
        - type
      type: object
    ModelOneTimeParams:
      description: The pricing and aggregate for the one-time billable item
      properties:
        aggregate:
          description: The quantity of the one-time charge
          exclusiveMinimum: 0
          format: double
          type: number
        custom_price:
          $ref: '#/components/schemas/ModelOneTimeCustomPrice'
          description: >-
            The custom pricing for the product. Either 'product_pricing_id' or
            'custom_price' is required
        product_pricing_id:
          description: >-
            The product pricing for the one-time charge. Either
            'product_pricing_id' or 'custom_price' is required
          type:
            - 'null'
            - string
        quantity_config:
          $ref: '#/components/schemas/ModelQuantityConfig'
        sort_order:
          description: The sort index
          type:
            - 'null'
            - number
      required:
        - aggregate
      type: object
    ModelTerm:
      description: >-
        The term which includes a frequency interval and a count for number of
        intervals
      properties:
        count:
          description: The number of times the frequency elapses
          exclusiveMinimum: 0
          format: int64
          type: integer
        frequency:
          description: The frequency at which the term repeats
          enum:
            - HOUR
            - DAY
            - WEEK
            - BI_MONTH
            - MONTH
            - QUARTER
            - BI_ANNUAL
            - YEAR
            - ONETIME
          type: string
      required:
        - frequency
        - count
      type: object
    ModelAddress:
      properties:
        address_line_1:
          type: string
        address_line_2:
          type: string
        city:
          type: string
        country:
          description: 2-character country code (ISO 3166-1 alpha-2)
          examples:
            - US
          type: string
        place_id:
          type:
            - 'null'
            - string
        state:
          type: string
        zip:
          type: string
      type: object
    ResponseEntitlementDataRepresentation:
      properties:
        entitlement_id:
          type: string
        id:
          type: string
        inherited_from_id:
          type:
            - 'null'
            - string
        inherited_from_type:
          type:
            - 'null'
            - string
        key:
          type: string
        name:
          type: string
        original_value: {}
        overridden:
          type:
            - 'null'
            - boolean
        type:
          type: string
        value: {}
      type: object
    ModelCustomerIntegrationMetadata:
      properties:
        anrok:
          $ref: '#/components/schemas/ModelAnrokCustomerIntegrationMetadata'
        avalara:
          $ref: '#/components/schemas/ModelAvalaraCustomerIntegrationMetadata'
      type: object
    ResponseCustomerIntegrationRefs:
      properties:
        integration_icon:
          type: string
        integration_id:
          type: string
        integration_key:
          type: string
        integration_name:
          type: string
        reference_type:
          type: string
        remote_id:
          type: string
        remote_type:
          type: string
      type: object
    ModelQuantityConfig:
      properties:
        allow_custom_quantity:
          type: boolean
        max_quantity:
          type: integer
        min_quantity:
          type: integer
      type: object
    ModelOneTimeCustomPrice:
      properties:
        amount:
          $ref: '#/components/schemas/ModelAmount'
          description: The amount of quantity
        description:
          description: The description of the one-time charge
          type:
            - string
            - 'null'
        product_id:
          description: The product ID
          type: string
      required:
        - product_id
        - amount
      type: object
    ModelAnrokCustomerIntegrationMetadata:
      properties:
        vat_id:
          type: string
      type: object
    ModelAvalaraCustomerIntegrationMetadata:
      properties:
        entity_code:
          type: string
      type: object
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````