Skip to main content
GET
https://api.moorcheh.ai
/
v1
/
namespaces
/
{namespace_name}
/
documents
/
fetch-text-data
curl -X GET "https://api.moorcheh.ai/v1/namespaces/{namespace_name}/documents/fetch-text-data" \
  -H "x-api-key: YOUR_API_KEY"
{
  "status": "success",
  "message": "Fetched 3 text items from namespace 'my-docs'.",
  "namespace": "my-docs",
  "statistics": {
    "total_items": 3,
    "total_text_chunks": 2,
    "total_summary_chunks": 1,
    "created_at_min": 1234567890123,
    "created_at_max": 1234567890456,
    "source_counts": {
      "upload": 2,
      "api": 1
    }
  },
  "items": [
    {
      "id": "chunk-id-or-doc-id",
      "text": "The actual text content of the chunk.",
      "metadata": {
        "source": "document.pdf",
        "page": "1",
        "summary_chunk_id": "my-docs#doc_summary_0"
      },
      "createdAt": 1234567890123,
      "isSummary": false
    },
    {
      "id": "doc_summary_0",
      "text": "Summary of the document content.",
      "metadata": {
        "source": "document.pdf",
        "page": "summary_0_chunks_0_2"
      },
      "createdAt": 1234567890123,
      "isSummary": true
    }
  ],
  "execution_time": 0.123
}

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. Authenticate with an API key; usage and credits apply. Response is limited to 100 items per request.
Only namespaces with type === "text" are supported. Vector-only namespaces are not supported.

Authentication

x-api-key
string
required
Your API key. API Gateway requires a valid API key for this route.

Path Parameters

namespace_name
string
required
Name of the text namespace (e.g. my-docs)
curl -X GET "https://api.moorcheh.ai/v1/namespaces/{namespace_name}/documents/fetch-text-data" \
  -H "x-api-key: YOUR_API_KEY"
{
  "status": "success",
  "message": "Fetched 3 text items from namespace 'my-docs'.",
  "namespace": "my-docs",
  "statistics": {
    "total_items": 3,
    "total_text_chunks": 2,
    "total_summary_chunks": 1,
    "created_at_min": 1234567890123,
    "created_at_max": 1234567890456,
    "source_counts": {
      "upload": 2,
      "api": 1
    }
  },
  "items": [
    {
      "id": "chunk-id-or-doc-id",
      "text": "The actual text content of the chunk.",
      "metadata": {
        "source": "document.pdf",
        "page": "1",
        "summary_chunk_id": "my-docs#doc_summary_0"
      },
      "createdAt": 1234567890123,
      "isSummary": false
    },
    {
      "id": "doc_summary_0",
      "text": "Summary of the document content.",
      "metadata": {
        "source": "document.pdf",
        "page": "summary_0_chunks_0_2"
      },
      "createdAt": 1234567890123,
      "isSummary": true
    }
  ],
  "execution_time": 0.123
}

Response Fields

Success Response (200)

status
string
Always "success" for 200 responses
message
string
Human-readable summary (e.g. “Fetched N text items from namespace ’…’”)
namespace
string
The requested namespace name
statistics
object
Aggregated counts and timestamps for the returned items
statistics.total_items
number
Number of items in items
statistics.total_text_chunks
number
Count of non-summary chunks
statistics.total_summary_chunks
number
Count of summary chunks
statistics.created_at_min
number | null
Earliest createdAt (Unix ms) among returned items
statistics.created_at_max
number | null
Latest createdAt (Unix ms) among returned items
statistics.source_counts
object
Map of source name → count. For uploads, keys may be file names (e.g. "document.pdf") or source types (e.g. "upload", "api").
items
array
List of text chunks (limit 100)
items[].id
string
Item/chunk identifier
items[].text
string
Text content of the chunk
items[].metadata
object
Arbitrary metadata (e.g. source, page, summary_chunk_id)
items[].createdAt
number | null
Creation time (Unix ms). You can convert it to a readable date in JavaScript:
Converting createdAt to a date string: If the value is in seconds, multiply by 1000 before passing to Date. If it is already in milliseconds (as in this API), pass it directly.
const date = new Date(createdAt);  // or new Date(seconds * 1000) if value is in seconds
if (isNaN(date.getTime())) return "Invalid date";
return date.toLocaleString(undefined, {
  dateStyle: "medium",
  timeStyle: "short",
});
items[].isSummary
boolean
true for summary chunks, false for regular text chunks
execution_time
number
Request processing time in seconds

Limits

Items per response

100 items per response. The items array length does not exceed this.

Credits & API requests

Each successful call consumes credits and counts toward your plan’s API request limit.