Skip to main content
GET
/
documents
JavaScript
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);
}
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)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
page, err := client.Documents.List(context.TODO(), telnyx.DocumentListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", page)
}
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();
}
}
require "telnyx"

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

page = telnyx.documents.list

puts(page)
<?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();
}
telnyx documents list \
--api-key 'My API Key'
curl --request GET \
--url https://api.telnyx.com/v2/documents \
--header 'Authorization: Bearer <token>'
{
  "data": [
    {
      "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "record_type": "document",
      "created_at": "2018-02-02T22:25:27.521Z",
      "updated_at": "2018-02-02T22:25:27.521Z",
      "content_type": "application/pdf",
      "size": {
        "unit": "bytes",
        "amount": 123456
      },
      "status": "pending",
      "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
      "filename": "test-document.pdf",
      "customer_reference": "MY REF 001",
      "av_scan_status": "scanned"
    }
  ],
  "meta": {
    "total_pages": 3,
    "total_results": 55,
    "page_number": 2,
    "page_size": 25
  }
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}
{
"errors": [
{
"code": "<string>",
"title": "<string>",
"detail": "<string>",
"source": {
"pointer": "<string>",
"parameter": "<string>"
},
"meta": {}
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

filter
object

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]

Example:
{
"filename": { "contains": "invoice" },
"customer_reference": { "in": ["REF001", "REF002"] },
"created_at": { "gt": "2021-01-01T00:00:00Z" }
}
sort
enum<string>[]

Consolidated sort parameter for documents (deepObject style). Originally: sort[] 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.

Available options:
filename,
created_at,
updated_at,
-filename,
-created_at,
-updated_at
Example:
["filename"]
page
object

Consolidated page parameter (deepObject style). Originally: page[size], page[number]

Response

Successful response

data
object[]
meta
object