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

# List invoices

> List invoices

export const ListAPIInfo = ({info: {query_fields, allowed_combinations, search_fields, sort_fields, default_sort}, show_filter_combinations}) => {
  return <AccordionGroup>
    {query_fields != null && query_fields.length > 0 ? <Accordion title="Query Parameters">
      {query_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
    </Accordion> : ''}

    {allowed_combinations != null && allowed_combinations.length > 0 ? <Accordion title="Filterable Fields">
      {[...new Set(allowed_combinations.flat())].map(field => <ParamField key={field} query={field} type="string" />)}
      {show_filter_combinations ? <>
        <h3 style={{
    marginTop: "0em"
  }}>Allowed filter combinations</h3>
        <ul>
          {allowed_combinations.map(comb => <li key="a">
              {comb.map((e, i) => <><code>{e}</code>{i != comb.length - 1 ? ", " : ""}</>)}
            </li>)}
        </ul>
        </> : ''}
    </Accordion> : ''}

    {search_fields != null && search_fields.length > 0 ? <Accordion title="Searchable Fields">
      Fields that can be searched on using <code>_search</code> query param
      {search_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
    </Accordion> : ''}

    {sort_fields != null && sort_fields.length > 0 ? <Accordion title="Sortable Fields">
      Fields with which the list response can be sorted using <code>_sort</code> query param
      {sort_fields.map(field => <ParamField key={field} query={field.name} type={field.type}>
            {field.description}
          </ParamField>)}
      {default_sort ? <Note>
            Default sort order:<code>{Object.entries(default_sort).map(e => e[0] + " " + e[1]).join(', ')}</code>
          </Note> : ''}
    </Accordion> : ''}

      
  </AccordionGroup>;
};

export const listInvoiceQueryFields = {
  query_fields: [{
    name: "status",
    type: "enum",
    description: "Status of the invoice (`DRAFT`, `DUE`, `PAID`, `VOID`, `UN_COLLECTIBLE`, `INITIATE_REFUND`, `REFUND_COMPLETED`, `MERGED`)"
  }, {
    name: "class",
    type: "enum",
    description: "Class to which the invoice is categorized (`INVOICE`, `ORDER`, `BILLABLE`)"
  }, {
    name: "owner_id",
    type: "string",
    description: "Unique identifier of the owner associated with the invoice"
  }, {
    name: "invoice_date",
    type: "string",
    description: "Date of the invoice"
  }, {
    name: "customer_id",
    type: "string",
    description: "Unique identifier of the customer associated with the invoice"
  }, {
    name: "price_plan_id",
    type: "string",
    description: "Unique identifier of the price plan associated with the invoice"
  }, {
    name: "start_date",
    type: "string",
    description: "Start date of the invoice"
  }, {
    name: "end_date",
    type: "string",
    description: "End date of the invoice"
  }],
  allowed_combinations: [["status"], ["class"], ["class", "owner_id"], ["status", "owner_id"], ["status", "class"], ["status", "class", "owner_id"], ["status", "invoice_date"], ["class", "invoice_date"], ["status", "invoice_date", "customer_id"], ["class", "invoice_date", "customer_id"], ["status", "invoice_date", "customer_id", "owner_id"], ["class", "invoice_date", "customer_id", "owner_id"], ["owner_id"], ["owner_id", "price_plan_id"], ["owner_id", "price_plan_id", "start_date"], ["owner_id", "price_plan_id", "start_date", "end_date"]],
  search_fields: [{
    name: "id",
    type: "string"
  }, {
    name: "customer_id",
    type: "string"
  }, {
    name: "account_id",
    type: "string"
  }, {
    name: "customer_name",
    type: "string"
  }, {
    name: "account_name",
    type: "string"
  }],
  sort_fields: [{
    name: "created_at",
    type: "string",
    description: ""
  }, {
    name: "id",
    type: "string",
    description: ""
  }],
  default_sort: {
    "created_at": "DESC",
    "id": "ASC"
  }
};

<ListAPIInfo info={listInvoiceQueryFields} show_filter_combinations />


## OpenAPI

````yaml get /invoices
openapi: 3.0.3
info:
  version: '1.0'
  title: Togai Apis
  contact:
    email: engg@togai.com
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  description: APIs for Togai App
servers:
  - description: Api endpoint
    url: https://api.togai.com/
  - description: Sandbox api endpoint
    url: https://sandbox-api.togai.com/
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: Customer level calls
  - name: Accounts
    description: Account level calls
  - name: Event Schemas
    description: Event Schema level calls
  - name: Usage Meters
    description: Usage Meter level calls
  - name: Price Plans
    description: (DEPRECATED) Price Plan level calls
  - name: PricePlanV2
    description: Price Plan V2 level calls
  - name: Schedules
    description: Account Schedule level calls
  - name: Pricing Rules
    description: Pricing Rules level calls
  - name: Settings
    description: Settings
  - name: Price Experimentation
    description: Price Experimentation apis
  - name: InvoiceGroups
    description: Invoice Group level calls
  - name: Organization
    description: Organization level calls
  - name: FileStorage
    description: File Storage level calls
  - name: Aliases
    description: Alias level calls
  - name: Reports
    description: Report level calls
  - name: ReportTemplates
    description: Report Template level calls
  - name: Customer Portal
    description: Portal level calls
  - name: Alerts
    description: Alert level calls
  - name: Event Management
    description: APIs for getting events ingested in Togai
    externalDocs:
      description: docs
      url: https://togai.com/docs/billing/events
  - name: Metrics
    description: APIs for getting Togai metrics
    externalDocs:
      description: docs
      url: https://togai.com/docs/metrics
  - name: Licenses
    description: APIs for getting or updating license records in Togai
  - name: Entitlements
    description: APIs related to entitlements
  - name: Invoices
    description: Invoices API
  - name: Credits
    description: Credits API
  - name: Wallet
    description: Wallet API
  - name: InvoiceTemplates
    description: InvoiceTemplates API
  - name: InvoiceSequence
    description: InvoiceSequence API
  - name: Payments
    description: Payments API
  - name: Authentication
    description: Authentication API
externalDocs:
  description: Find out more about Togai
  url: https://docs.togai.com/docs
paths:
  /invoices:
    get:
      tags:
        - Invoices
      summary: List invoices
      description: List invoices
      operationId: listInvoices
      parameters:
        - $ref: '#/components/parameters/filter_next_page_token'
        - $ref: '#/components/parameters/filter_status'
        - $ref: '#/components/parameters/filter_owner_id'
        - $ref: '#/components/parameters/filter_customer_id'
        - $ref: '#/components/parameters/filter_page_size'
        - $ref: '#/components/parameters/filter_start_time'
        - $ref: '#/components/parameters/filter_end_time'
      responses:
        '200':
          description: Success response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListInvoicesResponse'
              examples:
                ListInvoicesResponse:
                  $ref: '#/components/examples/ListInvoicesResponse'
        '400':
          description: Bad request. Please check the response message for failure details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: >-
            Credential is not valid. Please check the response message for
            failure details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Credential does not have access to this operation.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Unable to process the query parameters provided. Please check our
            docs for the api limits - https://togai.io/docs/limits.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: >-
            Request throttled. Please check the response message on the failure
            details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        default:
          $ref: '#/components/responses/ErrorResponse'
components:
  parameters:
    filter_next_page_token:
      in: query
      description: Pagination token used as a marker to get records from next page.
      name: nextToken
      required: false
      schema:
        type: string
        example: >-
          eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEyMywgInNvcnRPcmRlciI6ICJhc2MifQ==
    filter_status:
      in: query
      description: Filter option to filter by status.
      name: status
      required: false
      schema:
        type: string
      examples:
        processed:
          value: PROCESSED
        in_progress:
          value: IN_PROGRESS
    filter_owner_id:
      in: query
      description: Filter option to filter based on owner id.
      name: owner_id
      required: false
      schema:
        type: string
        example: ACC001
    filter_customer_id:
      in: query
      description: Filter option to filter based on customer id.
      name: customer_id
      required: false
      schema:
        type: string
        example: '1234'
    filter_page_size:
      in: query
      description: |-
        Maximum page size expected by client to return the record list. 

         NOTE: Max page size cannot be more than 50. Also 50 is the default page size if no value is provided.
      name: pageSize
      required: false
      schema:
        type: integer
        example: 10
    filter_start_time:
      in: query
      name: start_time
      description: Start time filter in epoch milli seconds
      required: false
      schema:
        type: integer
        format: int64
        example: 1650110402000
    filter_end_time:
      in: query
      name: end_time
      description: End time filter in epoch milli seconds
      required: false
      schema:
        type: integer
        format: int64
        example: 1650110402000
  schemas:
    ListInvoicesResponse:
      description: List invoices response
      type: object
      additionalProperties: false
      required:
        - data
      properties:
        data:
          type: array
          minItems: 0
          maxItems: 50
          items:
            $ref: '#/components/schemas/InvoiceSummary'
        nextToken:
          type: string
          maxLength: 500
          example: >-
            eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEyMywgInNvcnRPcmRlciI6ICJhc2MifQ==
    ErrorResponse:
      type: object
      additionalProperties: false
      required:
        - message
      properties:
        message:
          type: string
          description: error description
          maxLength: 500
    InvoiceSummary:
      description: Structure of invoice response
      type: object
      additionalProperties: false
      required:
        - id
        - status
        - invoiceDate
        - updatedAt
        - invoiceClass
        - invoiceType
        - totalAmount
        - paidAmount
        - netTermDays
      properties:
        id:
          description: Identifier of invoice
          type: string
          maxLength: 50
        customerId:
          type: string
        ownerId:
          type: string
        pricePlanId:
          type: string
        status:
          $ref: '#/components/schemas/InvoicesStatus'
          example: DUE
        finalizingStatus:
          type: string
          enum:
            - FINALIZING
            - FINALIZED
        invoiceClass:
          $ref: '#/components/schemas/InvoicesClass'
          example: INVOICE
        invoiceType:
          $ref: '#/components/schemas/InvoicesType'
          example: STANDARD
        startDate:
          description: Start date of the invoice
          type: string
          format: date-time
          example: '2020-07-04T12:00:00.000Z'
        endDate:
          description: End date of the invoice
          type: string
          format: date-time
          example: '2020-07-04T12:00:00.000Z'
        endDateInclusive:
          description: Inclusive end date of the invoice
          type: string
          format: date-time
          example: '2020-07-03T11:59:59.999Z'
        invoiceDate:
          description: Invoice date of the invoice
          type: string
          format: date-time
          example: '2020-07-04T12:00:00.000Z'
        dueDate:
          description: Due date of the invoice
          type: string
          format: date-time
          example: '2020-07-04T12:00:00.000Z'
        generatedAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        sequenceId:
          type: string
          description: Sequence id of the invoice
        pdfUrl:
          description: Download URL of the pdf file corresponding to the invoice
          type: string
        totalAmount:
          type: number
        paidAmount:
          type: number
        invoiceDetails:
          $ref: '#/components/schemas/InvoiceDetails'
        netTermDays:
          type: integer
          description: >-
            Number of days from the invoice date after which an invoice is
            considered overdue.
    InvoicesStatus:
      description: Status of the invoice
      type: string
      enum:
        - DRAFT
        - DUE
        - PAID
        - VOID
        - UN_COLLECTIBLE
        - REFUND_INITIATED
        - REFUND_COMPLETED
        - MERGED
        - PARTIALLY_PAID
    InvoicesClass:
      description: Represents the class of entity( INVOICE/ORDER/BILLABLE)
      type: string
      enum:
        - INVOICE
        - ORDER
        - BILLABLE
    InvoicesType:
      description: Represents the type of entity(STANDARD/AD_HOC/COMPOSITE)
      type: string
      enum:
        - STANDARD
        - AD_HOC
        - CUSTOM
        - COMPOSITE
        - STANDARD_ADVANCED
        - ADHOC_ADVANCED
    InvoiceDetails:
      type: object
      additionalProperties: false
      properties:
        customer:
          type: object
          additionalProperties: false
          required:
            - name
            - primaryEmail
          properties:
            name:
              type: string
            primaryEmail:
              type: string
            billingAddress:
              type: string
            address:
              $ref: '#/components/schemas/Address'
        account:
          type: object
          additionalProperties: false
          required:
            - name
            - invoiceCurrency
            - address
            - primaryEmail
          properties:
            name:
              type: string
            invoiceCurrency:
              type: string
            address:
              $ref: '#/components/schemas/Address'
            primaryEmail:
              type: string
        pricePlanName:
          type: string
        invoiceGroup:
          type: object
          additionalProperties: false
          required:
            - id
            - name
            - dailyInvoiceConsolidation
            - invoiceCurrency
            - address
          properties:
            id:
              type: string
            name:
              type: string
            email:
              type: string
            dailyInvoiceConsolidation:
              type: boolean
            invoiceCurrency:
              type: string
            address:
              $ref: '#/components/schemas/Address'
        organization:
          type: object
          additionalProperties: false
          required:
            - businessName
            - address
            - primaryEmail
          properties:
            businessName:
              type: string
            address:
              $ref: '#/components/schemas/Address'
            primaryEmail:
              type: string
            metadata:
              type: object
              additionalProperties:
                type: string
        logoUrl:
          type: string
    Address:
      description: billing address of the customer
      type: object
      additionalProperties: false
      properties:
        phoneNumber:
          description: Contact number
          type: string
        line1:
          description: Address line 1 (eg. Street, PO Box, Company Name)
          type: string
        line2:
          description: Address line 2 (eg. apartment, suite, unit or building)
          type: string
        postalCode:
          description: ZIP or postal code
          type: string
        city:
          description: City, district, suburb, town or village
          type: string
        state:
          description: State, county, province or region
          type: string
        country:
          description: >-
            Two letter country code [ISO-3166-1
            Alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2)
          type: string
  examples:
    ListInvoicesResponse:
      summary: A sample ListInvoicesResponse
      value:
        data:
          - id: inv.hkgkgyh.ghg
            customerId: 7VcRw9xZDIqsC5E
            ownerId: ACC001
            invoiceClass: INVOICE
            invoiceType: AD_HOC
            status: DUE
            finalizingStatus: FINALIZED
            totalAmount: 100
            paidAmount: 0
            startDate: '2020-07-04T12:00:00.000Z'
            endDate: '2020-07-04T12:00:00.000Z'
            invoiceDate: '2020-07-04T12:00:00.000Z'
            generatedAt: '2020-07-04T12:00:00.000Z'
            updatedAt: '2020-07-04T12:00:00.000Z'
        nextToken: >-
          eyJsYXN0SXRlbUlkIjogInN0cmluZyIsICJwYWdlU2l6ZSI6IDEyMywgInNvcnRPcmRlciI6ICJhc2MifQ==
  responses:
    ErrorResponse:
      description: Error response
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          examples:
            ErrorResponse:
              summary: Error message
              value:
                message: <Reason message>
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Bearer <credential>

````