Basic Usage

To add a memory, send a POST request to /add with your content:

curl -X POST https://v2.api.supermemory.ai/add \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "This is the content of my memory",
    "metadata": {
      "x": "a",
      "y": "b"
    },
    "userId": "your-end-user-id"
  }'

The API will return a response with an ID and initial status:

{
  "id": "mem_abc123",
  "status": "queued"
}

Adding Web Content

To add content from a webpage, simply provide the URL:

curl -X POST https://v2.api.supermemory.ai/add \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "https://example.com/article",
    "metadata": {
      "source": "web",			# Just example metadata
      "category": "technology"	# NOT required
    }
  }'

Metadata and Organization

You can add rich metadata to organize your content:

{
  "metadata": {
    "source": "string",      // String 
    "priority": 1234,   // Custom numeric field
    "custom_field": "any"   // Any custom field
  }
}

Partitioning by user

You can attribute and partition your data by providing a userId:

curl -X POST https://v2.api.supermemory.ai/add \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "This is space-specific content",
    "userId": "space_123",
    "metadata": {
      "category": "space-content"
    }
  }'

When searching, if you provide a userId, only memories from that space will be returned.

Checking Status

Check status using the memory ID:

curl https://v2.api.supermemory.ai/memory/mem_abc123 \
  -H "x-api-key: YOUR_API_KEY"

Memories are deleted after 2 minutes if an irrecoverable error occurs.

Next Steps

Explore more advanced features in our API Reference.