openapi: 3.0.3

info:
  title: Bills (Invoices)
  description: "For retrieving Bills. For information of how to construct requests utilising fieldsets, sorting, paging, filters, and '*includes*', please refer to the API Developer Portal. E&OE."
  version: "1.0"

externalDocs:
  description: API Developer Portal - Constructing API Requests
  url: https://docs.actionstep.com/api-requests/

paths:
  '/bills':
    get:
      description: Returns a collection of bills (invoices). For information on how to construct requests filtering by various properties, please refer to the API Developer Portal.
      tags:
        - Bills
      responses:
        '200':
          description: OK.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PagedBills'

components:
  schemas:
    PagedBills:
      type: object
      properties:
        bills:
          type: array
          items:
            $ref: '#/components/schemas/Bill'
        meta:
          $ref: '#/components/schemas/PageMetaData'

    PageMetaData:
      type: object
      properties:
        paging:
          $ref: '#/components/schemas/PagingData'

    PagingData:
      type: object
      properties:
        participants:
          $ref: '#/components/schemas/BillsPageData'

    BillsPageData:
      type: object
      properties:
        recordCount:
          description: The total number of bills returned by the underlying query.
          type: integer
          example: 2317
        pageCount:
          description: The total number of pages generated by the underlying query.
          type: integer
          example: 47
        page:
          description: The page number for this page of bills.
          type: integer
          example: 2
        pageSize:
          description: Page size.
          type: integer
          example: 50
        prevPage:
          description: A URL to the previous page of bills.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/bills?page=1
        nextPage:
          description: A URL to the next page of bills.
          type: string
          example: https://ap-southeast-2.actionstep.com/api/rest/bills?page=3

    Bill:
      type: object
      properties:
        id:
          description: Unique identifier for the bill.
          example: 833
          type: integer
        status:
          description: The status of the bill.
          enum:
            - Draft
            - Open
            - Closed
            - Deleted
          example: Open
          type: string
        ourReference:
          description: Internal reference identifier.
          example: 10001
          type: string
        theirReference:
          description: External reference identifier.
          example: YEH-D-9393
          type: string
        currency:
          description: The 3 character ISO currency code.
          example: USD
          type: string
        invoiceDate:
          description: Date of the bill.
          example: 2023-12-25
          type: string
          format: date
        dueDate:
          description: The date when the bill is due.
          example: 2024-01-25
          type: string
          format: date
        totalInclusive:
          description: The inclusive total amount of the bill.
          example: 500.00
          type: number
          format: currency
        totalExclusive:
          description: The exclusive total amount of the bill.
          example: 450.00
          type: number
          format: currency
        totalSalesTax:
          description: Total sales tax for the bill.
          example: 50.00
          type: number
          format: currency
        totalPaid:
          description: Total amount paid for the bill.
          example: 500.00
          type: number
          format: currency
        totalDue:
          description: Total amount due for the bill.
          example: 0.00
          type: number
          format: currency
        createdTimestamp:
          description: Date and time of record creation.
          example: 2019-11-05T14:23:48+13:00
          type: string
          format: timestamp
        modifiedTimestamp:
          description: Date and time of last record modification.
          example: 2019-11-05T14:23:48+13:00
          type: string
          format: timestamp
        deletedTimestamp:
          description: Date and time the record was deleted.
          example: null
          type: string
          format: timestamp
        links:
          $ref: '#/components/schemas/BillLinks'

    BillLinks:
      type: object
      properties:
        division:
          description: Unique identifier of the division to which the bill is associated.
          example: 1
          type: integer
        action:
          description: List of matters to which this bill is associated.
          example: [1093, 2232]
          type: array
          items:
            type: integer
        theirParticipant:
          description: Unique identifier of the person to whom the bill is associated.
          example: 964
          format: integer
          type: string