API ReferencecontentAdd

Add Content

This endpoint allows you to add new content to your memories. It supports various content types including web pages, tweets, documents, and custom content.

POST /api/add

Request Body

{
  // Required: The content to add (URL or text)
  content: string,
  
  // Optional: Array of space IDs to add content to (max 5)
  spaces?: string[],
  
  // Optional: Pre-fetched content data
  prefetched?: {
    contentToVectorize: string,
    contentToSave: string,
    title: string,
    type: string,
    description?: string,
    ogImage?: string
  }
}

Field Descriptions

FieldTypeRequiredDescription
contentstringYesThe content to add. Must not be empty. Can be a URL or text content.
spacesstring[]NoArray of space IDs where the content should be added. Maximum 5 spaces allowed.
prefetchedobjectNoPre-fetched content data for optimization
prefetched.contentToVectorizestringYes*Content to be vectorized for search
prefetched.contentToSavestringYes*Content to be saved in the database
prefetched.titlestringYes*Title of the content
prefetched.typestringYes*Type of the content
prefetched.descriptionstringNoDescription of the content
prefetched.ogImagestringNoOpen Graph image URL

*Required if prefetched object is provided

Response

Success Response

{
  "message": "Content added successfully",
  "id": "add-user123-abc456",
  "type": "page"
}
FieldTypeDescription
messagestringSuccess message
idstringUnique identifier for the added content
typestringType of content that was added

Error Responses

400 Bad Request

{
  "error": "Could not determine content type",
  "details": "Error message details"
}

401 Unauthorized

{
  "error": "You must be logged in to add content"
}

403 Forbidden

{
  "error": "Space permission denied",
  "details": "space123: Not authorized to add to this space"
}

409 Conflict

{
  "error": "That page already exists in your memories"
}

500 Internal Server Error

{
  "error": "Failed to queue content for processing"
}

Notes

  1. Authentication is required for this endpoint
  2. Content type is automatically determined if not provided in prefetched
  3. URLs are validated for accessibility before processing
  4. Space permissions are checked if spaces are specified:
    • For public spaces, only the owner can add content
    • For private spaces, both owner and users in the allowlist can add content
  5. Duplicate content detection is implemented to prevent redundant entries

Examples

Adding a Web Page

{
  "content": "https://example.com/article",
  "spaces": ["space123", "space456"]
}

Adding Text Content with Pre-fetched Data

{
  "content": "My important note",
  "prefetched": {
    "contentToVectorize": "My important note about AI",
    "contentToSave": "My important note about AI",
    "title": "AI Notes",
    "type": "note",
    "description": "Personal notes about artificial intelligence"
  }
}