> ## 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 all documents

> List all documents ordered by created_at descending.



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/numbers-identity/documents.yml get /documents
openapi: 3.1.0
info:
  title: Telnyx Documents API
  version: 2.0.0
  description: API for Documents.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /documents:
    get:
      tags:
        - Documents
      summary: List all documents
      description: List all documents ordered by created_at descending.
      operationId: ListDocuments
      parameters:
        - $ref: '#/components/parameters/FilterDocumentsConsolidated'
        - $ref: '#/components/parameters/SortDocumentsConsolidated'
        - $ref: '#/components/parameters/documents_PageConsolidated'
      responses:
        '200':
          $ref: '#/components/responses/ListDocServiceDocumentsResponse'
        '422':
          description: >-
            Unprocessable entity. Check the 'detail' field in response for
            details.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/documents_Errors'
        default:
          $ref: '#/components/responses/documents_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 docServiceDocument of client.documents.list()) {
              console.log(docServiceDocument.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.documents.list()
            page = page.data[0]
            print(page.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.Documents.List(context.TODO(), telnyx.DocumentListParams{})\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.documents.DocumentListPage;
            import com.telnyx.sdk.models.documents.DocumentListParams;

            public final class Main {
                private Main() {}

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

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

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

            page = telnyx.documents.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->documents->list(
                filter: [
                  'createdAt' => [
                    'gt' => new \DateTimeImmutable('2021-01-01T00:00:00Z'),
                    'lt' => new \DateTimeImmutable('2021-04-09T22:25:27.521Z'),
                  ],
                  'customerReference' => [
                    'eq' => 'MY REF 001', 'in' => ['REF001', 'REF002']
                  ],
                  'filename' => ['contains' => 'invoice'],
                ],
                pageNumber: 0,
                pageSize: 0,
                sort: ['filename'],
              );

              var_dump($page);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx documents list \
              --api-key 'My API Key'
components:
  parameters:
    FilterDocumentsConsolidated:
      name: filter
      in: query
      style: deepObject
      explode: true
      required: false
      description: >-
        Consolidated filter parameter for documents (deepObject style).
        Originally: filter[filename][contains], filter[customer_reference][eq],
        filter[customer_reference][in][], filter[created_at][gt],
        filter[created_at][lt]
      schema:
        type: object
        additionalProperties: false
        properties:
          filename:
            type: object
            additionalProperties: false
            properties:
              contains:
                type: string
                example: invoice
                description: Filter by string matching part of filename.
          customer_reference:
            type: object
            additionalProperties: false
            properties:
              eq:
                type: string
                example: MY REF 001
                description: Filter documents by a customer reference.
              in:
                type: array
                items:
                  type: string
                example:
                  - MY REF 001
                  - MY REF 002
                description: Filter documents by a list of customer references.
          created_at:
            type: object
            additionalProperties: false
            properties:
              gt:
                type: string
                format: date-time
                example: '2021-04-09T22:25:27.521Z'
                description: Filter by created at greater than provided value.
              lt:
                type: string
                format: date-time
                example: '2021-04-09T22:25:27.521Z'
                description: Filter by created at less than provided value.
        example:
          filename:
            contains: invoice
          customer_reference:
            in:
              - REF001
              - REF002
          created_at:
            gt: '2021-01-01T00:00:00Z'
    SortDocumentsConsolidated:
      name: sort
      in: query
      required: false
      description: >-
        Consolidated sort parameter for documents (deepObject style).
        Originally: sort[]
      schema:
        type: array
        items:
          type: string
          enum:
            - filename
            - created_at
            - updated_at
            - '-filename'
            - '-created_at'
            - '-updated_at'
        example:
          - filename
        description: >-
          Specifies the sort order for results. If you want to sort by a field
          in ascending order, include it as a sort parameter. If you want to
          sort in descending order, prepend a `-` in front of the field name.
    documents_PageConsolidated:
      name: page
      in: query
      style: deepObject
      explode: true
      description: >-
        Consolidated page parameter (deepObject style). Originally: page[size],
        page[number]
      schema:
        type: object
        properties:
          size:
            type: integer
            minimum: 1
            maximum: 250
            default: 20
            description: The size of the page
          number:
            type: integer
            minimum: 1
            default: 1
            description: The page number to load
  responses:
    ListDocServiceDocumentsResponse:
      description: Successful response
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                type: array
                items:
                  $ref: '#/components/schemas/DocServiceDocument'
              meta:
                $ref: '#/components/schemas/PaginationMeta'
    documents_GenericErrorResponse:
      description: Unexpected error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/documents_Errors'
  schemas:
    documents_Errors:
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/documents_Error'
      type: object
    DocServiceDocument:
      allOf:
        - $ref: '#/components/schemas/DocServiceRecord'
        - type: object
          properties:
            record_type:
              description: Identifies the type of the resource.
              type: string
              readOnly: true
              example: document
            content_type:
              description: The document's content_type.
              type: string
              readOnly: true
              example: application/pdf
            size:
              description: Indicates the document's filesize
              type: object
              readOnly: true
              properties:
                unit:
                  description: Identifies the unit
                  type: string
                  readOnly: true
                  example: bytes
                amount:
                  description: The number of bytes
                  type: integer
                  readOnly: true
                  example: 123456
            status:
              type: string
              description: Indicates the current document reviewing status
              readOnly: true
              enum:
                - pending
                - verified
                - denied
              example: pending
            sha256:
              description: >-
                The document's SHA256 hash provided for optional verification
                purposes.
              type: string
              readOnly: true
              example: 08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c
            filename:
              description: The filename of the document.
              type: string
              example: test-document.pdf
            customer_reference:
              type: string
              description: Optional reference string for customer tracking.
              example: MY REF 001
            av_scan_status:
              type: string
              description: The antivirus scan status of the document.
              readOnly: true
              enum:
                - scanned
                - infected
                - pending_scan
                - not_scanned
              example: scanned
    PaginationMeta:
      type: object
      properties:
        total_pages:
          type: integer
          example: 3
        total_results:
          type: integer
          example: 55
        page_number:
          type: integer
          example: 2
        page_size:
          type: integer
          example: 25
    documents_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
    DocServiceRecord:
      type: object
      properties:
        id:
          type: string
          format: uuid
          description: Identifies the resource.
          readOnly: true
          example: 6a09cdc3-8948-47f0-aa62-74ac943d6c58
        record_type:
          type: string
          description: Identifies the type of the resource.
          readOnly: true
          example: sample_record_type
        created_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            created.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
        updated_at:
          type: string
          description: >-
            ISO 8601 formatted date-time indicating when the resource was
            updated.
          readOnly: true
          example: '2018-02-02T22:25:27.521Z'
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````