API Setup

Documents API

API reference for managing documents and files

Get Document

Retrieve a specific document and its associated files.

GET /api/v1/documents/{documentId}

Parameters

ParameterTypeDescription
documentIdstringThe ID of the document to retrieve

Response

{
	"id": "document_id",
	"name": "Document Name",
	"description": "Document Description",
	"tags": ["tag1", "tag2"],
	"files": [
		{
			"id": "file_id",
			"name": "file.pdf",
			"description": "File Description",
			"fileUrl": "https://storage.example.com/file.pdf",
			"whatsapp_media_id": "whatsapp_id"
		}
	]
}

Update Document

Update a document and its associated files.

PUT /api/v1/documents/{documentId}

Parameters

ParameterTypeDescription
documentIdstringThe ID of the document to update

Request Body (multipart/form-data)

FieldTypeDescription
namestringDocument name
descriptionstringDocument description
tagsstring (JSON)Array of tags
fileDescriptionsstring (JSON)Array of file descriptions
filesfile[]Array of files to upload

Response

{
	"id": "document_id",
	"name": "Updated Document Name",
	"description": "Updated Description",
	"tags": ["updated_tag1", "updated_tag2"],
	"files": [
		{
			"id": "file_id",
			"name": "updated_file.pdf",
			"description": "Updated File Description",
			"fileUrl": "https://storage.example.com/updated_file.pdf",
			"whatsapp_media_id": "whatsapp_id"
		}
	]
}

Delete Document

Delete a document and all its associated files.

DELETE /api/v1/documents/{documentId}

Parameters

ParameterTypeDescription
documentIdstringThe ID of the document to delete

Response

Returns a 204 No Content response on successful deletion.

File Storage

  • Files are stored in DigitalOcean Spaces
  • Files are publicly accessible via their URLs
  • WhatsApp media IDs are stored for quick sharing via WhatsApp
  • Supported file types: PDF, images, videos, and other common document formats

Error Responses

Status CodeDescription
400Bad Request - Invalid input parameters
401Unauthorized - Invalid or missing API key
404Not Found - Document not found
500Internal Server Error

Security

  • All endpoints require authentication
  • Files are scanned for malware before storage
  • File access can be restricted by organization
  • File deletion removes both storage and WhatsApp media entries
    Documents API | OutCaller