GET
/
documents
/
list
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() {
  // Automatically fetches more pages as needed.
  for await (const documentListResponse of client.documents.list({ collection: 'collection' })) {
    console.log(documentListResponse.id);
  }
}

main();
{
  "items": [
    {
      "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
          },
          "elements": [
            {
              "id": "<string>",
              "type": "text",
              "text": "<string>",
              "summary": "<string>",
              "metadata": {
                "title_level": 123,
                "links": [
                  "<string>"
                ],
                "filename": "<string>",
                "languages": [
                  "<string>"
                ],
                "page_number": 123,
                "author": "<string>",
                "continued_from": "<string>"
              }
            }
          ],
          "embedding_e5_large": [
            123
          ],
          "embedding_ts": "<string>",
          "document_id": 123,
          "metadata": {}
        }
      ],
      "sections_count": 123,
      "collection": ""
    }
  ],
  "next_cursor": "<string>"
}

Authorizations

Authorization
string
header
required

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

Query Parameters

collection
string
required
cursor
string | null
size
integer
default:
50
Required range: 0 < x < 100

Response

200
application/json
Successful Response
items
object[]
required
next_cursor
string | null
required