Skip to content
Get started

Add document

client.add(AddParams { content, containerTag, containerTags, 6 more } body, RequestOptionsoptions?): AddResponse { id, status }
POST/v3/documents

Add a document with any content type (text, url, file, etc.) and metadata

ParametersExpand Collapse
body: AddParams { content, containerTag, containerTags, 6 more }
content: string

The content to extract and process into a document. This can be a URL to a website, a PDF, an image, or a video.

containerTag?: string

Optional tag this document should be containerized by. Max 100 characters, alphanumeric with hyphens, underscores, and dots only.

DeprecatedcontainerTags?: Array<string>
customId?: string

Optional custom ID of the document. Max 100 characters, alphanumeric with hyphens, underscores, and dots only.

entityContext?: string

Optional entity context for this container tag. Max 1500 characters. Used during document processing to guide memory extraction.

maxLength1500
filepath?: string

Optional file path for the document. Used by supermemoryfs to store the full path of the file.

filterByMetadata?: Record<string, string | number | boolean | Array<string>>

Optional metadata filter to apply when pulling related memories and profile during ingestion. Only memories matching these filters will be used as context.

One of the following:
string
number
boolean
Array<string>
metadata?: Record<string, string | number | boolean | Array<string>>

Optional metadata for the document.

One of the following:
string
number
boolean
Array<string>
taskType?: "memory" | "superrag"

Task type: “memory” (default) for full context layer with SuperRAG built in, “superrag” for managed RAG as a service.

One of the following:
"memory"
"superrag"
ReturnsExpand Collapse
AddResponse { id, status }
id: string

Unique identifier of the document

status: string

Status of the document

Add document

import Supermemory from 'supermemory';

const client = new Supermemory({
  apiKey: process.env['SUPERMEMORY_API_KEY'], // This is the default and can be omitted
});

const response = await client.add({ content: 'content' });

console.log(response.id);
{
  "id": "id",
  "status": "status"
}
Returns Examples
{
  "id": "id",
  "status": "status"
}