Open SidemenuAPI Reference
API Reference
Close Sidemenu

Documents

List all documentslistDocuments

get https://api.telnyx.com/v2/documents

List all documents ordered by created_at descending.

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/documents?page[number]=1&page[size]=20"
Parameters
In query
page[number]
integer (1)
optional

The page number to load.

Default: 1
page[size]
integer (1 - 250)
optional

The size of the page.

Default: 20
Responses
200

Successful response

default

Unexpected error

Success Response
{
  "data": [
    {
      "created_at": "2018-02-02T22:25:27.521Z",
      "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "record_type": "document",
      "updated_at": "2018-02-02T22:25:27.521Z",
      "content_type": "application/pdf",
      "filename": "test-document.pdf",
      "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
      "size": {
        "amount": 123456,
        "unit": "bytes"
      },
      "status": "pending"
    }
  ],
  "meta": {
    "page_number": 2,
    "page_size": 25,
    "total_pages": 3,
    "total_results": 55
  }
}

Upload a documentcreateDocument

post https://api.telnyx.com/v2/documents

Upload a document.

Uploaded files must be linked to a service within 30 minutes or they will be automatically deleted.

curl -X POST \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{}' \
  https://api.telnyx.com/v2/documents
Parameters
In body (application/json)
one of
required
url
string

If the file is already hosted publicly, you can provide a URL and have the documents service fetch it for you.

Example: "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf"
file
string (byte)

The Base64 encoded contents of the file you are uploading.

Example: "[Base64 encoded content]"
In body (multipart/form-data)
file
string (binary)
optional

The file you are uploading.

Responses
200

Successful response

422

Unprocessable entity. Check the 'detail' field in response for details.

default

Unexpected error

Success Response
{
  "data": {
    "created_at": "2018-02-02T22:25:27.521Z",
    "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    "record_type": "document",
    "updated_at": "2018-02-02T22:25:27.521Z",
    "content_type": "application/pdf",
    "filename": "test-document.pdf",
    "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
    "size": {
      "amount": 123456,
      "unit": "bytes"
    },
    "status": "pending"
  }
}

Retrieve a documentretrieveDocument

get https://api.telnyx.com/v2/documents/{id}

Retrieve a document.

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/documents/{id}"
Parameters
In path
id
string (uuid)
required

The id of the resource.

Responses
200

Successful response

default

Unexpected error

Success Response
{
  "data": {
    "created_at": "2018-02-02T22:25:27.521Z",
    "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    "record_type": "document",
    "updated_at": "2018-02-02T22:25:27.521Z",
    "content_type": "application/pdf",
    "filename": "test-document.pdf",
    "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
    "size": {
      "amount": 123456,
      "unit": "bytes"
    },
    "status": "pending"
  }
}

Update a documentupdateDocument

patch https://api.telnyx.com/v2/documents/{id}

Update a document.

curl -X PATCH \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --data '{}' \
  https://api.telnyx.com/v2/documents/{id}
Parameters
In path
id
string (uuid)
required

The id of the resource.

In body (application/json)
filename
string
optional

The filename of the document.

Example: "test-document.pdf"
Responses
200

Successful response

default

Unexpected error

Success Response
{
  "data": {
    "created_at": "2018-02-02T22:25:27.521Z",
    "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    "record_type": "document",
    "updated_at": "2018-02-02T22:25:27.521Z",
    "content_type": "application/pdf",
    "filename": "test-document.pdf",
    "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
    "size": {
      "amount": 123456,
      "unit": "bytes"
    },
    "status": "pending"
  }
}

Delete a documentdeleteDocument

delete https://api.telnyx.com/v2/documents/{id}

Delete a document.

A document can only be deleted if it's not linked to a service. If it is linked to a service, it must be unlinked prior to deleting.

curl -X DELETE \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  "https://api.telnyx.com/v2/documents/{id}"
Parameters
In path
id
string (uuid)
required

The id of the resource.

Responses
200

Successful response

default

Unexpected error

Success Response
{
  "data": {
    "created_at": "2018-02-02T22:25:27.521Z",
    "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
    "record_type": "document",
    "updated_at": "2018-02-02T22:25:27.521Z",
    "content_type": "application/pdf",
    "filename": "test-document.pdf",
    "sha256": "08a96c641c3a74e44eb59afb61a24f2cb9f4d7188748e76ba4bb5edfa3cb7d1c",
    "size": {
      "amount": 123456,
      "unit": "bytes"
    },
    "status": "pending"
  }
}

Download a documentdownloadDocServiceDocument

get https://api.telnyx.com/v2/documents/{id}/download

Download a document.

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/documents/{id}/download"
Parameters
In path
id
string (uuid)
required

The id of the resource.

Responses
200

Successful response

default

Unexpected error

Success Response
Any
string (binary)
get https://api.telnyx.com/v2/document_links

List all documents links ordered by created_at descending.

curl -X GET \
  --header "Content-Type: application/json" \
  --header "Accept: application/json" \
  --header "Authorization: Bearer YOUR_API_KEY" \
  --globoff "https://api.telnyx.com/v2/document_links?page[number]=1&page[size]=20"
Parameters
In query
page[number]
integer (1)
optional

The page number to load.

Default: 1
page[size]
integer (1 - 250)
optional

The size of the page.

Default: 20
filter[document_id]
string (uuid)
optional

Identifies the associated document to filter on.

Example: "6a09cdc3-8948-47f0-aa62-74ac943d6c58"
filter[linked_record_type]
string
optional

The `linked_record_type` of the document to filter on.

Example: "porting_order"
filter[linked_resource_id]
string (uuid)
optional

The `linked_resource_id` of the document to filter on.

Example: "6a09cdc3-8948-47f0-aa62-74ac943d6c58"
Responses
200

Successful response

default

Unexpected error

Success Response
{
  "data": [
    {
      "created_at": "2018-02-02T22:25:27.521Z",
      "id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "record_type": "document_link",
      "updated_at": "2018-02-02T22:25:27.521Z",
      "document_id": "6a09cdc3-8948-47f0-aa62-74ac943d6c58",
      "linked_record_type": "porting_order",
      "linked_resource_id": "132091b4-442b-4a2a-b87f-61e707e46d54"
    }
  ],
  "meta": {
    "page_number": 2,
    "page_size": 25,
    "total_pages": 3,
    "total_results": 55
  }
}
Previous: Overview

Was this section helpful?