Skip to main content

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_id that identifies the collection/group it belongs to
  • A document_id that uniquely identifies the document
  • A document_name that provides a human-readable name
  • A document_description that describes the document's purpose
  • A document_type that indicates the type of content (PDF, DOCX, TXT, IMG, etc.)
  • A document_file_path or document_url that 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:

  1. A new document is created with a unique document_id
  2. The document_name and collection_id are required
  3. Documents can be uploaded as files (base64 encoded) or referenced via URL
  4. The document is associated with the specified collection
  5. 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 either fileBase64/document_file_path or document_url without document_id
  • Update: Provide document_id along with fields to update
  • Delete: Set is_delete: true along with document_id

Document Retrieval

Documents can be retrieved using:

  • get-documents - Returns all documents for a specific collection_id
  • get-document-details - Returns a specific document by document_id with 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