Manage documents after ingestion using the SDK.
List Documents
Retrieve paginated documents with filtering.
const documents = await client . documents . list ({
limit: 10 ,
containerTags: [ "user_123" ]
});
documents . forEach ( d => {
console . log ( d . id , d . title , d . status );
});
documents = client.documents.list(
limit = 10 ,
container_tags = [ "user_123" ]
)
for doc in documents.memories:
print (doc.id, doc.title, doc.status)
curl -X POST "https://api.supermemory.ai/v3/documents/list" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY " \
-H "Content-Type: application/json" \
-d '{"limit": 10, "containerTags": ["user_123"]}'
Response:
{
"memories" : [
{
"id" : "doc_abc123" ,
"title" : "Meeting notes" ,
"status" : "done" ,
"type" : "text" ,
"createdAt" : "2024-01-15T10:30:00Z" ,
"containerTags" : [ "user_123" ],
"metadata" : { "source" : "slack" }
}
],
"pagination" : {
"currentPage" : 1 ,
"totalPages" : 3 ,
"totalItems" : 25
}
}
Parameters
Parameter Type Default Description limitnumber 50 Items per page (max 200) pagenumber 1 Page number containerTagsstring[] — Filter by tags sortstring createdAtSort by createdAt or updatedAt orderstring descdesc (newest) or asc (oldest)
Get Document
Get a specific document with its processing status.
const doc = await client . documents . get ( "doc_abc123" );
console . log ( doc . status ); // "queued" | "processing" | "done" | "failed"
console . log ( doc . content );
doc = client.documents.get( "doc_abc123" )
print (doc.status)
print (doc.content)
curl "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY "
Processing Status
Status Description queuedWaiting to process extractingExtracting content (OCR, transcription) chunkingBreaking into searchable pieces embeddingCreating vector representations doneReady for search failedProcessing failed
async function waitForProcessing ( docId : string ) {
while ( true ) {
const doc = await client . documents . get ( docId );
if ( doc . status === "done" ) return doc ;
if ( doc . status === "failed" ) throw new Error ( "Processing failed" );
await new Promise ( r => setTimeout ( r , 2000 ));
}
}
Update Document
Update a document’s content or metadata. Triggers reprocessing.
await client . documents . update ( "doc_abc123" , {
content: "Updated content here" ,
metadata: { version: 2 , reviewed: true }
});
client.documents.update(
"doc_abc123" ,
content = "Updated content here" ,
metadata = { "version" : 2 , "reviewed" : True }
)
curl -X PUT "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY " \
-H "Content-Type: application/json" \
-d '{"content": "Updated content here", "metadata": {"version": 2}}'
Delete Documents
Permanently remove documents.
// Single delete
await client . documents . delete ( "doc_abc123" );
// Bulk delete by IDs
await client . documents . bulkDelete ({
ids: [ "doc_1" , "doc_2" , "doc_3" ]
});
// Bulk delete by container tag (delete all for a user)
await client . documents . bulkDelete ({
containerTags: [ "user_123" ]
});
# Single delete
client.documents.delete( "doc_abc123" )
# Bulk delete by IDs
client.documents.bulk_delete( ids = [ "doc_1" , "doc_2" , "doc_3" ])
# Bulk delete by container tag
client.documents.bulk_delete( container_tags = [ "user_123" ])
# Single delete
curl -X DELETE "https://api.supermemory.ai/v3/documents/doc_abc123" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY "
# Bulk delete by IDs
curl -X POST "https://api.supermemory.ai/v3/documents/bulk-delete" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY " \
-H "Content-Type: application/json" \
-d '{"ids": ["doc_1", "doc_2", "doc_3"]}'
Deletes are permanent — no recovery.
Processing Queue
Check documents currently being processed.
const response = await fetch ( "https://api.supermemory.ai/v3/documents/processing" , {
headers: { "Authorization" : `Bearer ${ API_KEY } ` }
});
const { documents } = await response . json ();
console . log ( ` ${ documents . length } documents processing` );
curl "https://api.supermemory.ai/v3/documents/processing" \
-H "Authorization: Bearer $SUPERMEMORY_API_KEY "
Next Steps