POST
/
search
curl --request POST \
  --url https://v2.api.supermemory.ai/search \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "q": "machine learning concepts",
  "documentThreshold": 0.5,
  "chunkThreshold": 0.5,
  "limit": 10,
  "rewriteQuery": false,
  "filters": {
    "AND": [
      {
        "key": "group",
        "value": "jira_users",
        "negate": false
      },
      {
        "filterType": "numeric",
        "key": "timestamp",
        "value": "1742745777",
        "negate": false,
        "numericOperator": ">"
      }
    ]
  },
  "categoriesFilter": [
    "technology",
    "science"
  ],
  "onlyMatchingChunks": false,
  "docId": "doc_xyz789",
  "userId": "user_123",
  "includeSummary": false,
  "rerank": false
}'
{
  "results": [
    {
      "documentId": "doc_xyz789",
      "chunks": [
        {
          "content": "Machine learning is a subset of artificial intelligence...",
          "isRelevant": true,
          "score": 0.85
        }
      ],
      "score": 0.95,
      "metadata": {
        "source": "web",
        "category": "technology",
        "tag_1": "ai",
        "tag_2": "machine-learning",
        "readingTime": 5,
        "isPublic": true
      },
      "title": "Introduction to Machine Learning",
      "createdAt": "1970-01-01T00:00:00.000Z",
      "updatedAt": "1970-01-01T00:00:00.000Z"
    }
  ],
  "total": 123,
  "timing": 123
}

Authorizations

x-api-key
string
header
required

Body

application/json
q
string
required

Search query string

Minimum length: 1
Example:

"machine learning concepts"

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

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

limit
integer
default:10

Maximum number of results to return

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

10

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

filters
object

Optional filters to apply to the search

Example:
{
  "AND": [
    {
      "key": "group",
      "value": "jira_users",
      "negate": false
    },
    {
      "filterType": "numeric",
      "key": "timestamp",
      "value": "1742745777",
      "negate": false,
      "numericOperator": ">"
    }
  ]
}
categoriesFilter
enum<string>[]

Optional category filters

Available options:
technology,
science,
business,
health
Example:
["technology", "science"]
onlyMatchingChunks
boolean
default:false

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

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"

userId
string

End user ID this search is associated with. NOTE: This also acts as a filter for the search.

Maximum length: 255
Example:

"user_123"

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

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

Response

200
application/json
Search results
results
object[]
required
total
number
required
timing
number
required