## 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 - `documents: Union[Iterable[DocumentsUnionMember0], Sequence[str]]` - `Iterable[DocumentsUnionMember0]` - `content: str` The content to extract and process into a document. This can be a URL to a website, a PDF, an image, or a video. Plaintext: Any plaintext format URL: A URL to a website, PDF, image, or video We automatically detect the content type from the url's response format. - `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. - `container_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. - `custom_id: Optional[str]` Optional custom ID of the document. This could be an ID from your database that will uniquely identify this document. - `entity_context: Optional[str]` Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. - `filepath: Optional[str]` Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. - `filter_by_metadata: Optional[Dict[str, Union[str, float, bool, Sequence[str]]]]` Optional metadata filter scoping which existing memories are pulled as context during ingestion. Scalar values match exactly (AND across keys); array values match ANY (OR within key). Only memories whose source documents match this filter are used as context. - `str` - `float` - `bool` - `Sequence[str]` - `metadata: Optional[Dict[str, Union[str, float, bool, Sequence[str]]]]` Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. - `str` - `float` - `bool` - `Sequence[str]` - `task_type: Optional[Literal["memory", "superrag"]]` Task type: "memory" (default) for full context layer with SuperRAG built in, "superrag" for managed RAG as a service. - `"memory"` - `"superrag"` - `Sequence[str]` - `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. - `container_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. - `content: Optional[None]` - `entity_context: Optional[str]` Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction. - `filepath: Optional[str]` Optional file path for the document (e.g., '/documents/reports/file.pdf'). Used by supermemoryfs to map documents to filesystem paths. - `filter_by_metadata: Optional[Dict[str, Union[str, float, bool, Sequence[str]]]]` Optional metadata filter scoping which existing memories are pulled as context during ingestion. Scalar values match exactly (AND across keys); array values match ANY (OR within key). Only memories whose source documents match this filter are used as context. - `str` - `float` - `bool` - `Sequence[str]` - `metadata: Optional[Dict[str, Union[str, float, bool, Sequence[str]]]]` Optional metadata for the document. This is used to store additional information about the document. You can use this to store any additional information you need about the document. Metadata can be filtered through. Keys must be strings and are case sensitive. Values can be strings, numbers, or booleans. You cannot nest objects. - `str` - `float` - `bool` - `Sequence[str]` - `task_type: Optional[Literal["memory", "superrag"]]` Task type: "memory" (default) for full context layer with SuperRAG built in, "superrag" for managed RAG as a service. - `"memory"` - `"superrag"` ### Returns - `class DocumentBatchAddResponse: …` - `failed: float` Count of documents that failed to add - `results: List[Result]` Array of results for each document in the batch - `id: str` Unique identifier of the document (empty string for failed items) - `status: str` Status of the document (e.g. 'done', 'queued', 'error') - `details: Optional[str]` Additional error details when status is 'error' - `error: Optional[str]` Error message when status is 'error' - `success: float` Count of documents successfully added ### Example ```python 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) ``` #### Response ```json { "failed": 0, "results": [ { "id": "id", "status": "status", "details": "details", "error": "error" } ], "success": 0 } ```