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

# Projected invoices

> Returns the invoices the contract would produce, grouped as the invoice collector groups them, and writes nothing. It reads the pending change when one waits for approval and the contract in force otherwise. From a line's next billing moment a pending change shows its new amounts; before it, the amounts of the contract in force. An invoice is one customer, currency, `autoCharge`, `bankTransferOnly`, `autoApprove.invoices`, invoice date and charge date, so a renewal invoiced early is apart from usage charged on the same day. The dates read on the customer's clock: an invoice date that has passed is shown as now. A metered line shows its rate in `unitPrice` and has no `quantity` or `subtotal` until the usage is measured. `paymentTermDays` is the larger of the customer's term (else the merchant's) and the days from the invoice date to the charge date. A rejected contract has no invoices. A draft with content no invoice can be generated from answers 400 `CONTRACT_LINE_NOT_PROJECTABLE`.



## OpenAPI

````yaml /openapi.json get /v0/contracts/{id}/projected
openapi: 3.1.0
info:
  title: Paygentic API
  version: 0.1.0
  description: >
    The Paygentic API provides a comprehensive platform for building and scaling
    monetization infrastructure.


    ## Authentication

    All API requests require authentication using an API key passed in the
    `Authorization` header:

    ```

    Authorization: Bearer YOUR_API_KEY

    ```


    ## Base URL

    All API requests should be made to:

    ```

    https://api.paygentic.io/v0

    ```
  contact:
    name: Paygentic Support
    email: support@paygentic.io
  license:
    name: Proprietary
servers:
  - url: https://api.paygentic.io
    description: Production API
  - url: https://api.sandbox.paygentic.io
    description: Sandbox API
security:
  - BearerAuth: []
tags:
  - name: Customers
    description: >-
      A `Customer` is an entity connected to a `Merchant` via a `Subscription`.
      This represents the merchant-facing perspective of `Consumers` who
      purchase their `Products`.
  - name: Billable Metrics
    description: >-
      A `Billable Metric` defines a measurable quantity tied to a `Product`'s
      consumption. Each metric stores details including its label, an
      explanatory description, and measurement units.
  - name: Grants
    description: >-
      Grants credit a customer's metered entitlement balance. Merchants can
      create grants directly or void existing ones.


      Use `GET /v1/entitlements?customerId={id}` or `GET
      /v1/entitlements?subscriptionId={id}` to find the metered entitlement `id`
      needed for these endpoints.
  - name: Features
    description: >-
      A `Feature` represents a specific capability or functionality provided by
      a `Product`. Features can be metered (usage-based), static (fixed
      allocation), or boolean (enabled/disabled).
  - name: Fees
    description: >-
      A `Fee` defines a recurring or one-time charge tied to a `Product`. Fees
      are linked to prices, and cadence is defined on the Price.
  - name: Plans
    description: >-
      A `Plan` links a collection of `Prices` to a `Product`. It functions as a
      pricing structure document for a particular feature set or service
      offering.
  - name: Prices
    description: >-
      A `Price` determines the monetary value for a single unit of a `Billable
      Metric`. Prices are exclusively grouped within a `Plan`.
  - name: PricingUnits
    description: >-
      A `PricingUnit` is a merchant-scoped catalog object that names a credit
      denomination and the rate (`conversionRate`) at which it converts to an
      invoicing `currency`. Credit-denominated prices draw a customer's balance
      for the unit; the unit holds no balance itself.
  - name: CreditPools
    description: >-
      A `CreditPool` is the `(customer, pricingUnit)` identity that
      credit-denominated prices draw down. The balance itself lives on grants,
      not on the pool; the pool survives subscription changes. There is one pool
      per `(customer, pricingUnit)`.
  - name: Products
    description: >-
      A `Product` is an offering sold by a `Merchant`. It includes product
      metadata like title, summary, and pricing details. `Plans`, `Prices`, and
      `Subscriptions` are all associated with products.
  - name: Sources
    description: >-
      A `Source` is an external data provider capable of automatically creating
      usage events. Configuration occurs at the plan level, enabling data
      retrieval from third-party platforms such as Stripe to produce billable
      events.
  - name: Subscriptions
    description: >-
      A `Subscription` is a customer's commitment to purchase a `Product`
      following the terms of a `Plan` and its linked `Prices`.
  - name: Subscription Proposals
    description: >-
      A `SubscriptionProposal` holds the values of a subscription until a person
      on your team approves or rejects it. Nothing is billed while it waits.
  - name: Contracts
    description: >-
      A `Contract` is a set of priced lines with a fixed term, owned by one
      customer and billed in one currency. Every contract, and every change to
      it, is approved before it bills.
  - name: Users
    description: >-
      A `User` is an entity granted access to an Organization's resources. All
      operations are performed by users.
  - name: Invoices V2
    description: >-
      Invoice V2 operations supporting billing cycles organized by time periods.
      Warning: v0 invoice endpoints are no longer supported.
  - name: Revenue
    description: Revenue data from invoices and payments
  - name: Profitability
    description: Per-customer profitability summaries
  - name: Test Clocks
    description: >-
      Test clocks provide programmable time control to simulate subscription and
      billing scenarios during testing.
  - name: Merchant Data
    description: Reset a merchant's data outside production
  - name: Events
    description: Ingest raw metering events that are processed by the meters service.
  - name: Payments
    description: >-
      Create and manage one-off payments. A payment represents a single charge
      that a merchant wants to collect from a customer.
  - name: Payment Sessions
    description: >-
      Handle payment session lifecycle and processing across various entity
      types including invoices and subscriptions
  - name: Costs
    description: >-
      A Cost represents the operational or infrastructure expense of serving
      customers for a given product. Costs are metered (driven by event-based
      usage) and are tracked in parallel with billable metrics to give merchants
      visibility into both revenue and cost per customer.
  - name: ExternalReferences
    description: >-
      An `ExternalReference` links a Paygentic entity (e.g. an `Item`) to a
      record in an external system such as Salesforce or NetSuite. Multiple
      external records may map to the same Paygentic entity, but each external
      id is the *primary* reference of at most one entity per merchant.
  - name: Items
    description: >-
      An `Item` is the canonical "thing you sell" that external-system mappings
      point at. It is fully decoupled from the billing `Product` and holds no
      pricing/plan/metering, and it is CRM/ERP agnostic — which providers map to
      it lives entirely in its `ExternalReference` rows.
  - name: MerchantIntegrations
    description: >-
      A `MerchantIntegration` records a merchant's connection to an external
      provider. One connection per `(merchant, provider)` — re-connecting
      upserts in place.
  - name: Approvals
    description: Submit, decide, cancel, and read maker-checker approvals.
  - name: Orders
    description: Manage Orders, their line items, and billing schedules.
  - name: Billing Schedules
    description: >-
      Owner-polymorphic billing schedules with intervals and staged invoice
      projections. A BillingSchedule belongs to exactly one Order or one
      Subscription (XOR). Cadence lives on ScheduleIntervals
      (cadence-on-the-line).
  - name: Webhooks
    description: >-
      Endpoints for setting up webhook integrations and administering webhook
      settings
  - name: Me
    description: 'The caller: who it is in its active organization and what it can do'
paths:
  /v0/contracts/{id}/projected:
    get:
      tags:
        - Contracts
      summary: Projected invoices
      description: >-
        Returns the invoices the contract would produce, grouped as the invoice
        collector groups them, and writes nothing. It reads the pending change
        when one waits for approval and the contract in force otherwise. From a
        line's next billing moment a pending change shows its new amounts;
        before it, the amounts of the contract in force. An invoice is one
        customer, currency, `autoCharge`, `bankTransferOnly`,
        `autoApprove.invoices`, invoice date and charge date, so a renewal
        invoiced early is apart from usage charged on the same day. The dates
        read on the customer's clock: an invoice date that has passed is shown
        as now. A metered line shows its rate in `unitPrice` and has no
        `quantity` or `subtotal` until the usage is measured. `paymentTermDays`
        is the larger of the customer's term (else the merchant's) and the days
        from the invoice date to the charge date. A rejected contract has no
        invoices. A draft with content no invoice can be generated from answers
        400 `CONTRACT_LINE_NOT_PROJECTABLE`.
      operationId: getContractProjected
      parameters:
        - in: path
          name: id
          required: true
          schema:
            type: string
          description: The contract ID.
        - in: query
          name: limit
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
          description: Number of invoices to return.
        - in: query
          name: offset
          schema:
            type: integer
            minimum: 0
            default: 0
          description: Number of invoices to skip.
      responses:
        '200':
          description: The projected invoices, earliest first
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - pagination
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/ContractProjectedInvoice'
                  pagination:
                    $ref: '#/components/schemas/OffsetPagination'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ContractProjectedInvoice:
      type: object
      description: An invoice the contract would produce. It does not exist yet.
      required:
        - invoiceAt
        - chargeDate
        - dueAt
        - paymentTermDays
        - currency
        - autoCharge
        - bankTransferOnly
        - autoApproveInvoices
        - lineItems
      properties:
        invoiceAt:
          type: string
          format: date-time
          description: When the invoice is raised.
        chargeDate:
          type: string
          format: date-time
          description: When every line item on the invoice is due, before the payment term.
        dueAt:
          type: string
          format: date-time
          description: The invoice date plus `paymentTermDays`, at the start of a UTC day.
        paymentTermDays:
          type: integer
          description: >-
            The larger of the customer's term, else the merchant's, and the days
            from the invoice date to the charge date.
        currency:
          type: string
        autoCharge:
          type: boolean
        bankTransferOnly:
          type: boolean
        autoApproveInvoices:
          type: boolean
          description: >-
            Whether the invoice skips DRAFT: the contract's
            `autoApprove.invoices`.
        lineItems:
          type: array
          items:
            $ref: '#/components/schemas/ContractProjectedLineItem'
    OffsetPagination:
      type: object
      description: Offset-based pagination response.
      properties:
        limit:
          type: integer
          description: Requested page size.
        offset:
          type: integer
          description: Number of items skipped.
        total:
          type: integer
          description: Total number of items available.
      required:
        - limit
        - offset
        - total
    ContractProjectedLineItem:
      type: object
      description: A line item of a projected invoice.
      required:
        - contractLineId
        - contractVersion
        - itemId
        - type
        - displayName
        - description
        - periodStart
        - periodEnd
        - paymentTerm
        - quantity
        - unitPrice
        - subtotal
        - upliftFactor
      properties:
        contractLineId:
          type: string
        contractVersion:
          type: integer
          description: The version of the contract the line item is generated from.
        itemId:
          type:
            - string
            - 'null'
        type:
          type: string
          enum:
            - fee
            - metered
        displayName:
          type: string
        description:
          type:
            - string
            - 'null'
        periodStart:
          type: string
          format: date-time
        periodEnd:
          type: string
          format: date-time
        paymentTerm:
          type: string
          enum:
            - in_advance
            - in_arrears
        quantity:
          type:
            - string
            - 'null'
          description: Null on a metered line until its usage is measured.
        unitPrice:
          type:
            - string
            - 'null'
          description: >-
            The rate, with the uplift applied. Null on usage priced when it
            closes.
        subtotal:
          type:
            - string
            - 'null'
          description: Null on a metered line until its usage is measured.
        upliftFactor:
          type: string
          description: What the line's rate is multiplied by in this window.
    Error:
      type: object
      required:
        - message
      properties:
        error:
          type: string
          description: >-
            Coarse HTTP error category (e.g. 'bad_request', 'forbidden'). Maps
            to the HTTP status code.
        message:
          type: string
          description: >-
            Human-readable error message. Clients must not parse this field
            programmatically.
        code:
          type: string
          examples:
            - TAX_NOT_ENABLED
            - PAYMENT_SESSION_EXPIRED
          description: >-
            Optional semantic business error code for machine-readable
            discrimination (e.g. 'TAX_NOT_ENABLED'). UPPER_SNAKE_CASE. Clients
            should check this field, not message.
        details:
          type: object
          description: Additional error details
          additionalProperties: true
        reason:
          $ref: '#/components/schemas/AuthorizationDenialReason'
        requiredPermissions:
          type: array
          items:
            type: string
          description: >-
            Present on a 403 from the authorization check. The permissions the
            caller needs for this request.
        requestId:
          $ref: '#/components/schemas/RequestId'
      example:
        message: The requested resource was not found
        error: not_found
    ValidationError:
      type: object
      required:
        - message
        - errors
      properties:
        error:
          type: string
          enum:
            - validation_error
          default: validation_error
          description: Error type indicating validation failure
        message:
          type: string
          description: Human-readable error message
        errors:
          type: array
          items:
            type: object
            properties:
              field:
                type: string
                description: The field that failed validation
              message:
                type: string
                description: Validation error message for this field
              code:
                type: string
                description: Validation error code
            required:
              - field
              - message
          description: Array of field-specific validation errors
        requestId:
          $ref: '#/components/schemas/RequestId'
      example:
        message: Validation failed
        error: validation_error
        errors:
          - field: email
            message: Invalid email format
            code: invalid_format
    AuthorizationDenialReason:
      type: string
      enum:
        - no_permission
        - insufficient_scope
        - not_member
      description: >-
        Present on a 403 from the authorization check. Says why access was
        refused: the caller has no role that grants the permission, the OAuth
        token lacks the scope, or the caller is not a member of the
        organization.
    RequestId:
      type: string
      description: >-
        Identifies this request in our logs. Include it when you contact
        support. Also sent in the `request-id` response header.
      examples:
        - 105445aa7843bc8bf206b12000100000
  responses:
    BadRequest:
      description: >-
        Bad Request - The request could not be understood or was missing
        required parameters
      content:
        application/json:
          schema:
            oneOf:
              - $ref: '#/components/schemas/Error'
              - $ref: '#/components/schemas/ValidationError'
    Unauthorized:
      description: Unauthorized - Authentication failed or user does not have permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: Forbidden - Request is understood but refused
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Not Found - The requested resource could not be found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalServerError:
      description: Internal Server Error - Something went wrong on the server side
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: API key authentication

````

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