Skip to main content

documents.fetch_text_data

Lists stored text and summary chunks for a text namespace. Use it for export, UI, or bulk RAG context loading. Results are returned one page at a time (up to 100 items per page). When more data exists, the response includes pagination.has_more and pagination.next_token — pass that token on the next request to fetch the following page.

Parameters

namespace_name
str
required
The name of the target text namespace.
limit
int
Maximum number of items to return in this page. Must be between 1 and 100. Omit to use the API default (100).
next_token
str
Opaque cursor from the previous response’s pagination.next_token. Omit on the first request. Do not reuse a token from a different namespace or account.
Returns: FetchTextDataResponse — keys are snake_case: status, message, namespace, statistics, items, pagination, execution_time. Raises: NamespaceNotFound, InvalidInputError, AuthenticationError, APIError.

Example (sync, first page)

Fetch Text Data Example

Example (async)

Fetch Text Data Async Example

Pagination

1

First request

Call without next_token (optionally set limit, max 100).
2

Check pagination

If pagination.has_more is true, more chunks exist in the namespace.
3

Next page

Call again with next_token from the previous response.
4

Stop

Repeat until pagination.has_more is false or next_token is null.
Each page is a separate API call and counts toward your API request usage and credits.
Fetch all pages

Response overview

  • items: Text chunks for this page (length ≤ limit, max 100). Each item has id, text, optional metadata, created_at (ISO 8601 string or null), and is_summary.
  • statistics: Aggregated counts for this page only — e.g. total_items, total_text_chunks, total_summary_chunks, created_at_min, created_at_max, source_counts (created_at_min/created_at_max may be null).
  • pagination: limit, has_more, and next_token (null when there is no next page).
  • message: Human-readable summary for this page (e.g. “Fetched N text items from namespace ’…’”).

Complete example

Fetch Text Data Full Example

Important Notes

Text namespaces only: Vector-only namespaces are not supported for this route. The API returns an error if the namespace is not text-based.
Per-page statistics: statistics describes only the items in the current items array, not the full namespace total.
vs. Get Documents: Use fetch_text_data to list chunks in the namespace (with pagination); use documents.get with a list of ids when you already know which documents to retrieve in full.

Best practices

  • Treat items as read-only chunks for display or export; use Search for similarity queries.
  • Rely on snake_case keys in Python (is_summary, created_at, next_token, etc.).
  • Pass limit between 1 and 100; invalid values raise InvalidInputError before the request is sent.