This commit is contained in:
Dhravya Shah 2025-01-31 15:42:02 -07:00
parent e4298c217d
commit feb3c34a96
13 changed files with 360 additions and 729 deletions

View file

@ -21,6 +21,7 @@ import {
spaces as spaceInDb,
spaceAccess,
type Space,
contentToSpace,
} from "@supermemory/db/schema";
import { google, openai } from "../providers";
import { randomId } from "@supermemory/shared";
@ -30,6 +31,8 @@ import {
database,
desc,
eq,
exists,
inArray,
or,
sql,
} from "@supermemory/db";
@ -457,16 +460,55 @@ const actions = new Hono<{ Variables: Variables; Bindings: Env }>()
query: z.string().min(1, "Search query cannot be empty"),
limit: z.number().min(1).max(50).default(10),
threshold: z.number().min(0).max(1).default(0),
spaces: z.array(z.string()).optional(),
})
),
async (c) => {
const { query, limit, threshold } = c.req.valid("json");
const { query, limit, threshold, spaces } = c.req.valid("json");
const user = c.get("user");
if (!user) {
return c.json({ error: "Unauthorized" }, 401);
}
const db = database(c.env.HYPERDRIVE.connectionString);
if (spaces && spaces.length > 0) {
const spaceDetails = await Promise.all(
spaces.map(async (spaceId) => {
const space = await db
.select()
.from(spaceInDb)
.where(eq(spaceInDb.uuid, spaceId))
.limit(1);
if (space.length === 0) return null;
return {
id: space[0].id,
ownerId: space[0].ownerId,
uuid: space[0].uuid
};
})
);
// Filter out any null values and check permissions
const validSpaces = spaceDetails.filter((s): s is NonNullable<typeof s> => s !== null);
const unauthorized = validSpaces.filter(s => s.ownerId !== user.id);
if (unauthorized.length > 0) {
return c.json(
{
error: "Space permission denied",
details: unauthorized.map(s => s.uuid).join(", "),
},
403
);
}
// Replace UUIDs with IDs for the database query
spaces.splice(0, spaces.length, ...validSpaces.map(s => s.id.toString()));
}
try {
// Generate embedding for the search query
const embeddings = await c.env.AI.run("@cf/baai/bge-base-en-v1.5", {
@ -497,7 +539,25 @@ const actions = new Hono<{ Variables: Variables; Bindings: Env }>()
.where(
and(
eq(documents.userId, user.id),
sql`1 - (embeddings <=> ${JSON.stringify(embeddings.data[0])}::vector) >= ${threshold}`
sql`1 - (embeddings <=> ${JSON.stringify(embeddings.data[0])}::vector) >= ${threshold}`,
...(spaces && spaces.length > 0
? [
exists(
db
.select()
.from(contentToSpace)
.where(
and(
eq(contentToSpace.contentId, documents.id),
inArray(
contentToSpace.spaceId,
spaces.map((spaceId) => Number(spaceId))
)
)
)
),
]
: [])
)
)
.orderBy(

View file

@ -5,6 +5,5 @@ mode: "center"
---
<Update label="2024-10-12" description="v0.1.1">
This is how you use a changelog with a label
and a description.
You can now search for memories in multiple spaces at once.
</Update>

View file

@ -1,37 +0,0 @@
---
title: 'Code Blocks'
description: 'Display inline code and code blocks'
icon: 'code'
---
## Basic
### Inline Code
To denote a `word` or `phrase` as code, enclose it in backticks (`).
```
To denote a `word` or `phrase` as code, enclose it in backticks (`).
```
### Code Block
Use [fenced code blocks](https://www.markdownguide.org/extended-syntax/#fenced-code-blocks) by enclosing code in three backticks and follow the leading ticks with the programming language of your snippet to get syntax highlighting. Optionally, you can also write the name of your code after the programming language.
```java HelloWorld.java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
````md
```java HelloWorld.java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
```
````

View file

@ -0,0 +1,86 @@
---
title: "Managing Multi-User Search Results"
description: "Learn how to handle search results for different users in Supermemory"
icon: "users"
---
When building multi-user applications with Supermemory, you'll often need to manage data for different users accessing the same account. Here's everything you need to know about handling multi-user scenarios:
## What are Spaces?
Spaces are Supermemory's way of organizing and separating data for different users or groups. They help you:
- Keep each user's data separate and organized
- Group related content together
- Manage access control efficiently
- Scale your application to multiple users
## How to Use Spaces
**Creating Spaces**
- Spaces are automatically provisioned when you use the `spaces` parameter
- No separate setup or initialization needed
- Example API call:
```bash
curl -X POST https://api.supermemory.ai/v1/add \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "This is the content of my first memory.", "spaces": ["user1", "user2"]}'
```
## Manually Creating Spaces
You can also manually create spaces by using the `/spaces/create` endpoint.
```bash
curl -X POST https://api.supermemory.ai/v1/spaces/create \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spaceName": "user1", "isPublic": false}'
```
Creating a public space will make it globally accessible to all users. By default, spaces are private.
## Retrieving Spaces
You can retrieve all spaces for a user by using the `/spaces` endpoint.
```bash
curl -X GET https://api.supermemory.ai/v1/spaces/list \
-H "Authorization: Bearer YOUR_API_KEY"
```
## Moving a content to a Specific Space
You can move a memory to a specific space by using the `space/addContent` endpoint and specifying the space id and the document id.
```bash
curl -X POST https://api.supermemory.ai/v1/space/addContent \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spaceId": "123", "documentId": "456"}'
```
## Retrieving Content from a Specific Space
You can retrieve content from a specific space by using the `/memories` endpoint and specifying the space id.
```bash
curl -X GET https://api.supermemory.ai/v1/memories \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spaceId": "123"}'
```
This also means that you can augment multiple spaces together to create a more complex search.
```bash
curl -X GET https://api.supermemory.ai/v1/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"spaces": ["person", "project", "team"], "query": "my query"}'
```
This will filter only for memories that are in all three spaces - `person`, `project`, and `team`.

View file

@ -1,59 +0,0 @@
---
title: 'Images and Embeds'
description: 'Add image, video, and other HTML elements'
icon: 'image'
---
<img
style={{ borderRadius: '0.5rem' }}
src="https://mintlify-assets.b-cdn.net/bigbend.jpg"
/>
## Image
### Using Markdown
The [markdown syntax](https://www.markdownguide.org/basic-syntax/#images) lets you add images using the following code
```md
![title](/path/image.jpg)
```
Note that the image file size must be less than 5MB. Otherwise, we recommend hosting on a service like [Cloudinary](https://cloudinary.com/) or [S3](https://aws.amazon.com/s3/). You can then use that URL and embed.
### Using Embeds
To get more customizability with images, you can also use [embeds](/writing-content/embed) to add images
```html
<img height="200" src="/path/image.jpg" />
```
## Embeds and HTML elements
<iframe
width="560"
height="315"
src="https://www.youtube.com/embed/4KzFe50RQkQ"
title="YouTube video player"
frameBorder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
allowFullScreen
style={{ width: '100%', borderRadius: '0.5rem' }}
></iframe>
<br />
<Tip>
Mintlify supports [HTML tags in Markdown](https://www.markdownguide.org/basic-syntax/#html). This is helpful if you prefer HTML tags to Markdown syntax, and lets you create documentation with infinite flexibility.
</Tip>
### iFrames
Loads another HTML page within the document. Most commonly used for embedding videos.
```html
<iframe src="https://www.youtube.com/embed/4KzFe50RQkQ"> </iframe>
```

View file

@ -1,88 +0,0 @@
---
title: 'Markdown Syntax'
description: 'Text, title, and styling in standard markdown'
icon: 'text-size'
---
## Titles
Best used for section headers.
```md
## Titles
```
### Subtitles
Best use to subsection headers.
```md
### Subtitles
```
<Tip>
Each **title** and **subtitle** creates an anchor and also shows up on the table of contents on the right.
</Tip>
## Text Formatting
We support most markdown formatting. Simply add `**`, `_`, or `~` around text to format it.
| Style | How to write it | Result |
| ------------- | ----------------- | --------------- |
| Bold | `**bold**` | **bold** |
| Italic | `_italic_` | _italic_ |
| Strikethrough | `~strikethrough~` | ~strikethrough~ |
You can combine these. For example, write `**_bold and italic_**` to get **_bold and italic_** text.
You need to use HTML to write superscript and subscript text. That is, add `<sup>` or `<sub>` around your text.
| Text Size | How to write it | Result |
| ----------- | ------------------------ | ---------------------- |
| Superscript | `<sup>superscript</sup>` | <sup>superscript</sup> |
| Subscript | `<sub>subscript</sub>` | <sub>subscript</sub> |
## Linking to Pages
You can add a link by wrapping text in `[]()`. You would write `[link to google](https://google.com)` to [link to google](https://google.com).
Links to pages in your docs need to be root-relative. Basically, you should include the entire folder path. For example, `[link to text](/writing-content/text)` links to the page "Text" in our components section.
Relative links like `[link to text](../text)` will open slower because we cannot optimize them as easily.
## Blockquotes
### Singleline
To create a blockquote, add a `>` in front of a paragraph.
> Dorothy followed her through many of the beautiful rooms in her castle.
```md
> Dorothy followed her through many of the beautiful rooms in her castle.
```
### Multiline
> Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
```md
> Dorothy followed her through many of the beautiful rooms in her castle.
>
> The Witch bade her clean the pots and kettles and sweep the floor and keep the fire fed with wood.
```
### LaTeX
Mintlify supports [LaTeX](https://www.latex-project.org) through the Latex component.
<Latex>8 x (vk x H1 - H2) = (0,1)</Latex>
```md
<Latex>8 x (vk x H1 - H2) = (0,1)</Latex>
```

View file

@ -1,66 +0,0 @@
---
title: 'Navigation'
description: 'The navigation field in mint.json defines the pages that go in the navigation menu'
icon: 'map'
---
The navigation menu is the list of links on every website.
You will likely update `mint.json` every time you add a new page. Pages do not show up automatically.
## Navigation syntax
Our navigation syntax is recursive which means you can make nested navigation groups. You don't need to include `.mdx` in page names.
<CodeGroup>
```json Regular Navigation
"navigation": [
{
"group": "Getting Started",
"pages": ["quickstart"]
}
]
```
```json Nested Navigation
"navigation": [
{
"group": "Getting Started",
"pages": [
"quickstart",
{
"group": "Nested Reference Pages",
"pages": ["nested-reference-page"]
}
]
}
]
```
</CodeGroup>
## Folders
Simply put your MDX files in folders and update the paths in `mint.json`.
For example, to have a page at `https://yoursite.com/your-folder/your-page` you would make a folder called `your-folder` containing an MDX file called `your-page.mdx`.
<Warning>
You cannot use `api` for the name of a folder unless you nest it inside another folder. Mintlify uses Next.js which reserves the top-level `api` folder for internal server calls. A folder name such as `api-reference` would be accepted.
</Warning>
```json Navigation With Folder
"navigation": [
{
"group": "Group Name",
"pages": ["your-folder/your-page"]
}
]
```
## Hidden Pages
MDX files not included in `mint.json` will not show up in the sidebar but are accessible through the search bar and by linking directly to them.

View file

@ -1,110 +0,0 @@
---
title: Reusable Snippets
description: Reusable, custom snippets to keep content in sync
icon: 'recycle'
---
import SnippetIntro from '/snippets/snippet-intro.mdx';
<SnippetIntro />
## Creating a custom snippet
**Pre-condition**: You must create your snippet file in the `snippets` directory.
<Note>
Any page in the `snippets` directory will be treated as a snippet and will not
be rendered into a standalone page. If you want to create a standalone page
from the snippet, import the snippet into another file and call it as a
component.
</Note>
### Default export
1. Add content to your snippet file that you want to re-use across multiple
locations. Optionally, you can add variables that can be filled in via props
when you import the snippet.
```mdx snippets/my-snippet.mdx
Hello world! This is my content I want to reuse across pages. My keyword of the
day is {word}.
```
<Warning>
The content that you want to reuse must be inside the `snippets` directory in
order for the import to work.
</Warning>
2. Import the snippet into your destination file.
```mdx destination-file.mdx
---
title: My title
description: My Description
---
import MySnippet from '/snippets/path/to/my-snippet.mdx';
## Header
Lorem impsum dolor sit amet.
<MySnippet word="bananas" />
```
### Reusable variables
1. Export a variable from your snippet file:
```mdx snippets/path/to/custom-variables.mdx
export const myName = 'my name';
export const myObject = { fruit: 'strawberries' };
```
2. Import the snippet from your destination file and use the variable:
```mdx destination-file.mdx
---
title: My title
description: My Description
---
import { myName, myObject } from '/snippets/path/to/custom-variables.mdx';
Hello, my name is {myName} and I like {myObject.fruit}.
```
### Reusable components
1. Inside your snippet file, create a component that takes in props by exporting
your component in the form of an arrow function.
```mdx snippets/custom-component.mdx
export const MyComponent = ({ title }) => (
<div>
<h1>{title}</h1>
<p>... snippet content ...</p>
</div>
);
```
<Warning>
MDX does not compile inside the body of an arrow function. Stick to HTML
syntax when you can or use a default export if you need to use MDX.
</Warning>
2. Import the snippet into your destination file and pass in the props
```mdx destination-file.mdx
---
title: My title
description: My Description
---
import { MyComponent } from '/snippets/custom-component.mdx';
Lorem ipsum dolor sit amet.
<MyComponent title={'Custom title'} />
```

View file

@ -1,318 +0,0 @@
---
title: 'Global Settings'
description: 'Mintlify gives you complete control over the look and feel of your documentation using the mint.json file'
icon: 'gear'
---
Every Mintlify site needs a `mint.json` file with the core configuration settings. Learn more about the [properties](#properties) below.
## Properties
<ResponseField name="name" type="string" required>
Name of your project. Used for the global title.
Example: `mintlify`
</ResponseField>
<ResponseField name="navigation" type="Navigation[]" required>
An array of groups with all the pages within that group
<Expandable title="Navigation">
<ResponseField name="group" type="string">
The name of the group.
Example: `Settings`
</ResponseField>
<ResponseField name="pages" type="string[]">
The relative paths to the markdown files that will serve as pages.
Example: `["customization", "page"]`
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="logo" type="string or object">
Path to logo image or object with path to "light" and "dark" mode logo images
<Expandable title="Logo">
<ResponseField name="light" type="string">
Path to the logo in light mode
</ResponseField>
<ResponseField name="dark" type="string">
Path to the logo in dark mode
</ResponseField>
<ResponseField name="href" type="string" default="/">
Where clicking on the logo links you to
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="favicon" type="string">
Path to the favicon image
</ResponseField>
<ResponseField name="colors" type="Colors">
Hex color codes for your global theme
<Expandable title="Colors">
<ResponseField name="primary" type="string" required>
The primary color. Used for most often for highlighted content, section
headers, accents, in light mode
</ResponseField>
<ResponseField name="light" type="string">
The primary color for dark mode. Used for most often for highlighted
content, section headers, accents, in dark mode
</ResponseField>
<ResponseField name="dark" type="string">
The primary color for important buttons
</ResponseField>
<ResponseField name="background" type="object">
The color of the background in both light and dark mode
<Expandable title="Object">
<ResponseField name="light" type="string" required>
The hex color code of the background in light mode
</ResponseField>
<ResponseField name="dark" type="string" required>
The hex color code of the background in dark mode
</ResponseField>
</Expandable>
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="topbarLinks" type="TopbarLink[]">
Array of `name`s and `url`s of links you want to include in the topbar
<Expandable title="TopbarLink">
<ResponseField name="name" type="string">
The name of the button.
Example: `Contact us`
</ResponseField>
<ResponseField name="url" type="string">
The url once you click on the button. Example: `https://mintlify.com/docs`
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="topbarCtaButton" type="Call to Action">
<Expandable title="Topbar Call to Action">
<ResponseField name="type" type={'"link" or "github"'} default="link">
Link shows a button. GitHub shows the repo information at the url provided including the number of GitHub stars.
</ResponseField>
<ResponseField name="url" type="string">
If `link`: What the button links to.
If `github`: Link to the repository to load GitHub information from.
</ResponseField>
<ResponseField name="name" type="string">
Text inside the button. Only required if `type` is a `link`.
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="versions" type="string[]">
Array of version names. Only use this if you want to show different versions
of docs with a dropdown in the navigation bar.
</ResponseField>
<ResponseField name="anchors" type="Anchor[]">
An array of the anchors, includes the `icon`, `color`, and `url`.
<Expandable title="Anchor">
<ResponseField name="icon" type="string">
The [Font Awesome](https://fontawesome.com/search?q=heart) icon used to feature the anchor.
Example: `comments`
</ResponseField>
<ResponseField name="name" type="string">
The name of the anchor label.
Example: `Community`
</ResponseField>
<ResponseField name="url" type="string">
The start of the URL that marks what pages go in the anchor. Generally, this is the name of the folder you put your pages in.
</ResponseField>
<ResponseField name="color" type="string">
The hex color of the anchor icon background. Can also be a gradient if you pass an object with the properties `from` and `to` that are each a hex color.
</ResponseField>
<ResponseField name="version" type="string">
Used if you want to hide an anchor until the correct docs version is selected.
</ResponseField>
<ResponseField name="isDefaultHidden" type="boolean" default="false">
Pass `true` if you want to hide the anchor until you directly link someone to docs inside it.
</ResponseField>
<ResponseField name="iconType" default="duotone" type="string">
One of: "brands", "duotone", "light", "sharp-solid", "solid", or "thin"
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="topAnchor" type="Object">
Override the default configurations for the top-most anchor.
<Expandable title="Object">
<ResponseField name="name" default="Documentation" type="string">
The name of the top-most anchor
</ResponseField>
<ResponseField name="icon" default="book-open" type="string">
Font Awesome icon.
</ResponseField>
<ResponseField name="iconType" default="duotone" type="string">
One of: "brands", "duotone", "light", "sharp-solid", "solid", or "thin"
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="tabs" type="Tabs[]">
An array of navigational tabs.
<Expandable title="Tabs">
<ResponseField name="name" type="string">
The name of the tab label.
</ResponseField>
<ResponseField name="url" type="string">
The start of the URL that marks what pages go in the tab. Generally, this
is the name of the folder you put your pages in.
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="api" type="API">
Configuration for API settings. Learn more about API pages at [API Components](/api-playground/demo).
<Expandable title="API">
<ResponseField name="baseUrl" type="string">
The base url for all API endpoints. If `baseUrl` is an array, it will enable for multiple base url
options that the user can toggle.
</ResponseField>
<ResponseField name="auth" type="Auth">
<Expandable title="Auth">
<ResponseField name="method" type='"bearer" | "basic" | "key"'>
The authentication strategy used for all API endpoints.
</ResponseField>
<ResponseField name="name" type="string">
The name of the authentication parameter used in the API playground.
If method is `basic`, the format should be `[usernameName]:[passwordName]`
</ResponseField>
<ResponseField name="inputPrefix" type="string">
The default value that's designed to be a prefix for the authentication input field.
E.g. If an `inputPrefix` of `AuthKey` would inherit the default input result of the authentication field as `AuthKey`.
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="playground" type="Playground">
Configurations for the API playground
<Expandable title="Playground">
<ResponseField name="mode" default="show" type='"show" | "simple" | "hide"'>
Whether the playground is showing, hidden, or only displaying the endpoint with no added user interactivity `simple`
Learn more at the [playground guides](/api-playground/demo)
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="maintainOrder" type="boolean">
Enabling this flag ensures that key ordering in OpenAPI pages matches the key ordering defined in the OpenAPI file.
<Warning>This behavior will soon be enabled by default, at which point this field will be deprecated.</Warning>
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="openapi" type="string | string[]">
A string or an array of strings of URL(s) or relative path(s) pointing to your
OpenAPI file.
Examples:
<CodeGroup>
```json Absolute
"openapi": "https://example.com/openapi.json"
```
```json Relative
"openapi": "/openapi.json"
```
```json Multiple
"openapi": ["https://example.com/openapi1.json", "/openapi2.json", "/openapi3.json"]
```
</CodeGroup>
</ResponseField>
<ResponseField name="footerSocials" type="FooterSocials">
An object of social media accounts where the key:property pair represents the social media platform and the account url.
Example:
```json
{
"x": "https://x.com/mintlify",
"website": "https://mintlify.com"
}
```
<Expandable title="FooterSocials">
<ResponseField name="[key]" type="string">
One of the following values `website`, `facebook`, `x`, `discord`, `slack`, `github`, `linkedin`, `instagram`, `hacker-news`
Example: `x`
</ResponseField>
<ResponseField name="property" type="string">
The URL to the social platform.
Example: `https://x.com/mintlify`
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="feedback" type="Feedback">
Configurations to enable feedback buttons
<Expandable title="Feedback">
<ResponseField name="suggestEdit" type="boolean" default="false">
Enables a button to allow users to suggest edits via pull requests
</ResponseField>
<ResponseField name="raiseIssue" type="boolean" default="false">
Enables a button to allow users to raise an issue about the documentation
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="modeToggle" type="ModeToggle">
Customize the dark mode toggle.
<Expandable title="ModeToggle">
<ResponseField name="default" type={'"light" or "dark"'}>
Set if you always want to show light or dark mode for new users. When not
set, we default to the same mode as the user's operating system.
</ResponseField>
<ResponseField name="isHidden" type="boolean" default="false">
Set to true to hide the dark/light mode toggle. You can combine `isHidden` with `default` to force your docs to only use light or dark mode. For example:
<CodeGroup>
```json Only Dark Mode
"modeToggle": {
"default": "dark",
"isHidden": true
}
```
```json Only Light Mode
"modeToggle": {
"default": "light",
"isHidden": true
}
```
</CodeGroup>
</ResponseField>
</Expandable>
</ResponseField>
<ResponseField name="backgroundImage" type="string">
A background image to be displayed behind every page. See example with
[Infisical](https://infisical.com/docs) and [FRPC](https://frpc.io).
</ResponseField>

View file

@ -1,8 +1,13 @@
---
title: Introduction
description: "Welcome to the home of your new documentation"
title: Introduction - Supermemory
description: "Supermemory is the Memory API for the AI era."
---
We built [Supermemory](https://supermemory.ai) and scaled the RAG system to 10,000,000+ documents and multiple thousands of users.
We faced challenges. It turns out that building scalable, reliable, production-ready Memory layer is pretty hard.
Introducing the Supermemory API. An _affordable_, _easy-to-use_, and _production-ready_ Memory API for the AI era.
<img
className="block dark:hidden"
src="/images/hero-light.svg"
@ -14,58 +19,151 @@ description: "Welcome to the home of your new documentation"
alt="Hero Dark"
/>
## Setting up
## Why Supermemory?
The first step to world-class documentation is setting up your editing environments.
### The problem
... so you want to build your own memory layer. Let's go through your decision process:
<Steps>
<Step title="Let's choose a vector database">
<Warning>
Found a vector database? good luck
- Oh no, it's way too expensive. Time to switch.
- Turns out it's painfully slow. Let's try another.
- Great, now it won't scale. Back to square one.
- The maintenance is a nightmare. Need something else.
</Warning>
</Step>
<Step title="Now for the embedding model">
<Note>
Which one to choose? Unless you have a PhD in AI, good luck figuring out:
- Which model fits your use case
- What are the performance tradeoffs
- How to keep up with new releases
</Note>
</Step>
<Step title="Time to build the memory layer">
<CardGroup cols={2}>
<Card title="Support multimodal">
- Websites: How do you handle JavaScript? What about rate limits?
- PDFs: OCR keeps failing, text extraction is inconsistent
- Images: Need computer vision models now?
- Audio/Video: Transcription costs add up quickly
</Card>
<Card title="Handle everything">
- Multiple languages: Different models for each?
- Various formats to parse: \
• Markdown: Tables break everything \
• HTML: Scripts and styles get in the way \
• PDF: Layout ruins the extraction \
• Word docs: Good luck with formatting \
• And somehow make it all work together...
</Card>
</CardGroup>
</Step>
</Steps>
And in the middle of all this, you're wondering...
> "When will I actually ship my product?"
### The solution
If you are not a fan of reinventing the wheel, you can use Supermemory.
<CardGroup cols={2}>
<Card
title="Edit Your Docs"
icon="pen-to-square"
href="https://mintlify.com/docs/quickstart"
>
Get your docs set up locally for easy development
<Card title="Affordable & Easy to Use" icon="circle-check" className="text-emerald-600">
<div className="text-emerald-700 space-y-1">
- Start for free, scale as you grow
- Simple API, deploy in minutes
- No complex setup or maintenance
- Clear, predictable pricing
</div>
</Card>
<Card
title="Preview Changes"
icon="image"
href="https://mintlify.com/docs/development"
>
Preview your changes before you push to make sure they're perfect
<Card title="Ready-made Connectors" icon="circle-check" className="text-emerald-600">
<div className="text-emerald-700 space-y-1">
- Notion, Google Drive, Slack integration
- Web scraping and PDF processing
- Email and calendar sync
- Custom connector SDK
</div>
</Card>
<Card title="Production Ready" icon="circle-check" className="text-emerald-600">
<div className="text-emerald-700 space-y-1">
- Enterprise-grade security
- Sub-200ms latency at scale
- Automatic failover and redundancy
- 99.9% uptime guarantee
</div>
</Card>
<Card title="Open Source & Trusted" icon="circle-check" className="text-emerald-600">
<div className="text-emerald-700 space-y-1">
- Open source core
- Active community
- Regular security audits
- Transparent development
</div>
</Card>
</CardGroup>
## Make it yours
Stop reinventing the wheel. Focus on building your product while we handle the memory infrastructure.
Update your docs to your brand and add valuable content for the best user conversion.
## Use cases
What can you do with Supermemory?
<CardGroup cols={2}>
<Card
title="Customize Style"
icon="palette"
href="https://mintlify.com/docs/settings/global"
title="Chat with <X> app"
icon="message"
>
Customize your docs to your company's colors and brands
Quickly built chat apps like:
• Chat with your Twitter bookmarks \
• Interact with your PDF documents \
• Chat with your company documentation \
• Chat with your personal knowledge base
... and more!
</Card>
<Card
title="Reference APIs"
icon="code"
href="https://mintlify.com/docs/api-playground/openapi"
title="Smart search in your apps"
icon="magnifying-glass"
>
Automatically generate endpoints from an OpenAPI spec
Search things with AI:
• Product recommendations \
• Knowledge base search \
• Document similarity matching \
• Content discovery systems \
• Research paper analysis
</Card>
<Card
title="Add Components"
icon="screwdriver-wrench"
href="https://mintlify.com/docs/content/components/accordions"
title="Assistants and Agents"
icon="chart-line"
>
Build interactive features and designs to guide your users
Assistants and Agents:
• Email management \
• Meeting summarization \
• Task prioritization \
• Calendar organization \
• Personal knowledge management
</Card>
<Card
title="Get Inspiration"
icon="stars"
href="https://mintlify.com/customers"
<Card
title="Import tools and integrations"
icon="toolbox"
>
Check out our showcase of our favorite documentation
You can contribute to supermemory by making community import tools. Examples:
• Notion \
• <a href="https://www.icloud.com/shortcuts/55f0695258cd46e4aad1aba8a2a7d14b">IOS shortcuts</a> \
• YOUR app / service
</Card>
</CardGroup>

View file

@ -60,14 +60,7 @@
},
{
"group": "Essentials",
"pages": [
"essentials/markdown",
"essentials/code",
"essentials/images",
"essentials/settings",
"essentials/navigation",
"essentials/reusable-snippets"
]
"pages": ["essentials/distinguishing-users"]
},
{
"group": "Changelog",

View file

@ -2,7 +2,7 @@
"openapi": "3.0.0",
"info": {
"title": "Supermemory API",
"version": "1.0",
"version": "1.0",
"description": "API for Supermemory personal knowledge management system"
},
"servers": [
@ -200,6 +200,43 @@
}
}
},
"/spaces/addContent": {
"post": {
"summary": "Add content to space",
"security": [
{
"bearerAuth": []
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"spaceId": {
"type": "string"
},
"documentId": {
"type": "string"
}
},
"required": ["spaceId", "documentId"]
}
}
}
},
"responses": {
"200": {
"description": "Content added to space successfully"
},
"401": {
"description": "Unauthorized"
}
}
}
},
"/memories": {
"get": {
"summary": "List memories",

View file

@ -1,6 +1,6 @@
---
title: 'Getting Started'
description: 'Start using Supermemory API in under 5 minutes'
title: "Getting Started"
description: "Start using Supermemory API in under 5 minutes"
---
## Getting Started
@ -26,16 +26,52 @@ To use the Supermemory API, you'll need:
![View API Key in Integrations](/images/setup/3.png)
Keep your API key secure and never share it publicly. You'll need this key for authenticating all API requests.
</Accordion>
</AccordionGroup>
## Base URL
All API requests should be made to:
```
https://api.supermemory.ai/v1
```
## Add your first memory
```bash
curl -X POST https://api.supermemory.ai/v1/add \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"content": "This is the content of my first memory."}'
```
This will add a new memory to your Supermemory account.
Try it out in the [API Playground](/api-reference/endpoints/add-new-content)
## Search your memories
```bash
curl -X GET https://api.supermemory.ai/v1/search \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "This is the content of my first memory."}'
```
Try it out in the [API Playground](/api-reference/endpoints/search-content)
## Get your memories
```bash
curl -X GET https://api.supermemory.ai/v1/memories \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json"
```
This will return a list of all your memories.
Try it out in the [API Playground](/api-reference/endpoints/list-memories)
That's it! You've now added your first memory and searched for it.