Batch add documents
documents.batch_add(DocumentBatchAddParams**kwargs) -> DocumentBatchAddResponse
POST/v3/documents/batch
Add multiple documents in a single request. Each document can have any content type (text, url, file, etc.) and metadata
Parameters
container_tag: Optional[str]
Optional tag this document should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to group documents.
maxLength100
Deprecatedcontainer_tags: Optional[Sequence[str]]
(DEPRECATED: Use containerTag instead) Optional tags this document should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to group documents.
entity_context: Optional[str]
Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction.
maxLength1500
Batch add documents
import os
from supermemory import Supermemory
client = Supermemory(
api_key=os.environ.get("SUPERMEMORY_API_KEY"), # This is the default and can be omitted
)
response = client.documents.batch_add(
documents=[{
"content": "Our API rate limits are 100 req/min on free and 1000 on pro. Clients should use exponential backoff on 429s."
}],
)
print(response.failed){
"failed": 0,
"results": [
{
"id": "id",
"status": "status",
"details": "details",
"error": "error"
}
],
"success": 0
}Returns Examples
{
"failed": 0,
"results": [
{
"id": "id",
"status": "status",
"details": "details",
"error": "error"
}
],
"success": 0
}