import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.documents.uploadJson({
url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
});
console.log(response.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"
}
}Upload a document.
Uploaded files must be linked to a service within 30 minutes or they will be automatically deleted.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: 'My API Key',
});
const response = await client.documents.uploadJson({
url: 'https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf',
});
console.log(response.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"
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
If the file is already hosted publicly, you can provide a URL and have the documents service fetch it for you.
"https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
The filename of the document.
"test-document.pdf"
Optional reference string for customer tracking.
"MY REF 001"
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?