Skip to main content

Documents API

Base URL: https://api.torvussecurity.com/v1

The Documents API allows you to upload, manage, and retrieve documents within vaults.


List Vault Documents

GET /vaults/{vault_id}/documents

Retrieve all documents in a vault.

Request

Path Parameters:

ParameterTypeRequiredDescription
vault_idstringYesVault identifier

Query Parameters:

ParameterTypeRequiredDescription
pageintegerNoPage number (default: 1)
per_pageintegerNoItems per page (default: 20, max: 100)
sortstringNoSort by: name, created_at, size (default: created_at)
orderstringNoasc or desc (default: desc)

Example Request

curl -X GET https://api.torvussecurity.com/v1/vaults/vault_abc123/documents \
-H "Authorization: Bearer your_api_key"

Success Response (200 OK)

{
"data": [
{
"id": "doc_xyz789",
"name": "will-testament.pdf",
"size": 1048576,
"mime_type": "application/pdf",
"created_at": "2025-10-01T10:00:00Z",
"updated_at": "2025-10-01T10:00:00Z",
"vault_id": "vault_abc123",
"url": "https://api.torvussecurity.com/v1/documents/doc_xyz789/download",
"metadata": {
"encrypted": true,
"checksum": "sha256:abc123..."
}
}
],
"pagination": {
"current_page": 1,
"per_page": 20,
"total": 12,
"total_pages": 1
}
}

Upload Document

POST /vaults/{vault_id}/documents

Upload a new document to a vault.

Request

Path Parameters:

ParameterTypeRequiredDescription
vault_idstringYesVault identifier

Headers:

Authorization: Bearer YOUR_API_KEY
Content-Type: multipart/form-data

Form Data:

FieldTypeRequiredDescription
filefileYesFile to upload (max 100MB)
namestringNoCustom filename (defaults to uploaded filename)
descriptionstringNoDocument description

Example Request

curl -X POST https://api.torvussecurity.com/v1/vaults/vault_abc123/documents \
-H "Authorization: Bearer your_api_key" \
-F "file=@/path/to/document.pdf" \
-F "name=Important Document.pdf" \
-F "description=Last will and testament"

Success Response (201 Created)

{
"id": "doc_new456",
"name": "Important Document.pdf",
"description": "Last will and testament",
"size": 2097152,
"mime_type": "application/pdf",
"created_at": "2025-10-08T14:30:00Z",
"vault_id": "vault_abc123",
"url": "https://api.torvussecurity.com/v1/documents/doc_new456/download",
"metadata": {
"encrypted": true,
"checksum": "sha256:def456..."
}
}

Error Responses

Status CodeErrorDescription
400Bad RequestNo file provided or invalid file
401UnauthorizedMissing or invalid API key
403ForbiddenNo permission to add documents
413Payload Too LargeFile exceeds 100MB limit
422Unprocessable EntityVault released (immutable)

Get Document

GET /documents/{document_id}

Retrieve document metadata.

Example Request

curl -X GET https://api.torvussecurity.com/v1/documents/doc_xyz789 \
-H "Authorization: Bearer your_api_key"

Success Response (200 OK)

{
"id": "doc_xyz789",
"name": "will-testament.pdf",
"description": "Last will and testament",
"size": 1048576,
"mime_type": "application/pdf",
"created_at": "2025-10-01T10:00:00Z",
"updated_at": "2025-10-01T10:00:00Z",
"vault_id": "vault_abc123",
"url": "https://api.torvussecurity.com/v1/documents/doc_xyz789/download",
"metadata": {
"encrypted": true,
"checksum": "sha256:abc123...",
"virus_scan": {
"status": "clean",
"scanned_at": "2025-10-01T10:00:05Z"
}
}
}

Download Document

GET /documents/{document_id}/download

Download document file.

Example Request

curl -X GET https://api.torvussecurity.com/v1/documents/doc_xyz789/download \
-H "Authorization: Bearer your_api_key" \
--output document.pdf

Success Response (200 OK)

Returns the file binary with appropriate headers:

Content-Type: application/pdf
Content-Disposition: attachment; filename="will-testament.pdf"
Content-Length: 1048576

Update Document

PATCH /documents/{document_id}

Update document metadata (name, description).

Request Body

{
"name": "Updated Filename.pdf",
"description": "Updated description"
}

Success Response (200 OK)

{
"id": "doc_xyz789",
"name": "Updated Filename.pdf",
"description": "Updated description",
"size": 1048576,
"mime_type": "application/pdf",
"updated_at": "2025-10-08T15:00:00Z"
}

Delete Document

DELETE /documents/{document_id}

Permanently delete a document.

Example Request

curl -X DELETE https://api.torvussecurity.com/v1/documents/doc_xyz789 \
-H "Authorization: Bearer your_api_key"

Success Response (204 No Content)

No response body.

Error Responses

Status CodeErrorDescription
401UnauthorizedMissing or invalid API key
403ForbiddenNo permission to delete
404Not FoundDocument not found
422Unprocessable EntityVault released (cannot delete)

Rate Limits

EndpointRate Limit
GET /vaults/{id}/documents100/minute
GET /documents/{id}200/minute
POST /vaults/{id}/documents20/minute
GET /documents/{id}/download100/minute
PATCH /documents/{id}50/minute
DELETE /documents/{id}20/minute

Last Updated: October 8, 2025