curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100" \
-H "x-api-key: YOUR_API_KEY"
curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100&next_token=PASTE_TOKEN_FROM_PREVIOUS_RESPONSE" \
-H "x-api-key: YOUR_API_KEY"
{
"status": "success",
"message": "Fetched 100 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 100,
"total_text_chunks": 95,
"total_summary_chunks": 5,
"created_at_min": "2025-12-19T18:18:57.370Z",
"created_at_max": "2025-12-19T18:20:01.120Z",
"source_counts": {
"my-docs": 100
}
},
"items": [
{
"id": "api-reference_ai_generate_chunk_0",
"text": "Generate AI-powered answers to questions...",
"metadata": {
"chunk_index": 0,
"heading": "Overview",
"source": "my-docs",
"title": "Generate AI Answer - Overview"
},
"created_at": "2025-12-19T18:18:57.700Z",
"is_summary": false
}
],
"pagination": {
"limit": 100,
"has_more": true,
"next_token": "eyJ1c2VySWQiOiI..."
},
"execution_time": 1.381
}
{
"status": "success",
"message": "Fetched 20 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 20,
"total_text_chunks": 18,
"total_summary_chunks": 2,
"created_at_min": "2025-12-19T18:21:00.000Z",
"created_at_max": "2025-12-19T18:22:30.000Z",
"source_counts": {
"my-docs": 20
}
},
"items": [],
"pagination": {
"limit": 100,
"has_more": false,
"next_token": null
},
"execution_time": 0.412
}
{
"status": "failure",
"message": "Bad Request: Missing namespace name in URL path."
}
{
"status": "failure",
"message": "Invalid limit: must be a positive integer."
}
{
"status": "failure",
"message": "Invalid next_token: token does not match requested namespace."
}
{
"status": "failure",
"message": "Bad Request: Namespace 'your-namespace' is not a text-based namespace."
}
{
"status": "failure",
"message": "Unauthorized: Missing API key"
}
{
"status": "failure",
"message": "Unauthorized: Invalid API key ID"
}
{
"status": "failure",
"message": "Namespace 'your-namespace' not found."
}
{
"status": "failure",
"message": "Internal Server Error during namespace validation."
}
Data Operations
Fetch Text Data
List text and summary chunks from a text-type namespace with cursor pagination. Use for export, display, or bulk RAG context loading.
GET
/
v1
/
namespaces
/
{namespace_name}
/
documents
/
fetch-text-data
curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100" \
-H "x-api-key: YOUR_API_KEY"
curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100&next_token=PASTE_TOKEN_FROM_PREVIOUS_RESPONSE" \
-H "x-api-key: YOUR_API_KEY"
{
"status": "success",
"message": "Fetched 100 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 100,
"total_text_chunks": 95,
"total_summary_chunks": 5,
"created_at_min": "2025-12-19T18:18:57.370Z",
"created_at_max": "2025-12-19T18:20:01.120Z",
"source_counts": {
"my-docs": 100
}
},
"items": [
{
"id": "api-reference_ai_generate_chunk_0",
"text": "Generate AI-powered answers to questions...",
"metadata": {
"chunk_index": 0,
"heading": "Overview",
"source": "my-docs",
"title": "Generate AI Answer - Overview"
},
"created_at": "2025-12-19T18:18:57.700Z",
"is_summary": false
}
],
"pagination": {
"limit": 100,
"has_more": true,
"next_token": "eyJ1c2VySWQiOiI..."
},
"execution_time": 1.381
}
{
"status": "success",
"message": "Fetched 20 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 20,
"total_text_chunks": 18,
"total_summary_chunks": 2,
"created_at_min": "2025-12-19T18:21:00.000Z",
"created_at_max": "2025-12-19T18:22:30.000Z",
"source_counts": {
"my-docs": 20
}
},
"items": [],
"pagination": {
"limit": 100,
"has_more": false,
"next_token": null
},
"execution_time": 0.412
}
{
"status": "failure",
"message": "Bad Request: Missing namespace name in URL path."
}
{
"status": "failure",
"message": "Invalid limit: must be a positive integer."
}
{
"status": "failure",
"message": "Invalid next_token: token does not match requested namespace."
}
{
"status": "failure",
"message": "Bad Request: Namespace 'your-namespace' is not a text-based namespace."
}
{
"status": "failure",
"message": "Unauthorized: Missing API key"
}
{
"status": "failure",
"message": "Unauthorized: Invalid API key ID"
}
{
"status": "failure",
"message": "Namespace 'your-namespace' not found."
}
{
"status": "failure",
"message": "Internal Server Error during namespace validation."
}
Overview
Get text chunks from a text-type namespace via the public API. Use this to list stored text/summary chunks for display, export, or RAG. Results are returned one page at a time. Each page returns up to 100 items. When more data exists, the response includespagination.has_more and a pagination.next_token — pass that token on the next request to fetch the following page.
Only namespaces with
type === "text" are supported. Vector-only namespaces are not supported.Authentication
Path Parameters
Query Parameters
next_token is tied to your API key user and namespace. Do not reuse a token from a different namespace or account.Pagination
1
First request
GET .../fetch-text-data?limit=100 (or omit limit for the default of 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:
GET .../fetch-text-data?limit=100&next_token=<token>4
Stop
Repeat until
pagination.has_more is false or next_token is null.curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100" \
-H "x-api-key: YOUR_API_KEY"
curl -X GET "https://api.moorcheh.ai/v1/namespaces/my-docs/documents/fetch-text-data?limit=100&next_token=PASTE_TOKEN_FROM_PREVIOUS_RESPONSE" \
-H "x-api-key: YOUR_API_KEY"
{
"status": "success",
"message": "Fetched 100 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 100,
"total_text_chunks": 95,
"total_summary_chunks": 5,
"created_at_min": "2025-12-19T18:18:57.370Z",
"created_at_max": "2025-12-19T18:20:01.120Z",
"source_counts": {
"my-docs": 100
}
},
"items": [
{
"id": "api-reference_ai_generate_chunk_0",
"text": "Generate AI-powered answers to questions...",
"metadata": {
"chunk_index": 0,
"heading": "Overview",
"source": "my-docs",
"title": "Generate AI Answer - Overview"
},
"created_at": "2025-12-19T18:18:57.700Z",
"is_summary": false
}
],
"pagination": {
"limit": 100,
"has_more": true,
"next_token": "eyJ1c2VySWQiOiI..."
},
"execution_time": 1.381
}
{
"status": "success",
"message": "Fetched 20 text items from namespace 'my-docs'.",
"namespace": "my-docs",
"statistics": {
"total_items": 20,
"total_text_chunks": 18,
"total_summary_chunks": 2,
"created_at_min": "2025-12-19T18:21:00.000Z",
"created_at_max": "2025-12-19T18:22:30.000Z",
"source_counts": {
"my-docs": 20
}
},
"items": [],
"pagination": {
"limit": 100,
"has_more": false,
"next_token": null
},
"execution_time": 0.412
}
{
"status": "failure",
"message": "Bad Request: Missing namespace name in URL path."
}
{
"status": "failure",
"message": "Invalid limit: must be a positive integer."
}
{
"status": "failure",
"message": "Invalid next_token: token does not match requested namespace."
}
{
"status": "failure",
"message": "Bad Request: Namespace 'your-namespace' is not a text-based namespace."
}
{
"status": "failure",
"message": "Unauthorized: Missing API key"
}
{
"status": "failure",
"message": "Unauthorized: Invalid API key ID"
}
{
"status": "failure",
"message": "Namespace 'your-namespace' not found."
}
{
"status": "failure",
"message": "Internal Server Error during namespace validation."
}
Response Fields
Success Response (200)
Earliest item timestamp on this page as ISO 8601 (e.g.
"2025-12-19T18:18:57.370Z"). Computed by normalizing each item’s stored createdAt (ISO string or Unix s/ms) and converting the minimum back to ISO. null when no item has a parseable date.Latest item timestamp on this page as ISO 8601. Same normalization as
created_at_min. null when no item has a parseable date.Map of source name → count on this page. Keys may be file names, upload sources, or namespace identifiers.
Limits
Items per page
Up to 100 items per request. Use
limit and next_token to walk the full namespace.Credits & API requests
Each page is one API call and consumes credits toward your plan’s API request limit.
Export all pages (example)
async function fetchAllTextChunks(apiKey, namespace) {
const base = "https://api.moorcheh.ai/v1";
const allItems = [];
let nextToken;
do {
const params = new URLSearchParams({ limit: "100" });
if (nextToken) params.set("next_token", nextToken);
const res = await fetch(
`${base}/namespaces/${encodeURIComponent(namespace)}/documents/fetch-text-data?${params}`,
{ headers: { "x-api-key": apiKey } }
);
const body = await res.json();
if (!res.ok) throw new Error(body.message || res.statusText);
allItems.push(...(body.items || []));
nextToken = body.pagination?.has_more ? body.pagination.next_token : null;
} while (nextToken);
return allItems;
}
Related Endpoints
- Get Documents - Retrieve specific documents by ID
- Upload Text Data - Add text documents to a namespace
- Search - Semantic search over namespace content
Was this page helpful?