POST
/
v3
/
search
Search documents
const url = 'https://api.supermemory.ai/v3/search';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"q":"machine learning concepts"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "results": [
    {
      "chunks": [
        {
          "content": "Machine learning is a subset of artificial intelligence...",
          "isRelevant": true,
          "score": 0.85
        }
      ],
      "createdAt": "1970-01-01T00:00:00.000Z",
      "documentId": "doc_xyz789",
      "metadata": {
        "category": "technology",
        "isPublic": true,
        "readingTime": 5,
        "source": "web",
        "tag_1": "ai",
        "tag_2": "machine-learning"
      },
      "score": 0.95,
      "summary": "A comprehensive guide to understanding the basics of machine learning and its applications.",
      "content": "This is the complete content of the document about machine learning concepts...",
      "title": "Introduction to Machine Learning",
      "updatedAt": "1970-01-01T00:00:00.000Z",
      "type": "web"
    }
  ],
  "timing": 123,
  "total": 123
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json
q
string
required

Search query string

Minimum length: 1
Example:

"machine learning concepts"

categoriesFilter
enum<string>[]
deprecated

Optional category filters

Example:
["technology", "science"]
chunkThreshold
number
default:0

Threshold / sensitivity for chunk selection. 0 is least sensitive (returns most chunks, more results), 1 is most sensitive (returns lesser chunks, accurate results)

Required range: 0 <= x <= 1
Example:

0.5

containerTags
string[]

Optional tags this search should be containerized by. This can be an ID for your user, a project ID, or any other identifier you wish to use to filter documents.

Example:
["user_123", "project_123"]
docId
string

Optional document ID to search within. You can use this to find chunks in a very large document.

Maximum length: 255
Example:

"doc_xyz789"

documentThreshold
number
default:0

Threshold / sensitivity for document selection. 0 is least sensitive (returns most documents, more results), 1 is most sensitive (returns lesser documents, accurate results)

Required range: 0 <= x <= 1
Example:

0.5

filters
object

Optional filters to apply to the search

Example:
{
"AND": [
{
"key": "group",
"negate": false,
"value": "jira_users"
},
{
"filterType": "numeric",
"key": "timestamp",
"negate": false,
"numericOperator": ">",
"value": "1742745777"
}
]
}
includeFullDocs
boolean
default:false

If true, include full document in the response. This is helpful if you want a chatbot to know the full context of the document.

Example:

false

includeSummary
boolean
default:false

If true, include document summary in the response. This is helpful if you want a chatbot to know the full context of the document.

Example:

false

limit
integer
default:10

Maximum number of results to return

Required range: 1 <= x <= 100
Example:

10

onlyMatchingChunks
boolean
default:true

If true, only return matching chunks without context. Normally, we send the previous and next chunk to provide more context for LLMs. If you only want the matching chunk, set this to true.

Example:

false

rerank
boolean
default:false

If true, rerank the results based on the query. This is helpful if you want to ensure the most relevant results are returned.

Example:

false

rewriteQuery
boolean
default:false

If true, rewrites the query to make it easier to find documents. This increases the latency by about 400ms

Example:

false

Response

Search results

results
object[]
required
timing
number
required
total
number
required