Documents
SDK reference for documents operations
Overview
Document upload, processing, and management with multi-graph sharing
- Category:
storage - Auth Required: No
- Supported Modes: standard, delegated, service
Operations
upload
Upload and process a document (PDF, DOCX, TXT, MD). Returns normalized flat structure.
Arguments:
file(string, required): Base64 encoded file contentfilename(string, required): Original filename with extensionmimeType(string, required): MIME type (application/pdf, text/plain, etc.)graphId(string, optional): Target graph ID (defaults to user's personal graph)title(string, optional): Custom document titleproductTags(array, optional): Array of product tags for categorization
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, chunkCount, graphIds[], primaryGraphId, processingTimeMs. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Created document ID |
chunkCount | number | Number of chunks created |
graphIds | string[] | Array of graph IDs |
primaryGraphId | string | Primary/owner graph ID |
processingTimeMs | number | Processing time in milliseconds |
Example:
get
Get document metadata and content. Returns normalized flat structure.
Arguments:
documentId(string, required): Document ID to retrieve
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, title, filename, mimeType, fileSize, processingStatus, chunkCount, graphIds[], primaryGraphId, createdAt, createdByUserId, hasMultipleGraphs, chunks[]. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
title | string | Document title |
filename | string | Original filename |
mimeType | string | MIME type |
fileSize | number | File size in bytes |
processingStatus | string | Processing status |
chunkCount | number | Number of chunks |
graphIds | string[] | Graph IDs document is in |
primaryGraphId | string | Primary graph ID |
createdAt | number | Creation timestamp |
createdByUserId | string | Creator user ID |
hasMultipleGraphs | boolean | Whether shared to multiple graphs |
chunks | DocumentChunk[] | Document chunks |
chunks item fields (DocumentChunk)
| Field | Type | Description |
|---|---|---|
chunkId | string | Unique chunk ID |
documentId | string | Parent document ID |
content | string | Chunk text content |
position | number | Position/order in document |
Example:
getStatus
Get document processing status. Returns normalized flat structure.
Arguments:
documentId(string, required): Document ID to check
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, processingStatus, processingError, chunkCount, extractedAt, processingCompletedAt. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
processingStatus | string | Status: processing, completed, failed |
processingError | `string | null` |
chunkCount | number | Number of chunks |
extractedAt | `number | null` |
processingCompletedAt | `number | null` |
Example:
getChunks
Get all chunks for a document. Returns normalized flat chunk structures.
Arguments:
documentId(string, required): Document ID
Returns:
AdapterOperationResult - Returns { documentId, count, chunks[] }. Each chunk has FLAT fields: chunkId, documentId, content, position. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
count | number | Number of chunks |
chunks | DocumentChunk[] | Document chunks |
chunks item fields (DocumentChunk)
| Field | Type | Description |
|---|---|---|
chunkId | string | Unique chunk ID |
documentId | string | Parent document ID |
content | string | Chunk text content |
position | number | Position/order in document |
Example:
delete
Delete a document and all its chunks. Returns normalized flat structure.
Arguments:
documentId(string, required): Document ID to delete
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, deleted, chunksDeleted. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Deleted document ID |
deleted | boolean | Whether deletion succeeded |
chunksDeleted | number | Number of chunks deleted |
Example:
share
Share a document to another graph (group or user-contact). Returns normalized flat structure.
Arguments:
documentId(string, required): Document ID to sharetargetGraphId(string, required): Target graph ID to share toshareReason(string, optional): Optional reason for sharing
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, graphIds[], sharedToGraphId, sharedByUserId, sharedAt. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
graphIds | string[] | Updated graph IDs |
sharedToGraphId | string | Target graph ID |
sharedByUserId | string | User who shared |
sharedAt | number | Share timestamp |
Example:
unshare
Remove document access from a graph. Returns normalized flat structure.
Arguments:
documentId(string, required): Document IDgraphId(string, required): Graph ID to remove access from
Returns:
AdapterOperationResult - Returns FLAT structure with: documentId, graphIds[], removedGraphId. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
graphIds | string[] | Updated graph IDs |
removedGraphId | string | Removed graph ID |
Example:
listGraphs
List all graphs a document is shared in. Returns normalized flat graph structures.
Arguments:
documentId(string, required): Document ID
Returns:
AdapterOperationResult - Returns { documentId, count, graphs[] }. Each graph has FLAT fields: graphId, isPrimary, sharedAt, sharedByUserId, shareReason. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
documentId | string | Document ID |
count | number | Number of graphs |
graphs | DocumentGraphInfo[] | Graph information |
graphs item fields (DocumentGraphInfo)
| Field | Type | Description |
|---|---|---|
graphId | string | Graph ID |
isPrimary | boolean | Whether this is the primary/original graph |
sharedAt | number | Unix timestamp when shared |
sharedByUserId | `string | null` |
shareReason | `string | null` |
Example:
search
Semantic search across document chunks. Returns normalized flat chunk structures.
Arguments:
query(string, required): Search querygraphId(string, optional): Graph ID to search in (defaults to user's graph)limit(number, optional): Maximum results (default: 10)threshold(number, optional): Similarity threshold 0-1 (default: 0.7)
Returns:
AdapterOperationResult - Returns { graphId, count, results[] }. Each result has FLAT fields: chunkId, documentId, content, score, position. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
graphId | string | Searched graph ID |
count | number | Number of results |
results | DocumentSearchResult[] | Search results |
results item fields (DocumentSearchResult)
| Field | Type | Description |
|---|---|---|
chunkId | string | Unique chunk ID |
documentId | string | Parent document ID |
content | string | Chunk text content |
position | number | Position/order in document |
score | number | Similarity score 0-1 |
Example:
list
List documents in a graph. Returns normalized flat document structures.
Arguments:
graphId(string, optional): Graph ID to list documents from (defaults to user's graph)limit(number, optional): Maximum results (default: 50)offset(number, optional): Pagination offset (default: 0)
Returns:
AdapterOperationResult - Returns { graphId, count, documents[] }. Each document has FLAT fields: documentId, title, filename, mimeType, fileSize, processingStatus, chunkCount, graphIds[], createdAt, createdByUserId. No nested objects.
Response Fields:
| Field | Type | Description |
|---|---|---|
graphId | string | Listed graph ID |
count | number | Number of documents |
documents | DocumentSummary[] | Document summaries |
documents item fields (DocumentSummary)
| Field | Type | Description |
|---|---|---|
documentId | string | Unique document ID |
title | string | Document title |
filename | string | Original filename |
mimeType | string | MIME type of document |
fileSize | number | File size in bytes |
processingStatus | string | Processing status: processing, completed, failed |
chunkCount | number | Number of chunks document was split into |
graphIds | string[] | Array of graph IDs document is shared in |
createdAt | number | Unix timestamp of creation |
createdByUserId | string | User ID who created document |
Example: