import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const documents = await client.documents.list();
console.log(documents.data);{
"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": {
"page_number": 2,
"page_size": 25,
"total_pages": 3,
"total_results": 55
}
}List all documents ordered by created_at descending.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const documents = await client.documents.list();
console.log(documents.data);{
"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": {
"page_number": 2,
"page_size": 25,
"total_pages": 3,
"total_results": 55
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
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]
Show child attributes
{
"filename": { "contains": "invoice" },
"customer_reference": { "in": ["REF001", "REF002"] },
"created_at": { "gt": "2021-01-01T00:00:00Z" }
}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.
filename, created_at, updated_at, -filename, -created_at, -updated_at ["filename"]Successful response
Show child attributes
Identifies the resource.
"6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Identifies the type of the resource. Identifies the type of the resource.
"document"
ISO 8601 formatted date-time indicating when the resource was created.
"2018-02-02T22:25:27.521Z"
ISO 8601 formatted date-time indicating when the resource was updated.
"2018-02-02T22:25:27.521Z"
The document's content_type.
"application/pdf"
Indicates the current document reviewing status
pending, verified, denied "pending"
The document's SHA256 hash provided for optional verification purposes.
"08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c"
The filename of the document.
"test-document.pdf"
Optional reference string for customer tracking.
"MY REF 001"
The antivirus scan status of the document.
scanned, infected, pending_scan, not_scanned "scanned"
Was this page helpful?