Skip to main content

Documents API

The Documents API is a secure file management service that provides encrypted storage and retrieval capabilities for files. This feature allows you to upload documents, store them securely with encryption, and retrieve them when needed.

Uploading and downloading documents are rate limited to 10/minute/application.

Upload Document

Uploads a document.

POST
https://api.basistheory.com/documents
Copy

Permissions

documents:create

Request

curl --request POST \
--url https://api.basistheory.com/documents \
--header 'BT-API-KEY: <PRIVATE_API_KEY>' \
--header 'Content-Type: multipart/form-data' \
--form 'request={"metadata": {"name":"value"}}' \
--form document=@/path/to/file.pdf

Request Parameters

ParameterRequiredTypeDefaultDescription
requestfalsestringnullJSON string containing request metadata. Must be provided as a form field.
documenttruefilenullThe document file to upload. Must be provided as a multipart form field with file content.

The request parameter accepts a JSON string with the following properties:

PropertyRequiredTypeDefaultDescription
metadatafalseobject{}Key-value pairs of metadata to associate with the document

Response

Returns a document information if the document was created successfully. Returns an error if there were validation errors, or the document failed to create.

{
"id": "a05d2a09-b4f4-4ce7-9743-ab18d3aa8a43",
"tenant_id": "064bbc70-204b-4ef1-a757-ec0878be5945",
"metadata": {
"name": "value"
},
"content_type": "application/pdf",
"created_by": "f0f504e5-79c2-40a6-aad3-dbee7a692828",
"created_at": "2025-07-18T14:41:08.254248+00:00"
}

Get Document Metadata

GET
https://api.basistheory.com/documents/{id}
Copy

Permissions

documents:read

Request

curl --request GET \
--url https://api.basistheory.com/documents/79602dc6-ac0c-4fe0-9903-62fd88f1303a \
--header 'BT-API-KEY: <PRIVATE_API_KEY>'

URI Parameters

ParameterRequiredTypeDefaultDescription
idtrueuuidnullThe ID of the document

Response

Returns a document with the id provided. Returns an error if the document could not be retrieved.

{
"id": "79602dc6-ac0c-4fe0-9903-62fd88f1303a",
"tenant_id": "6f5ea0c2-f1a6-46c2-ba36-8024cecfb2c3",
"metadata": {
"name": "value"
},
"content_type": "application/pdf",
"created_by": "0bd433d3-e635-4a81-8263-bb13dcacfc79",
"created_at": "2025-07-18T14:41:08.254248+00:00"
}

Download Document

GET
https://api.basistheory.com/documents/{id}/data
Copy

Permissions

documents:reveal

Request

curl --request GET \
--url https://api.basistheory.com/documents/79602dc6-ac0c-4fe0-9903-62fd88f1303a/data \
--header 'BT-API-KEY: <PRIVATE_API_KEY>'

Response

Returns the raw, unencrypted binary content of the document file that was previously uploaded.

Delete Document

Deletes a document.

DELETE
https://api.basistheory.com/documents/{id}
Copy

Permissions

documents:delete

Request

curl --request DELETE \
--url https://api.basistheory.com/documents/79602dc6-ac0c-4fe0-9903-62fd88f1303a \
--header 'BT-API-KEY: <PRIVATE_API_KEY>'

URI Parameters

ParameterRequiredTypeDefaultDescription
idtrueuuidnullThe ID of the document

Response

Returns 204 No Content if the document was deleted successfully. Returns an error if the document could not be deleted.