> ## 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.

# Create

> Creates a contract as a draft for a customer of your merchant. Nothing is billed until the contract is approved. Both `autoApprove` values are required, with no default. A customer, item, billable metric or plan version of another merchant answers 404, and nothing is written.

With an `externalReference`, a create finds the contract that record already has. When there is one, the response is that contract, with status 200, and nothing is created. Sends of one record are handled one at a time. When two sends arrive together and the second waits too long for the first, it answers 409 `TRANSIENT_CONTENTION`: that is not a completed send, so send it again. A new contract answers 201.

With `autoApprove.contract: true`, the create needs the `contracts:approve` permission and answers 403 without it. A valid contract is then approved in the same request. When it is not valid, the contract stays a draft and `validation` lists the errors.



## OpenAPI

````yaml /openapi.json post /v0/contracts
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:
    post:
      tags:
        - Contracts
      summary: Create
      description: >-
        Creates a contract as a draft for a customer of your merchant. Nothing
        is billed until the contract is approved. Both `autoApprove` values are
        required, with no default. A customer, item, billable metric or plan
        version of another merchant answers 404, and nothing is written.


        With an `externalReference`, a create finds the contract that record
        already has. When there is one, the response is that contract, with
        status 200, and nothing is created. Sends of one record are handled one
        at a time. When two sends arrive together and the second waits too long
        for the first, it answers 409 `TRANSIENT_CONTENTION`: that is not a
        completed send, so send it again. A new contract answers 201.


        With `autoApprove.contract: true`, the create needs the
        `contracts:approve` permission and answers 403 without it. A valid
        contract is then approved in the same request. When it is not valid, the
        contract stays a draft and `validation` lists the errors.
      operationId: createContract
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContractCreate'
      responses:
        '200':
          description: The record already had this contract. Nothing was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contract'
        '201':
          description: The contract was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Contract'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            The `code` field gives the cause.
            `CONTRACT_REFERENCE_CUSTOMER_MISMATCH`: the `externalReference`
            already has a contract for another customer of your merchant, and
            nothing is written. `TRANSIENT_CONTENTION`: another create of the
            same record was in progress; send the request again.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: conflict
                message: The record already has a contract for another customer
                code: CONTRACT_REFERENCE_CUSTOMER_MISMATCH
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    ContractCreate:
      type: object
      additionalProperties: false
      required:
        - customerId
        - currency
        - name
        - contractStart
        - contractEnd
        - autoCharge
        - bankTransferOnly
        - autoApprove
        - lines
      properties:
        customerId:
          $ref: '#/components/schemas/CustomerId'
        currency:
          type: string
          pattern: ^[A-Z]{3}$
          description: >-
            The contract's currency, as an ISO 4217 code. It cannot change after
            create.
        name:
          type: string
          minLength: 1
        contractStart:
          type: string
          format: date-time
        contractEnd:
          type: string
          format: date-time
        billingAnchor:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            The date the contract's billing cycles are counted from. Null: the
            contract start.
        billingStartsAt:
          type:
            - string
            - 'null'
          format: date-time
          description: 'The date billing starts. Null: the contract start.'
        upliftPercent:
          type:
            - string
            - 'null'
          pattern: ^\d+(\.\d+)?$
          description: The yearly price uplift, in percent.
        note:
          type:
            - string
            - 'null'
        autoCharge:
          type: boolean
          description: Charge the invoices with the customer's stored payment method.
        bankTransferOnly:
          type: boolean
          description: Pay the invoices by bank transfer only.
        autoApprove:
          $ref: '#/components/schemas/ContractAutoApprove'
        lines:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/ContractItemLineEntry'
              - $ref: '#/components/schemas/ContractPlanVersionLineEntry'
          description: The contract's lines. Every entry is a new line.
        externalReference:
          $ref: '#/components/schemas/ContractExternalReference'
    Contract:
      type: object
      description: >-
        A set of priced lines with a fixed term, owned by one customer and
        billed in one currency. The fields show the version in force: the last
        approved one, or the draft while nothing is approved yet. A change that
        waits for approval is in `pendingChange`.
      required:
        - id
        - object
        - merchantId
        - customerId
        - currency
        - status
        - createdAt
        - externalReference
        - name
        - contractStart
        - contractEnd
        - billingAnchor
        - billingStartsAt
        - upliftPercent
        - note
        - autoCharge
        - bankTransferOnly
        - autoApprove
        - terminatedAt
        - terminationReason
        - lines
        - updatedAt
        - createdByPrincipalId
        - pendingChange
        - decidedAt
        - decidedByPrincipalId
        - rejectReason
        - rejectText
      properties:
        id:
          $ref: '#/components/schemas/ContractId'
        object:
          type: string
          enum:
            - contract
        merchantId:
          $ref: '#/components/schemas/OrganizationId'
        customerId:
          $ref: '#/components/schemas/CustomerId'
        currency:
          type: string
        status:
          $ref: '#/components/schemas/ContractStatus'
        createdAt:
          type: string
          format: date-time
          description: >-
            When the contract was first written: the `createdAt` of its first
            version. It does not change when a version is approved or changed.
        externalReference:
          anyOf:
            - $ref: '#/components/schemas/ContractExternalReference'
            - type: 'null'
        name:
          type: string
        contractStart:
          type: string
          format: date-time
        contractEnd:
          type: string
          format: date-time
        billingAnchor:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the contract's billing cycles are counted from.
        billingStartsAt:
          type:
            - string
            - 'null'
          format: date-time
          description: The date billing starts, when it is not the contract start.
        upliftPercent:
          type:
            - string
            - 'null'
          description: The yearly price uplift, in percent.
        note:
          type:
            - string
            - 'null'
        autoCharge:
          type: boolean
        bankTransferOnly:
          type: boolean
        autoApprove:
          $ref: '#/components/schemas/ContractAutoApprove'
        terminatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the contract was ended early.
        terminationReason:
          type:
            - string
            - 'null'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ContractLine'
        updatedAt:
          type: string
          format: date-time
          description: >-
            When this version last changed. Send it back as `basedOnUpdatedAt`
            to edit it.
        createdByPrincipalId:
          type:
            - string
            - 'null'
        pendingChange:
          anyOf:
            - $ref: '#/components/schemas/ContractPendingChange'
            - type: 'null'
          description: >-
            The change that waits for a decision, in the same shape as the
            contract.
        decidedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the version in force was approved or rejected.
        decidedByPrincipalId:
          type:
            - string
            - 'null'
        rejectReason:
          type:
            - string
            - 'null'
        rejectText:
          type:
            - string
            - 'null'
        validation:
          type: array
          items:
            $ref: '#/components/schemas/ContractValidationError'
          description: >-
            The reasons the draft or pending change cannot be approved. Empty
            when it can, or when nothing waits. Present on the answer to one
            contract, not on a list.
        conflicts:
          type: array
          items:
            $ref: '#/components/schemas/ContractConflictWarning'
          description: >-
            Where the draft or pending change shares an item or a billable
            metric with another live contract of the customer. Present on the
            answer to one contract, not on a list.
    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
    CustomerId:
      type: string
      pattern: ^cus_[a-zA-Z0-9]+$
      description: Unique identifier for a customer
    ContractAutoApprove:
      type: object
      required:
        - contract
        - invoices
      additionalProperties: false
      description: >-
        Two separate choices. `contract`: approve the contract, and each change
        to it, when it is written. It needs the `contracts:approve` permission.
        `invoices`: approve its invoices when they are collected.
      properties:
        contract:
          type: boolean
        invoices:
          type: boolean
    ContractItemLineEntry:
      type: object
      required:
        - itemId
        - price
        - billingCadence
        - paymentTerm
      additionalProperties: false
      description: >-
        A new line priced in the request. The line is a fee line when the item
        has no billable metric, and a metered line when it has one.
      properties:
        itemId:
          type: string
          pattern: ^itm_[a-zA-Z0-9]+$
          description: The item the line sells. It must belong to your merchant.
        price:
          $ref: '#/components/schemas/ContractLinePrice'
        billingCadence:
          type: string
          description: >-
            How often the line bills, as an ISO 8601 duration, for example `P1M`
            or `P1Y`.
        paymentTerm:
          $ref: '#/components/schemas/ContractPaymentTerm'
        billableMetricId:
          type: string
          pattern: ^bm_[a-zA-Z0-9]+$
          description: >-
            The billable metric the line bills. Leave it out for an item with
            one metric or none: a metric the item carries is taken, and an item
            without one gives a fee line. Name it when the item carries several.
        quantity:
          type: string
          pattern: ^\d{1,12}(\.\d{1,8})?$
          description: >-
            How many units the rate applies to. A fee line is charged rate times
            quantity. Defaults to 1.
          examples:
            - '3'
        billDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The date of the line's one-time charge, when it has one.
        startDate:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            The line starts billing on this date. Null: it starts with the
            contract.
        endDate:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            The line stops billing on this date. Null: it ends with the
            contract.
        billingAnchor:
          type:
            - string
            - 'null'
          format: date-time
          description: >-
            The date the line's billing cycle is counted from. Null: the
            contract's anchor.
        invoiceOffsetDays:
          type:
            - integer
            - 'null'
          minimum: -3650
          maximum: 3650
          description: >-
            Days before the charge date to invoice it, from -3650 to 3650. Null:
            invoice on the charge date.
        featureId:
          type:
            - string
            - 'null'
          description: The feature the line grants, when it grants one.
        entitlementTemplate:
          type:
            - object
            - 'null'
          additionalProperties: true
          description: The entitlement the line grants, as a plan price states it.
        invoiceDisplayName:
          type: string
          description: The line's name on the invoice. Defaults to the item's name.
        description:
          type:
            - string
            - 'null'
          description: Free text shown with the line.
        invoiceDisplayGroup:
          type:
            - string
            - 'null'
          description: Lines with the same group are shown together on the invoice.
        rateType:
          $ref: '#/components/schemas/ContractRateType'
        supplyScope:
          $ref: '#/components/schemas/ContractSupplyScope'
        outsideScopeLabel:
          type:
            - string
            - 'null'
          description: The label of an outside-scope supply on the invoice.
    ContractPlanVersionLineEntry:
      type: object
      required:
        - planVersionId
      additionalProperties: false
      description: >-
        One new line for each price of the plan version. A line copies the
        price's model, rate, cadence, payment term, display fields and
        entitlement template, and does not follow later changes to the plan.
      properties:
        planVersionId:
          type: string
          description: The plan version to copy. It must belong to your merchant.
    ContractExternalReference:
      type: object
      required:
        - provider
        - externalId
      additionalProperties: false
      description: >-
        The record in another system, such as a CRM deal, that the contract
        comes from. A create that names a record that already has a contract
        returns that contract and creates nothing.
      properties:
        provider:
          $ref: '#/components/schemas/Provider'
        externalId:
          $ref: '#/components/schemas/ExternalId'
    ContractId:
      type: string
      pattern: ^ctr_[a-zA-Z0-9]+$
      description: Unique identifier for a contract.
    OrganizationId:
      type: string
      pattern: ^org_[a-zA-Z0-9]+$
      description: Unique identifier for an organization
    ContractStatus:
      type: string
      enum:
        - draft
        - rejected
        - scheduled
        - active
        - ended
      x-speakeasy-unknown-values: allow
      description: >-
        `draft` and `rejected` hold while the contract was never approved. After
        approval the status follows the dates, on the customer's clock:
        `scheduled` before `contractStart`, `active` from it, and `ended` once
        `contractEnd` or `terminatedAt` has passed.
    ContractLine:
      type: object
      description: >-
        A line of a contract as stored: the rate, the quantity and the dates it
        bills on.
      required:
        - id
        - itemId
        - billableMetricId
        - copiedFromPriceId
        - price
        - quantity
        - billingCadence
        - paymentTerm
        - billDate
        - startDate
        - endDate
        - billingAnchor
        - invoiceOffsetDays
        - featureId
        - entitlementTemplate
        - invoiceDisplayName
        - description
        - invoiceDisplayGroup
        - rateType
        - supplyScope
        - outsideScopeLabel
      properties:
        id:
          $ref: '#/components/schemas/ContractLineId'
        itemId:
          type:
            - string
            - 'null'
          pattern: ^itm_[a-zA-Z0-9]+$
          description: The item the line sells.
        billableMetricId:
          type:
            - string
            - 'null'
          description: The billable metric a metered line bills. Null for a fee line.
        copiedFromPriceId:
          type:
            - string
            - 'null'
          description: >-
            The plan price the line was copied from, for display only. The line
            does not follow later changes to that price.
        price:
          $ref: '#/components/schemas/ContractLinePrice'
        quantity:
          type: string
        billingCadence:
          type: string
        paymentTerm:
          $ref: '#/components/schemas/ContractPaymentTerm'
        billDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The date of the line's one-time charge.
        startDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the line starts billing.
        endDate:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the line stops billing.
        billingAnchor:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the line's billing cycle is counted from.
        invoiceOffsetDays:
          type:
            - integer
            - 'null'
        featureId:
          type:
            - string
            - 'null'
        entitlementTemplate:
          type:
            - object
            - 'null'
          additionalProperties: true
        invoiceDisplayName:
          type: string
        description:
          type:
            - string
            - 'null'
        invoiceDisplayGroup:
          type:
            - string
            - 'null'
        rateType:
          $ref: '#/components/schemas/ContractRateType'
        supplyScope:
          $ref: '#/components/schemas/ContractSupplyScope'
        outsideScopeLabel:
          type:
            - string
            - 'null'
    ContractPendingChange:
      type: object
      description: >-
        A change to an approved contract that waits for a decision. It has the
        same fields as the contract, with the values the change would give.
      required:
        - name
        - contractStart
        - contractEnd
        - billingAnchor
        - billingStartsAt
        - upliftPercent
        - note
        - autoCharge
        - bankTransferOnly
        - autoApprove
        - terminatedAt
        - terminationReason
        - lines
        - updatedAt
        - createdByPrincipalId
      properties:
        name:
          type: string
        contractStart:
          type: string
          format: date-time
        contractEnd:
          type: string
          format: date-time
        billingAnchor:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the contract's billing cycles are counted from.
        billingStartsAt:
          type:
            - string
            - 'null'
          format: date-time
          description: The date billing starts, when it is not the contract start.
        upliftPercent:
          type:
            - string
            - 'null'
          description: The yearly price uplift, in percent.
        note:
          type:
            - string
            - 'null'
        autoCharge:
          type: boolean
        bankTransferOnly:
          type: boolean
        autoApprove:
          $ref: '#/components/schemas/ContractAutoApprove'
        terminatedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: The date the contract was ended early.
        terminationReason:
          type:
            - string
            - 'null'
        lines:
          type: array
          items:
            $ref: '#/components/schemas/ContractLine'
        updatedAt:
          type: string
          format: date-time
          description: >-
            When this version last changed. Send it back as `basedOnUpdatedAt`
            to edit it.
        createdByPrincipalId:
          type:
            - string
            - 'null'
    ContractValidationError:
      type: object
      description: One reason the version that waits cannot be approved.
      required:
        - scope
        - code
        - message
      properties:
        scope:
          type: string
          enum:
            - contract
            - line
          title: ContractValidationErrorScope
        code:
          type: string
          description: >-
            For example `LINE_ITEM_ARCHIVED`, `LINE_DATES_OUTSIDE_TERM` or
            `CONTRACT_RETILE_NOT_AVAILABLE`.
        lineId:
          $ref: '#/components/schemas/ContractLineId'
        field:
          type: string
          description: The field to change.
        allowedDates:
          type: array
          items:
            type: string
            format: date-time
          description: >-
            On `LINE_TERM_END_NOT_ON_WINDOW_BOUNDARY`, the two dates either side
            of the term end that a window boundary allows.
        message:
          type: string
    ContractConflictWarning:
      type: object
      description: >-
        A line that shares an item or a billable metric with a line of another
        live contract of the customer. It never stops an approval.
      required:
        - code
        - lineId
        - otherContractId
        - otherLineId
        - message
      properties:
        code:
          type: string
          enum:
            - ITEM_ON_OTHER_LIVE_CONTRACT
            - METRIC_ON_OTHER_LIVE_CONTRACT
          title: ContractConflictWarningCode
        lineId:
          $ref: '#/components/schemas/ContractLineId'
        otherContractId:
          $ref: '#/components/schemas/ContractId'
        otherLineId:
          $ref: '#/components/schemas/ContractLineId'
        itemId:
          type: string
        billableMetricId:
          type: string
        message:
          type: string
    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
    ContractLinePrice:
      type: object
      required:
        - model
        - properties
      additionalProperties: false
      description: >-
        How the line is priced: a pricing model and its properties, for example
        `standard` with `unitPrice`.
      properties:
        model:
          type: string
          description: The pricing model, for example `standard`.
        properties:
          type: object
          additionalProperties: true
          description: >-
            The model's properties. A rate is a decimal string, for example `{
            "unitPrice": "1000" }`.
    ContractPaymentTerm:
      type: string
      enum:
        - in_advance
        - in_arrears
      x-speakeasy-unknown-values: allow
      description: >-
        `in_advance` charges a period when it starts. `in_arrears` charges it
        when it ends.
    ContractRateType:
      type: string
      enum:
        - amount
        - proportion
      x-speakeasy-unknown-values: allow
      description: >-
        `amount` is a rate in currency. `proportion` is a share of another
        amount.
    ContractSupplyScope:
      type: string
      enum:
        - IN_SCOPE
        - OUTSIDE_SCOPE
      x-speakeasy-unknown-values: allow
      description: Whether the supply is in the scope of tax.
    Provider:
      type: string
      pattern: ^[a-z][a-z0-9_]*$
      maxLength: 64
      description: Lowercase snake_case provider identifier (e.g. `salesforce`, `netsuite`)
    ExternalId:
      type: string
      pattern: ^[a-zA-Z0-9_-]+$
      maxLength: 255
      description: >-
        Optional external identifier for cross-referencing with external
        systems. Alphanumeric characters, hyphens, and underscores only.
    ContractLineId:
      type: string
      pattern: ^ctrl_[a-zA-Z0-9]+$
      description: >-
        Unique identifier for a contract line. It stays the same in every
        version of the contract.
  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.