POST
/
query
import Hyperspell from 'hyperspell';

const client = new Hyperspell({
  apiKey: process.env['HYPERSPELL_API_KEY'], // This is the default and can be omitted
});

async function main() {
  const response = await client.query.search({ collections: 'string', query: 'query' });

  console.log(response.documents);
}

main();
{
  "total_sections": 123,
  "documents": [
    {
      "id": 123,
      "source": "generic",
      "resource_id": "<string>",
      "status": "pending",
      "title": "<string>",
      "created_at": "2023-11-07T05:31:56Z",
      "ingested_at": "2023-11-07T05:31:56Z",
      "metadata": {},
      "sections": [
        {
          "id": 123,
          "text": "",
          "scores": {
            "semantic_search": 123,
            "full_text_search": 123,
            "weighted": 123
          }
        }
      ],
      "collection": "<string>"
    }
  ]
}

Authorizations

Authorization
string
header
required

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

Body

application/json
query
string
required

Query to run.

collections
required

Only query documents in these collections.

filter
object

Filter the query results.

query_type
enum<string>

Type of query to run.

Available options:
auto,
semantic,
keyword
max_results
integer
default:
10

Maximum number of results to return.

include_elements
boolean
default:
false

Include the elements of a section in the results.

Response

200
application/json
Successful Response
total_sections
integer
required
documents
object[]
required