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

# Get All Invoices

> Retrieve all invoices links from the database.

[The Invoices Data Model](https://docs.rootfi.dev/api-reference/invoices/overview) is designed to streamline the management and retrieval of invoices information across various payments platforms.


## OpenAPI

````yaml GET /payments/invoices
openapi: 3.0.1
info:
  title: rootfi
  version: v3
servers:
  - url: https://api.rootfi.dev/v3
    description: global
  - url: https://api.sa.rootfi.dev/v3
    description: saudi
security: []
paths:
  /payments/invoices:
    get:
      tags:
        - PaymentsInvoices
      summary: Get All Invoices
      description: Retrieve all invoices links from the database.
      operationId: payments_invoices_list
      parameters:
        - name: limit
          in: query
          description: The number of invoices links you want to retrieve
          required: false
          schema:
            type: integer
            nullable: true
          examples:
            Example1:
              value: 1
        - name: next
          in: query
          description: The next page of objects to retrieve
          required: false
          schema:
            type: string
            nullable: true
          examples:
            Example1:
              value: nhgdfghjgyffcvjhgc==
        - name: prev
          in: query
          description: The previous page of objects to retrieve
          required: false
          schema:
            type: string
            nullable: true
        - name: select
          in: query
          description: >-
            Comma separated fields to select. Supported values are raw_data,
            data_hash
          required: false
          schema:
            type: string
            nullable: true
          examples:
            Example1:
              value: raw_data
        - name: rootfi_updated_at[gte]
          in: query
          description: Filter by rootfi_updated_at Greater than or Equal To.
          required: false
          schema:
            type: string
            nullable: true
        - name: rootfi_company_id[eq]
          in: query
          description: >-
            Filter by rootfi_company_id. You can filter by any field using this
            syntax field_name[operator]
          required: false
          schema:
            type: integer
            nullable: true
        - name: include_deleted_records
          in: query
          description: >-
            Include deleted records. By default, deleted records are not
            included. Supported values are true and false
          required: false
          schema:
            type: string
            nullable: true
          examples:
            Example1:
              value: 'false'
        - name: return_count
          in: query
          description: Return the count of the objects. Supported values are true and false
          required: false
          schema:
            type: string
            nullable: true
          examples:
            Example1:
              value: 'false'
        - name: sort[rootfi_created_at]
          in: query
          description: Sort by rootfi_created_at
          required: false
          schema:
            $ref: '#/components/schemas/SortOrder'
            nullable: true
        - name: sort[rootfi_updated_at]
          in: query
          description: Sort by rootfi_updated_at
          required: false
          schema:
            $ref: '#/components/schemas/SortOrder'
            nullable: true
        - name: expand
          in: query
          description: Comma separated fields to expand. Supported values are raw_data
          required: false
          schema:
            type: string
            nullable: true
          examples:
            Example1:
              value: payment_line_items
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/paymentsGetInvoicesResponse'
              examples:
                Example1:
                  value:
                    data:
                      - rootfi_id: 157
                        rootfi_deleted_at: null
                        rootfi_created_at: '2024-01-22T05:07:31.465Z'
                        rootfi_updated_at: '2024-01-22T05:07:31.000Z'
                        rootfi_company_id: 1089
                        platform_id: '123456_1'
                        platform_unique_id: '123456'
                        contact_id: '123456'
                        currency_id: USD
                        document_number: '123456'
                        posted_date: '2024-01-22T05:07:31.000Z'
                        due_date: '2024-01-22T05:07:31.000Z'
                        status: ACTIVE
                        total_discount: 100
                        sub_total: 100
                        tax_amount: 100
                        total_amount: 100
                        amount_due: 100
                        line_items:
                          - line_item_type_id: '123456'
                            item_id: '123456'
                            tax_id: '123456'
                            description: This is a description
                            quantity: 1
                            unit_amount: 100
                            line_item_type: PAYMENT_INVOICES
                            sub_total: 100
                            tax_amount: 100
                            total_amount: 100
                            total_discount: 100
                            updated_at: '2024-01-22T05:07:31.000Z'
                    prev: eyJyb290ZmlfaWQiOjQ0MDA2MX0=
                    next: eyJyb291ZmlfaWQiOjQ0MDA2MX0=
                    total_count: 123
        '401':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '403':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '404':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
        '500':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RootFiAPIResponseType'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    SortOrder:
      title: SortOrder
      type: string
      enum:
        - ASC
        - DESC
    paymentsGetInvoicesResponse:
      title: paymentsGetInvoicesResponse
      type: object
      description: The data of the payments endpoint.
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/paymentsInvoicesObject'
      required:
        - data
      allOf:
        - $ref: '#/components/schemas/CommonReadResponse'
    RootFiAPIResponseType:
      title: RootFiAPIResponseType
      type: object
      properties:
        error:
          $ref: '#/components/schemas/RootFiAPIResponseErrorType'
          description: The error message
      required:
        - error
    paymentsInvoicesObject:
      title: paymentsInvoicesObject
      type: object
      properties: {}
      allOf:
        - $ref: '#/components/schemas/AccountingRootFiBaseFields'
        - $ref: '#/components/schemas/paymentsInvoicesFields'
    CommonReadResponse:
      title: CommonReadResponse
      type: object
      properties:
        prev:
          type: string
          nullable: true
          description: The previous page of objects to retrieve
        next:
          type: string
          nullable: true
          description: The next page of objects to retrieve
        total_count:
          type: integer
          nullable: true
          description: The total count of the objects
    RootFiAPIResponseErrorType:
      title: RootFiAPIResponseErrorType
      type: object
      properties:
        message:
          type: string
          description: The error message
        code:
          type: string
          description: The error code
        field:
          type: string
          description: The status of the error
      required:
        - message
        - code
        - field
    AccountingRootFiBaseFields:
      title: AccountingRootFiBaseFields
      type: object
      properties:
        rootfi_id:
          type: number
          format: double
          description: The unique ID we assign for that data's information
          example: 157
        rootfi_deleted_at:
          type: string
          format: date-time
          nullable: true
          description: The date at which the data was deleted in the accounting platform
        rootfi_created_at:
          type: string
          format: date-time
          description: The date at which RootFi first synced this data
          example: '2024-01-22T05:07:31.465Z'
        rootfi_updated_at:
          type: string
          format: date-time
          description: The latest date at which RootFi updated this data
          example: '2024-01-22T05:07:31.000Z'
        rootfi_company_id:
          type: number
          format: double
          description: The ID of the company in the accounting platform
          example: 1089
        platform_id:
          type: string
          description: An unique custom RootFi ID made from platform's unique_id.
          example: '123456'
        platform_unique_id:
          type: string
          nullable: true
          description: The ID of the data in the accounting platform.
        raw_data:
          type: object
          additionalProperties: true
          nullable: true
          description: >-
            A JSON containing fields that you can directly get from the
            accounting platform.
        data_hash:
          type: string
          nullable: true
          description: The hash of the data
      required:
        - rootfi_id
        - rootfi_created_at
        - rootfi_updated_at
        - rootfi_company_id
        - platform_id
    paymentsInvoicesFields:
      title: paymentsInvoicesFields
      type: object
      properties:
        contact_id:
          type: string
          nullable: true
          description: >-
            The unique identifier of the customer or contact to whom this
            invoice is issued.
        currency_id:
          type: string
          nullable: true
          description: >-
            The currency code (e.g., USD, EUR, GBP) used for all monetary
            amounts in this invoice.
        document_number:
          type: string
          nullable: true
          description: >-
            The unique reference number or invoice number assigned to this
            invoice for tracking and record-keeping purposes.
        posted_date:
          type: string
          nullable: true
          description: >-
            The ISO 8601 date when this invoice was posted or finalized, marking
            it as an official accounting record.
        due_date:
          type: string
          nullable: true
          description: >-
            The ISO 8601 date by which payment for this invoice is expected to
            be received.
        status:
          type: string
          nullable: true
          description: >-
            The current status of the invoice, indicating its state in the
            payment lifecycle (e.g., DRAFT, SUBMITTED, PAID, OVERDUE, VOID).
        total_discount:
          type: number
          format: double
          nullable: true
          description: >-
            The total amount of all discounts applied to this invoice, reducing
            the final amount owed.
        sub_total:
          type: number
          format: double
          nullable: true
          description: >-
            The sum of all line item amounts before applying taxes, discounts,
            and shipping charges.
        tax_amount:
          type: number
          format: double
          nullable: true
          description: >-
            The total amount of taxes (e.g., VAT, sales tax) applied to this
            invoice.
        total_amount:
          type: number
          format: double
          nullable: true
          description: >-
            The final total amount of the invoice, including all line items,
            taxes, shipping, and discounts.
        amount_due:
          type: number
          format: double
          nullable: true
          description: >-
            The remaining balance that is still owed on this invoice after
            accounting for any payments made.
        shipping_amount:
          type: number
          format: double
          nullable: true
          description: >-
            The cost of shipping or delivery charges included in this invoice,
            if applicable.
        memo:
          type: string
          nullable: true
          description: >-
            Additional notes, comments, or instructions associated with this
            invoice, visible to both the issuer and customer.
        created_at:
          type: string
          nullable: true
          description: >-
            The ISO 8601 timestamp indicating when this invoice was first
            created on the payment platform.
        updated_at:
          type: string
          nullable: true
          description: >-
            The ISO 8601 timestamp indicating when this invoice was last
            modified on the payment platform.
        line_items:
          type: array
          items:
            $ref: '#/components/schemas/PaymentLineItemsFields'
          nullable: true
          description: >-
            An array of line items that detail the individual products,
            services, or charges included in this invoice.
        addresses:
          type: array
          items:
            $ref: '#/components/schemas/paymentsAddresses'
          nullable: true
          description: >-
            An array of addresses associated with this invoice, such as billing
            or shipping addresses.
    PaymentLineItemsFields:
      title: PaymentLineItemsFields
      type: object
      properties:
        line_item_type_id:
          type: string
          nullable: true
          description: The ID of the line item type in the payments platform
        item_id:
          type: string
          nullable: true
          description: The ID of the item in the payments platform
        tax_id:
          type: string
          nullable: true
          description: The ID of the tax in the payments platform
        description:
          type: string
          nullable: true
          description: The description of the line item
        quantity:
          type: number
          format: double
          nullable: true
          description: The quantity of the line item
        unit_amount:
          type: number
          format: double
          nullable: true
          description: The unit amount of the line item
        line_item_type:
          $ref: '#/components/schemas/PaymentLineItemEnum'
          nullable: true
          description: The line item type of the line item
        sub_total:
          type: number
          format: double
          nullable: true
          description: The sub total of the line item
        tax_amount:
          type: number
          format: double
          nullable: true
          description: The tax amount of the line item
        total_amount:
          type: number
          format: double
          nullable: true
          description: The total amount of the line item
        total_discount:
          type: number
          format: double
          nullable: true
          description: The total discount of the line item
        updated_at:
          type: string
          format: date-time
          nullable: true
          description: The last ISO 8601 timestamp that the data was updated at
    paymentsAddresses:
      title: paymentsAddresses
      type: object
      properties:
        rootfi_id:
          type: integer
          nullable: true
          description: The unique RootFi identifier assigned to this address record.
        platform_id:
          type: string
          nullable: true
          description: >-
            The unique identifier for this address on the payment platform,
            typically generated from the platform's unique identifier.
        platform_unique_id:
          type: string
          nullable: true
          description: >-
            An additional unique identifier provided by the payment platform for
            this address.
        type:
          $ref: '#/components/schemas/AddressType'
          nullable: true
          description: >-
            The category of address, indicating its purpose (e.g., SHIPPING for
            delivery addresses, BILLING for payment addresses, COMPANY for
            business addresses).
        data_model_id:
          type: string
          nullable: true
          description: >-
            The identifier of the parent data model (e.g., customer, invoice)
            that this address is associated with.
        street:
          type: string
          nullable: true
          description: The street address line, including building number and street name.
        locality:
          type: string
          nullable: true
          description: The neighborhood, district, or locality within the city or town.
        city:
          type: string
          nullable: true
          description: The city or town name where this address is located.
        state:
          type: string
          nullable: true
          description: The state, province, or region where this address is located.
        pincode:
          type: string
          nullable: true
          description: >-
            The postal code or ZIP code for this address, used for mail delivery
            and location identification.
        country:
          type: string
          nullable: true
          description: >-
            The country name or country code (ISO 3166-1 alpha-2) where this
            address is located.
    PaymentLineItemEnum:
      title: PaymentLineItemEnum
      type: string
      enum:
        - PAYMENT_INVOICES
        - PAYMENT_PAYMENT_LINKS
    AddressType:
      title: AddressType
      type: string
      enum:
        - SHIPPING
        - BILLING
        - COMPANY
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key

````