Documents Overview
The Documents API allows you to create, manage, retrieve, and download documents within collections (groups) in the IndexSDK system. Documents serve as the primary content storage mechanism and can be associated with plans and other resources.
Architecture
Documents are collection-scoped entities that store and manage content. Each document is associated with:
- A
collection_idthat identifies the collection/group it belongs to - A
document_idthat uniquely identifies the document - A
document_namethat provides a human-readable name - A
document_descriptionthat describes the document's purpose - A
document_typethat indicates the type of content (PDF, DOCX, TXT, IMG, etc.) - A
document_file_pathordocument_urlthat points to the document content - Various metadata fields for organization and management
Authentication Flow
Before managing documents, you must authenticate using the Client Credentials API to obtain an access token. This token is then used to authenticate requests to document endpoints.
Key Concepts
Document Creation
When you create a document using sync-document:
- A new document is created with a unique
document_id - The
document_nameandcollection_idare required - Documents can be uploaded as files (base64 encoded) or referenced via URL
- The document is associated with the specified collection
- File-based documents are automatically processed and split into pages
Document Management
Documents can be managed through the sync-document endpoint:
- Create: Provide
document_name,collection_id, and eitherfileBase64/document_file_pathordocument_urlwithoutdocument_id - Update: Provide
document_idalong with fields to update - Delete: Set
is_delete: truealong withdocument_id
Document Retrieval
Documents can be retrieved using:
get-documents- Returns all documents for a specificcollection_idget-document-details- Returns a specific document bydocument_idwith associated plans
Document Download
Documents can be downloaded using:
POST /download- Returns a presigned URL for downloading the document (valid for 1 hour)GET /download/:document_id- Directly downloads the document file
File Upload
Documents support file uploads via base64 encoding:
- Files are uploaded to cloud storage (S3)
- Supported file types include PDF, DOCX, TXT, and images (PNG, JPG, JPEG, GIF)
- Files are automatically processed and split into pages for indexing
Use Cases
Documents are used to:
- Store and organize content within collections
- Associate documents with plans for structured organization
- Enable document search and retrieval
- Support document processing and indexing
- Provide document download capabilities
Next Steps
- Sync Document API - Complete API reference for creating, updating, and deleting documents
- Get Document Details API - Retrieve document by ID
- Get Documents API - Retrieve list of documents
- Download Document API - Download document files
- Authentication Overview - Learn about authentication requirements