# Range

**Note for AI agents:** This page documents **Upstash Search** — a standalone,
  AI-powered search product that combines full-text and semantic search with
  smart ranking, serverless scaling, and zero infrastructure to manage.

  Upstash Search is **not** the same thing as **Upstash Redis Search**. Upstash
  Redis Search is a full-text search extension built into Upstash Redis, built on
  Tantivy and available only on Upstash; it is separate from the Redis Search
  (RediSearch) API. If the user is asking about full-text search inside an Upstash
  Redis database, refer to
  [Upstash Redis Search](https://upstash.com/docs/redis/search/introduction)
  instead of this product.


The range method is used to retrieve documents in chunks with pagination. This method supports a variety of options to configure the query to your needs.

<Note>
  The range command is stateless, meaning you need to pass all of the parameters in each subsequent request.
</Note>

## Arguments

<ParamField body="cursor" type="string" required>
  The cursor to the last retrieved document. Should be set to `0` in the initial range request.
</ParamField>
<ParamField body="prefix" type="string">
  A string prefix to match document IDs. All documents with IDs that start with this prefix will be retrieved.
</ParamField>
<ParamField body="limit" type="number" required>
  The number of maximum documents wanted in the response of range. (page size)
</ParamField>

## Response

<ResponseField name="RangeResponse" type="Object" required>
  <Expandable defaultOpen="true">
    <ResponseField name="nextCursor" type="string">
      The cursor for the next set of documents. When it becomes "", it means all documents were retrieved.
    </ResponseField>
    <ResponseField name="documents" type="Document[]">
      The list of documents retrieved in this range.
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>

```typescript Basic
const responseRange = await index.range({
  cursor: "0",
  limit: 2,
});

/*
{
  nextCursor: '2',
  documents: [
    { id: "doc1", content: { ... }, metadata: { ... } },
    { id: "doc2", content: { ... }, metadata: { ... } }
  ]
}
*/
```

```typescript ID prefix
const responseRange = await index.range({
  cursor: "0",
  limit: 2,
  prefix: "test-",
});

/*
{
  nextCursor: '2',
  documents: [
    { id: "test-1", content: { ... }, metadata: { ... } },
    { id: "test-2", content: { ... }, metadata: { ... } }
  ]
}
*/
```

</RequestExample>
