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

# List invoices

> Retrieve a paginated list of invoices.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/account-billing/invoices.yml get /invoices
openapi: 3.1.0
info:
  title: Telnyx Invoices API
  version: 2.0.0
  description: API for Invoices.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /invoices:
    get:
      summary: List invoices
      description: Retrieve a paginated list of invoices.
      operationId: ListInvoices
      parameters:
        - name: sort
          in: query
          description: Specifies the sort order for results.
          required: false
          schema:
            type: string
            example: period_start
            enum:
              - period_start
              - '-period_start'
        - name: page
          in: query
          style: deepObject
          explode: true
          description: >-
            Consolidated page parameter (deepObject style). Originally:
            page[number], page[size]
          schema:
            type: object
            properties:
              number:
                type: integer
                minimum: 1
                default: 1
                description: The page number to load
              size:
                type: integer
                minimum: 1
                maximum: 250
                default: 20
                description: The size of the page
      responses:
        '200':
          description: List of invoices
          content:
            application/json:
              schema:
                type: object
                properties:
                  meta:
                    type: object
                    properties:
                      total_results:
                        type: integer
                        example: 20
                      total_pages:
                        type: integer
                        example: 1
                      page_number:
                        type: integer
                        example: 1
                      page_size:
                        type: integer
                        example: 20
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Invoice'
        '403':
          $ref: '#/components/responses/invoice_ForbiddenErrorResponse'
        default:
          $ref: '#/components/responses/invoice_GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Telnyx from 'telnyx';

            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });

            // Automatically fetches more pages as needed.
            for await (const invoiceListResponse of client.invoices.list()) {
              console.log(invoiceListResponse.file_id);
            }
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            page = client.invoices.list()
            page = page.data[0]
            print(page.file_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tpage, err := client.Invoices.List(context.TODO(), telnyx.InvoiceListParams{})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", page)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.invoices.InvoiceListPage;
            import com.telnyx.sdk.models.invoices.InvoiceListParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    InvoiceListPage page = client.invoices().list();
                }
            }
        - lang: Ruby
          source: |-
            require "telnyx"

            telnyx = Telnyx::Client.new(api_key: "My API Key")

            page = telnyx.invoices.list

            puts(page)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $page = $client->invoices->list(
                pageNumber: 0, pageSize: 0, sort: 'period_start'
              );

              var_dump($page);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx invoices list \
              --api-key 'My API Key'
components:
  schemas:
    Invoice:
      type: object
      properties:
        invoice_id:
          type: string
          format: uuid
          example: 48eff763-ea80-4345-b688-78249eb165a8
        file_id:
          type: string
          format: uuid
          example: 454ea3b0-9eaa-4fa9-992e-6d9f31c0a37e
        period_start:
          type: string
          format: date
          example: '2023-11-01'
        period_end:
          type: string
          format: date
          example: '2023-11-30'
        paid:
          type: boolean
          example: true
        url:
          type: string
          format: uri
          example: >-
            https://api.telnyx.com:443/v2/invoices/48eff763-ea80-4345-b688-78249eb165a8
    invoice_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/invoice_Error'
      type: object
    invoice_Error:
      required:
        - code
        - title
      properties:
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        source:
          type: object
          properties:
            pointer:
              description: JSON pointer (RFC6901) to the offending entity.
              type: string
            parameter:
              description: Indicates which query parameter caused the error.
              type: string
        meta:
          type: object
          additionalProperties: true
      type: object
  responses:
    invoice_ForbiddenErrorResponse:
      description: Insufficient permissions to access invoices
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
    invoice_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/invoice_Errors'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````