# List knowledge base documents

> The documents of a knowledge base, newest first, with their processing status.

Source: https://docs.stacksync.com/api-reference/knowledge-bases/documents/list_knowledge_base_documents

`GET https://api.stacksync.com/v1/workspaces/{workspace_id}/knowledge-bases/{knowledge_base_id}/documents`

- Operation: `list_knowledge_base_documents`
- Resource: Knowledge base documents
- Access: read-only

## Authentication

- `Authorization: Bearer <key>`: A workspace API key (workspace_…, created by a workspace owner under Workspace settings > Stacksync API) acts with editor rights on that workspace only; a user API key (user_…, created under Profile > Stacksync API) acts as that user in every workspace they belong to. POST, PUT and PATCH requests must send Content-Type: application/json. Every authentication failure answers 403.

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `workspace_id` | integer | Yes | The workspace. List the ones your key can reach with GET /v1/workspaces. |
| `knowledge_base_id` | string (uuid) | Yes | The knowledge base. |

## Query parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | integer, 1 to 200, default 50 | No | Maximum number of items returned, at most 200 |
| `offset` | integer, at least 0, default 0 | No | Number of items skipped before the first one returned |
| `region` | string (besg \| usnv) | Yes | Region of the knowledge base: besg (Europe) or usnv (United States) |

## Returns

### 200 OK

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `data` | array of object (KnowledgeBaseDocument) | Yes |  |
| `data[].document_id` | string | Yes |  |
| `data[].knowledge_base_id` | string | Yes |  |
| `data[].title` | string | Yes |  |
| `data[].mime_type` | string | Yes |  |
| `data[].file_id` | string | Yes |  |
| `data[].processing_status` | string \| null | Yes |  |
| `data[].processing_error` | string \| null | Yes |  |
| `data[].chunk_count` | integer \| null | Yes |  |
| `data[].created_time` | string (date-time) | Yes |  |
| `has_more` | boolean | Yes | Whether more items follow this page: request the next one with offset + limit |
| `limit` | integer | Yes |  |
| `offset` | integer | Yes |  |

## Example request

```bash
curl -X GET "https://api.stacksync.com/v1/workspaces/{workspace_id}/knowledge-bases/{knowledge_base_id}/documents?region=besg" \
  -H "Authorization: Bearer $STACKSYNC_API_KEY"
```

## Example response (200)

```json
{
  "data": [
    {
      "document_id": "<document_id>",
      "knowledge_base_id": "<knowledge_base_id>",
      "title": "<title>",
      "mime_type": "<mime_type>",
      "file_id": "<file_id>",
      "processing_status": "<processing_status>",
      "processing_error": "<processing_error>",
      "chunk_count": 0,
      "created_time": "2027-01-15T09:00:00Z"
    }
  ],
  "has_more": false,
  "limit": 0,
  "offset": 0
}
```

## Errors

| Status | Meaning | Body |
| --- | --- | --- |
| 400 | Bad Request | `{ "error": string, "msg": string, "field": string \| null }` |
| 403 | Forbidden | `{ "error": string, "msg": string, "field": string \| null }` |
| 404 | Not Found | `{ "error": string, "msg": string, "field": string \| null }` |

## Related

- [API Reference overview](https://docs.stacksync.com/api-reference): base URLs, regions, pagination, idempotency and errors
- [Authentication](https://docs.stacksync.com/api-reference/authentication): API keys and the 403 answers
- OpenAPI document: https://docs.stacksync.com/openapi.json
- [Get a knowledge base document](https://docs.stacksync.com/api-reference/knowledge-bases/documents/get_knowledge_base_document)
- [Add a knowledge base document](https://docs.stacksync.com/api-reference/knowledge-bases/documents/add_knowledge_base_document)
- [Remove a knowledge base document](https://docs.stacksync.com/api-reference/knowledge-bases/documents/remove_knowledge_base_document)