POST
/
memories
/
query
JavaScript
import Hyperspell from 'hyperspell';

const client = new Hyperspell({
  apiKey: 'My API Key',
});

const response = await client.memories.search({ query: 'query' });

console.log(response.documents);
{
  "errors": [
    {}
  ],
  "documents": [
    {
      "source": "collections",
      "resource_id": "<string>",
      "title": "<string>",
      "metadata": {
        "created_at": "2023-11-07T05:31:56Z",
        "indexed_at": "2023-11-07T05:31:56Z",
        "last_modified": "2023-11-07T05:31:56Z",
        "status": "pending",
        "events": [
          {
            "message": "<string>",
            "time": "2023-11-07T05:31:56Z",
            "type": "error"
          }
        ],
        "url": "<string>"
      },
      "score": 123
    }
  ],
  "answer": "<string>"
}

Authorizations

Authorization
string
header
required

API Key or JWT User Token. If using an API Key, set the X-As-User header to act as a specific user. A JWT User Token is always scoped to a specific user.

Body

application/json
query
string
required

Query to run.

answer
boolean
default:false

If true, the query will be answered along with matching source documents.

sources
enum<string>[]

Only query documents from these sources.

options
object

Search options for the query.

max_results
integer
default:10
deprecated

Maximum number of results to return.

Response

Successful Response

documents
Resource · object[]
required
errors
Errors · object[] | null

Errors that occurred during the query. These are meant to help the developer debug the query, and are not meant to be shown to the user.

answer
string | null

The answer to the query, if the request was set to answer.