> ## Documentation Index
> Fetch the complete documentation index at: https://gaia-docs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List RAG Documents

> Retrieves all documents for a project with pagination and filtering

## Query Parameters

<ParamField query="projectId" type="string" required>
  Project ID to filter documents
</ParamField>

<ParamField query="status" type="string">
  Filter by document processing status

  * `pending` - Waiting to be processed
  * `processing` - Currently being indexed
  * `completed` - Successfully indexed
  * `failed` - Failed to index
</ParamField>

<ParamField query="limit" type="number" default={20}>
  Maximum number of documents to return per page
</ParamField>

<ParamField query="offset" type="number" default={0}>
  Number of documents to skip for pagination
</ParamField>

## Response

<ResponseField name="success" type="boolean">
  Whether the request was successful
</ResponseField>

<ResponseField name="documents" type="array">
  Array of document objects

  <Expandable title="Document Object">
    <ResponseField name="id" type="string">
      Document ID
    </ResponseField>

    <ResponseField name="projectId" type="string">
      Associated project ID
    </ResponseField>

    <ResponseField name="fileName" type="string">
      Document file name
    </ResponseField>

    <ResponseField name="fileType" type="string">
      File type
    </ResponseField>

    <ResponseField name="sourceType" type="string">
      Source type
    </ResponseField>

    <ResponseField name="status" type="string">
      Processing status
    </ResponseField>

    <ResponseField name="chunkCount" type="number">
      Number of chunks created
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="total" type="number">
  Total number of documents matching the query
</ResponseField>

<ResponseField name="hasMore" type="boolean">
  Whether there are more documents to fetch
</ResponseField>

<ResponseField name="nextOffset" type="number">
  Offset value for the next page
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X GET "https://api.example.com/api/knowledge/documents?projectId=proj_123&status=completed&limit=20&offset=0" \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    projectId: 'proj_123',
    status: 'completed',
    limit: '20',
    offset: '0'
  });

  const response = await fetch(
    `https://api.example.com/api/knowledge/documents?${params}`,
    {
      method: 'GET',
      headers: {
        'Authorization': 'Bearer YOUR_API_KEY'
      }
    }
  );

  const data = await response.json();
  ```

  ```python Python theme={null}
  import requests

  response = requests.get(
      'https://api.example.com/api/knowledge/documents',
      headers={'Authorization': 'Bearer YOUR_API_KEY'},
      params={
          'projectId': 'proj_123',
          'status': 'completed',
          'limit': 20,
          'offset': 0
      }
  )

  data = response.json()
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "success": true,
    "documents": [
      {
        "id": "doc_abc123",
        "projectId": "proj_123",
        "fileName": "product-guide.pdf",
        "fileType": "pdf",
        "sourceType": "upload",
        "status": "completed",
        "chunkCount": 45,
        "createdAt": "2026-01-15T10:30:00Z",
        "updatedAt": "2026-01-15T10:35:00Z"
      },
      {
        "id": "doc_def456",
        "projectId": "proj_123",
        "fileName": "api-docs.md",
        "fileType": "markdown",
        "sourceType": "url",
        "status": "completed",
        "chunkCount": 28,
        "createdAt": "2026-01-14T14:20:00Z",
        "updatedAt": "2026-01-14T14:22:00Z"
      }
    ],
    "total": 42,
    "hasMore": true,
    "nextOffset": 20
  }
  ```
</ResponseExample>
