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

# Preview obligation accounts

> Preview, for each product of an obligation, the revenue, deferred and unbilled revenue accounts its contract schedules would post to under a revenue policy's scope and the accounting rule each comes from, without writing anything.



## OpenAPI

````yaml post /v1/accounting/revenue-policies/accounts-preview
openapi: 3.1.0
info:
  title: Hyperline API
  version: 0.0.0
servers:
  - url: https://api.hyperline.co
  - url: https://sandbox.api.hyperline.co
security: []
paths:
  /v1/accounting/revenue-policies/accounts-preview:
    post:
      tags:
        - Accounting > Revenue policies
      summary: Preview obligation accounts
      description: >-
        Preview, for each product of an obligation, the revenue, deferred and
        unbilled revenue accounts its contract schedules would post to under a
        revenue policy's scope and the accounting rule each comes from, without
        writing anything.
      operationId: previewRevenuePolicyObligationAccounts
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                ledger_id:
                  type: string
                  minLength: 1
                  description: ID of the ledger the record belongs to.
                  example: led_8Hq2nZ0kLm4x1P
                product_ids:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  minItems: 1
                  maxItems: 100
                  description: Products of the obligation to preview, at most 100.
                  example:
                    - itm_4Ha7Gk2Lm9xQ1z
                customer_ids:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  description: >-
                    Customers the policy is scoped to (its
                    `match_conditions.customer_ids`); omitted or empty: any
                    customer.
                currencies:
                  type: array
                  items:
                    type: string
                    enum:
                      - EUR
                      - AED
                      - AFN
                      - XCD
                      - ALL
                      - AMD
                      - AOA
                      - ARS
                      - USD
                      - AUD
                      - AWG
                      - AZN
                      - BAM
                      - BBD
                      - BDT
                      - BGN
                      - BHD
                      - BIF
                      - XOF
                      - BMD
                      - BND
                      - BOB
                      - BRL
                      - BSD
                      - BTN
                      - NOK
                      - BWP
                      - BYR
                      - BZD
                      - CAD
                      - CDF
                      - XAF
                      - CHF
                      - NZD
                      - CLP
                      - CNY
                      - COP
                      - CRC
                      - CUP
                      - CVE
                      - ANG
                      - CZK
                      - DJF
                      - DKK
                      - DOP
                      - DZD
                      - EGP
                      - MAD
                      - ERN
                      - ETB
                      - FJD
                      - FKP
                      - GBP
                      - GEL
                      - GHS
                      - GIP
                      - GMD
                      - GNF
                      - GTQ
                      - GYD
                      - HKD
                      - HNL
                      - HRK
                      - HTG
                      - HUF
                      - IDR
                      - ILS
                      - INR
                      - IQD
                      - IRR
                      - ISK
                      - JMD
                      - JOD
                      - JPY
                      - KES
                      - KGS
                      - KHR
                      - KMF
                      - KPW
                      - KRW
                      - KWD
                      - KYD
                      - KZT
                      - LAK
                      - LBP
                      - LKR
                      - LRD
                      - LSL
                      - LYD
                      - MDL
                      - MGA
                      - MKD
                      - MMK
                      - MNT
                      - MOP
                      - MRO
                      - MUR
                      - MVR
                      - MWK
                      - MXN
                      - MYR
                      - MZN
                      - NAD
                      - XPF
                      - NGN
                      - NIO
                      - NPR
                      - OMR
                      - PAB
                      - PEN
                      - PGK
                      - PHP
                      - PKR
                      - PLN
                      - PYG
                      - QAR
                      - RON
                      - RSD
                      - RUB
                      - RWF
                      - SAR
                      - SBD
                      - SCR
                      - SDG
                      - SEK
                      - SGD
                      - SHP
                      - SLL
                      - SOS
                      - SRD
                      - SSP
                      - STD
                      - SYP
                      - SZL
                      - THB
                      - TJS
                      - TMT
                      - TND
                      - TOP
                      - TRY
                      - TTD
                      - TWD
                      - TZS
                      - UAH
                      - UGX
                      - UYU
                      - UZS
                      - VEF
                      - VND
                      - VUV
                      - WST
                      - YER
                      - ZAR
                      - ZMW
                      - ZWL
                    description: >-
                      Currency code. See [ISO
                      4217](https://en.wikipedia.org/wiki/ISO_4217#List_of_ISO_4217_currency_codes).
                    example: EUR
                  description: >-
                    Currencies the policy is scoped to (its
                    `match_conditions.currencies`); omitted or empty: any
                    currency.
                countries:
                  type: array
                  items:
                    type: string
                    enum:
                      - AD
                      - AE
                      - AF
                      - AG
                      - AI
                      - AL
                      - AM
                      - AO
                      - AQ
                      - AR
                      - AS
                      - AT
                      - AU
                      - AW
                      - AX
                      - AZ
                      - BA
                      - BB
                      - BD
                      - BE
                      - BG
                      - BH
                      - BI
                      - BJ
                      - BL
                      - BM
                      - BN
                      - BO
                      - BQ
                      - BR
                      - BS
                      - BT
                      - BF
                      - BV
                      - BW
                      - BY
                      - BZ
                      - CA
                      - CC
                      - CD
                      - CF
                      - CG
                      - CH
                      - CI
                      - CK
                      - CL
                      - CM
                      - CN
                      - CO
                      - CR
                      - CU
                      - CV
                      - CW
                      - CX
                      - CY
                      - CZ
                      - DE
                      - DJ
                      - DK
                      - DM
                      - DO
                      - DZ
                      - EC
                      - EE
                      - EG
                      - EH
                      - ER
                      - ES
                      - ES-CE
                      - ES-ML
                      - ET
                      - FI
                      - FJ
                      - FK
                      - FM
                      - FO
                      - FR
                      - GA
                      - GB
                      - GD
                      - GE
                      - GF
                      - GG
                      - GH
                      - GI
                      - GL
                      - GM
                      - GN
                      - GP
                      - GQ
                      - GR
                      - GS
                      - GT
                      - GU
                      - GW
                      - GY
                      - HK
                      - HM
                      - HN
                      - HR
                      - HT
                      - HU
                      - IC
                      - ID
                      - IE
                      - IL
                      - IM
                      - IN
                      - IO
                      - IQ
                      - IR
                      - IS
                      - IT
                      - JE
                      - JM
                      - JO
                      - JP
                      - KE
                      - KG
                      - KH
                      - KI
                      - KM
                      - KN
                      - KP
                      - KR
                      - KW
                      - KY
                      - KZ
                      - LA
                      - LB
                      - LC
                      - LI
                      - LK
                      - LR
                      - LS
                      - LT
                      - LU
                      - LV
                      - LY
                      - MA
                      - MC
                      - MD
                      - ME
                      - MF
                      - MG
                      - MH
                      - MK
                      - ML
                      - MM
                      - MN
                      - MO
                      - MP
                      - MQ
                      - MR
                      - MS
                      - MT
                      - MU
                      - MV
                      - MW
                      - MX
                      - MY
                      - MZ
                      - NA
                      - NC
                      - NE
                      - NF
                      - NG
                      - NI
                      - NL
                      - 'NO'
                      - NP
                      - NR
                      - NU
                      - NZ
                      - OM
                      - PA
                      - PE
                      - PF
                      - PG
                      - PH
                      - PK
                      - PL
                      - PM
                      - PN
                      - PR
                      - PS
                      - PT
                      - PT-20
                      - PT-30
                      - PW
                      - PY
                      - QA
                      - RE
                      - RO
                      - RS
                      - RU
                      - RW
                      - SA
                      - SB
                      - SC
                      - SD
                      - SE
                      - SG
                      - SH
                      - SI
                      - SJ
                      - SK
                      - SL
                      - SM
                      - SN
                      - SO
                      - SR
                      - SS
                      - ST
                      - SV
                      - SX
                      - SY
                      - SZ
                      - TC
                      - TD
                      - TF
                      - TG
                      - TH
                      - TJ
                      - TK
                      - TL
                      - TM
                      - TN
                      - TO
                      - TR
                      - TT
                      - TV
                      - TW
                      - TZ
                      - UA
                      - UG
                      - UM
                      - US
                      - UY
                      - UZ
                      - VA
                      - VC
                      - VE
                      - VG
                      - VI
                      - VN
                      - VU
                      - WF
                      - WS
                      - XK
                      - YE
                      - YT
                      - ZA
                      - ZM
                      - ZW
                    description: >-
                      Two-letter country code in ISO format. See [ISO 3166-1
                      alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2).
                    example: FR
                  description: >-
                    Customer countries the policy is scoped to (its
                    `match_conditions.countries`); omitted or empty: any
                    country.
                default_accounts:
                  allOf:
                    - $ref: '#/components/schemas/RevenuePolicyDefaultAccounts'
                    - description: >-
                        The policy's default accounts (its
                        `config.recognition.default_accounts`), as for an
                        allocated obligation: they fill a Deferred or Unbilled
                        account no rule gives the product. Omitted or null: the
                        rules alone.
              required:
                - ledger_id
                - product_ids
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RevenuePolicyAccountsPreview'
        '400':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '404':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
      security:
        - bearer: []
components:
  schemas:
    RevenuePolicyDefaultAccounts:
      type:
        - object
        - 'null'
      properties:
        deferred_revenue_ledger_account_id:
          type: string
          minLength: 1
          description: >-
            ID of the deferred revenue account an allocated product takes when
            its rules give none. A liability account of the policy's ledger.
        unbilled_revenue_ledger_account_id:
          type: string
          minLength: 1
          description: >-
            ID of the unbilled revenue account an allocated product takes when
            its rules give none. An asset account of the policy's ledger, other
            than the deferred revenue one.
      required:
        - deferred_revenue_ledger_account_id
        - unbilled_revenue_ledger_account_id
      description: >-
        Default Deferred and Unbilled revenue accounts of an allocated product:
        its accounting rules give its Revenue, Deferred and Unbilled accounts,
        and this pair only fills a Deferred or Unbilled account they leave empty
        (a one-off product's, a credit product's Unbilled). Products of one
        contract may post to different Deferred and Unbilled accounts: what the
        contract bills is attributed to them by allocated share. Null: no
        fallback. Kept by a contract term for the version it is assessed under.
    RevenuePolicyAccountsPreview:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/RevenuePolicyProductAccountsPreview'
          description: One answer per product, in no particular order.
      required:
        - data
    RevenuePolicyProductAccountsPreview:
      oneOf:
        - $ref: '#/components/schemas/RevenuePolicyResolvedProductAccounts'
        - $ref: '#/components/schemas/RevenuePolicyVaryingProductAccounts'
        - $ref: '#/components/schemas/RevenuePolicyUnknownProductAccounts'
      discriminator:
        propertyName: status
        mapping:
          resolved: '#/components/schemas/RevenuePolicyResolvedProductAccounts'
          varies: '#/components/schemas/RevenuePolicyVaryingProductAccounts'
          unknown_product: '#/components/schemas/RevenuePolicyUnknownProductAccounts'
    RevenuePolicyResolvedProductAccounts:
      type: object
      properties:
        product_id:
          type: string
          description: ID of the product the record relates to.
          example: itm_4Ha7Gk2Lm9xQ1z
        status:
          type: string
          enum:
            - resolved
          description: >-
            `resolved` when every contract the scope allows resolves the same
            accounts, `varies` when they depend on a customer, currency, country
            or billing interval the scope leaves open, `unknown_product` when no
            product has this identifier.
        accounts:
          type: object
          properties:
            revenue:
              $ref: '#/components/schemas/RevenuePolicyAccountsPreviewAccount'
            deferred:
              allOf:
                - $ref: '#/components/schemas/RevenuePolicyAccountsPreviewAccount'
                - description: >-
                    Deferred revenue account, or null when neither a rule nor
                    the default accounts give one.
            unbilled:
              allOf:
                - $ref: '#/components/schemas/RevenuePolicyAccountsPreviewAccount'
                - description: >-
                    Unbilled revenue account, or null when neither a rule nor
                    the default accounts give one.
          required:
            - revenue
            - deferred
            - unbilled
          description: >-
            Revenue, Deferred and Unbilled accounts the product's contract
            schedules would post to.
        problems:
          type: array
          items:
            type: string
            enum:
              - missing_accounts
              - accounts_not_distinct
            description: A problem of the accounts.
          description: >-
            Why the product cannot be recognized under a policy with these
            accounts: `missing_accounts` (a role has no account) or
            `accounts_not_distinct` (two roles share one account). A contract
            holding it would raise `recognition_rule_incompatible`. Empty when
            the accounts are usable.
      required:
        - product_id
        - status
        - accounts
        - problems
      additionalProperties: false
      title: Resolved
    RevenuePolicyVaryingProductAccounts:
      type: object
      properties:
        product_id:
          type: string
          description: ID of the product the record relates to.
          example: itm_4Ha7Gk2Lm9xQ1z
        status:
          type: string
          enum:
            - varies
          description: >-
            `resolved` when every contract the scope allows resolves the same
            accounts, `varies` when they depend on a customer, currency, country
            or billing interval the scope leaves open, `unknown_product` when no
            product has this identifier.
        dimensions:
          type: array
          items:
            type: string
            enum:
              - customer
              - currency
              - country
              - billing_interval
            description: '`customer`, `currency`, `country` or `billing_interval`.'
          description: >-
            What the scope leaves open that changes the accounts; empty when
            there were too many contracts to tell.
        outcomes:
          type: array
          items:
            type: object
            properties:
              accounts:
                type: object
                properties:
                  revenue:
                    $ref: '#/components/schemas/RevenuePolicyAccountsPreviewAccount'
                  deferred:
                    allOf:
                      - $ref: >-
                          #/components/schemas/RevenuePolicyAccountsPreviewAccount
                      - description: >-
                          Deferred revenue account, or null when neither a rule
                          nor the default accounts give one.
                  unbilled:
                    allOf:
                      - $ref: >-
                          #/components/schemas/RevenuePolicyAccountsPreviewAccount
                      - description: >-
                          Unbilled revenue account, or null when neither a rule
                          nor the default accounts give one.
                required:
                  - revenue
                  - deferred
                  - unbilled
                description: >-
                  Revenue, Deferred and Unbilled accounts the product's contract
                  schedules would post to.
              problems:
                type: array
                items:
                  type: string
                  enum:
                    - missing_accounts
                    - accounts_not_distinct
                  description: A problem of the accounts.
                description: >-
                  Why the product cannot be recognized under a policy with these
                  accounts: `missing_accounts` (a role has no account) or
                  `accounts_not_distinct` (two roles share one account). A
                  contract holding it would raise
                  `recognition_rule_incompatible`. Empty when the accounts are
                  usable.
            required:
              - accounts
              - problems
          description: >-
            The distinct sets of accounts the possible contracts resolve (at
            most 10); empty when there were too many contracts to tell.
      required:
        - product_id
        - status
        - dimensions
        - outcomes
      additionalProperties: false
      title: Varies
    RevenuePolicyUnknownProductAccounts:
      type: object
      properties:
        product_id:
          type: string
          description: ID of the product the record relates to.
          example: itm_4Ha7Gk2Lm9xQ1z
        status:
          type: string
          enum:
            - unknown_product
          description: >-
            `resolved` when every contract the scope allows resolves the same
            accounts, `varies` when they depend on a customer, currency, country
            or billing interval the scope leaves open, `unknown_product` when no
            product has this identifier.
      required:
        - product_id
        - status
      additionalProperties: false
      title: Unknown product
    RevenuePolicyAccountsPreviewAccount:
      type:
        - object
        - 'null'
      properties:
        ledger_account:
          type: object
          properties:
            id:
              type: string
              description: Identifier of the ledger account.
              example: lac_2Lm9xQ1z4Ha7Gk
            code:
              type: string
              description: Code of the ledger account.
              example: '2100'
            name:
              type: string
              description: Name of the ledger account.
              example: Deferred revenue
          required:
            - id
            - code
            - name
          description: Ledger account the role posts to.
        source:
          type: string
          enum:
            - rule
            - policy_default
          description: >-
            `rule` when an accounting rule gives the account, `policy_default`
            when it comes from the policy's default accounts because no rule
            gives one.
        rule:
          type:
            - object
            - 'null'
          properties:
            id:
              type: string
              description: Identifier of the accounting rule.
              example: arl_z4Ha7Gk2Lm9xQ1
            code:
              type: string
              description: Code of the accounting rule.
              example: R-12
            name:
              type:
                - string
                - 'null'
              description: Name of the accounting rule, or null.
          required:
            - id
            - code
            - name
          description: >-
            Accounting rule giving the account, or null when the account comes
            from the default accounts or from different rules across the
            contracts of the outcome.
      required:
        - ledger_account
        - source
        - rule
      description: Revenue account, or null when none is found.
  securitySchemes:
    bearer:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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