---
title: ข้อมูลอ้างอิง API: Knowledge
description: Platform API v1 ส่วน Knowledge: path, พารามิเตอร์, ฟิลด์ของคำขอและคำตอบ, scope, idempotency และข้อผิดพลาดของทุก operation จาก contract
url: https://agentlab.cresclab.com/docs/th/api/knowledge
language: th
updated: 2026-12-05
---

# ข้อมูลอ้างอิง API: Knowledge

Platform API v1 ส่วน Knowledge: path, พารามิเตอร์, ฟิลด์ของคำขอและคำตอบ, scope, idempotency และข้อผิดพลาดของทุก operation จาก contract

> [!NOTE]
> สร้างจาก API contract (Agent Lab Platform API 1.0.0-alpha.1) คำอธิบายเป็นภาษาอังกฤษตามต้นฉบับใน contract

The workspace's knowledge library: documents and curated Q&A entries, which a run's
configuration names by id. Read and changed as the acting member, with what they may see
and do in the console.

## The workspace's knowledge documents

`GET /v1/workspaces/{workspaceId}/knowledge/documents`

The workspace library as the acting member sees it, newest first: documents whose audience
admits the member, and the member's own personal documents. A run's configuration names
documents from here by id.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:read` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `cursor` | query | `string` | ไม่ | The `nextCursor` of the previous page. Opaque. |
| `limit` | query | `integer` | ไม่ | Items per page. ค่าเริ่มต้น: `50`. |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `200` | `application/json`: [KnowledgeDocumentPage](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeDocumentPage) | A page of documents. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Upload a document to the library

`POST /v1/workspaces/{workspaceId}/knowledge/documents`

Stores the document and queues it for indexing, which runs in the background: the answer
is `queued`, and the document is usable once a later list shows it `ready`. Markdown and
plain text are sent as text (at most 2 MiB); a PDF is sent base64-encoded (at most 5 MiB
of PDF). The body is at most 8 MiB. Needs a member who may manage the workspace's
knowledge. `audience: team` admits the named teams and the workspace's owners and
administrators; it is set at upload so the document is never readable more widely first.
A large document may stop at `waiting_for_confirmation` until someone confirms its
indexing cost in the console.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:write` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### เนื้อหาคำขอ

`application/json`: [KnowledgeDocumentUpload](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeDocumentUpload)

| ฟิลด์ | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- |
| `title` | `string` | ใช่ | — |
| `sourceType` | `string` | ใช่ | ค่าที่เป็นไปได้: `markdown`, `text`, `pdf`. |
| `content` | `string` | ใช่ | The text, or for `pdf` the file base64-encoded. |
| `audience` | [KnowledgeAudience](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeAudience) | ไม่ | — |
| `audienceTeamIds` | `string (uuid)`[] | ไม่ | With `audience: team`, the teams it admits, by id. |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `201` | `application/json`: [KnowledgeDocument](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeDocument) | The stored document, queued for indexing. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `409` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The workspace holds as much of this as it may (`KNOWLEDGE_DOCUMENT_LIMIT_REACHED`, `recovery: configure`): remove some first. |
| `413` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The body is larger than the operation accepts (`PAYLOAD_TOO_LARGE`, `recovery: none`). |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Delete a document

`DELETE /v1/workspaces/{workspaceId}/knowledge/documents/{documentId}`

Removes the document from the library and from every answer that used it. Needs a member
who may manage the workspace's knowledge, or the owner of a personal document. A document
of another workspace is not found.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:write` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `documentId` | path | `string` | ใช่ | — |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `204` | — | Deleted. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## The workspace's Q&A entries

`GET /v1/workspaces/{workspaceId}/knowledge/qa`

Curated questions and answers the acting member's audience admits, newest first. With
`search`, only entries whose question or answer contains every word of it.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:read` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `cursor` | query | `string` | ไม่ | The `nextCursor` of the previous page. Opaque. |
| `limit` | query | `integer` | ไม่ | Items per page. ค่าเริ่มต้น: `50`. |
| `search` | query | `string` | ไม่ | Words that must each appear in the question or the answer. |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `200` | `application/json`: [KnowledgeQAPage](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeQAPage) | A page of entries. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Add a Q&A entry

`POST /v1/workspaces/{workspaceId}/knowledge/qa`

Usable in answers as soon as it is saved. Needs a member who may manage the workspace's
knowledge. `audience: team` admits the named teams and the workspace's owners and
administrators, from the moment the entry exists.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:write` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |

### เนื้อหาคำขอ

`application/json`: [KnowledgeQACreate](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeQACreate)

| ฟิลด์ | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- |
| `question` | `string` | ใช่ | — |
| `answer` | `string` | ใช่ | — |
| `audience` | [KnowledgeAudience](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeAudience) | ไม่ | — |
| `audienceTeamIds` | `string (uuid)`[] | ไม่ | With `audience: team`, the teams it admits, by id. |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `201` | `application/json`: [KnowledgeQAEntry](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeQAEntry) | The entry. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `413` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The body is larger than the operation accepts (`PAYLOAD_TOO_LARGE`, `recovery: none`). |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Reword a Q&A entry

`PATCH /v1/workspaces/{workspaceId}/knowledge/qa/{entryId}`

Replaces the question and the answer; every answer that uses the entry uses the new
wording. Who the entry is for does not change. Needs a member who may manage the
workspace's knowledge. An entry of another workspace is not found.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:write` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `entryId` | path | `string` | ใช่ | The Q&A entry, by id. |

### เนื้อหาคำขอ

`application/json`: [KnowledgeQAUpdate](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeQAUpdate)

| ฟิลด์ | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- |
| `question` | `string` | ใช่ | — |
| `answer` | `string` | ใช่ | — |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `200` | `application/json`: [KnowledgeQAEntry](https://agentlab.cresclab.com/docs/th/api/schemas.md#KnowledgeQAEntry) | The entry. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `413` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The body is larger than the operation accepts (`PAYLOAD_TOO_LARGE`, `recovery: none`). |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |

## Delete a Q&A entry

`DELETE /v1/workspaces/{workspaceId}/knowledge/qa/{entryId}`

Removes the entry from the library and from every answer that used it. Needs a member who
may manage the workspace's knowledge. An entry of another workspace is not found.

| Scope | ทำในนามของ | การยืนยันตัวตน | Idempotency-Key |
| --- | --- | --- | --- |
| `knowledge:write` | `member` | `installationToken` | — |

### พารามิเตอร์

| ชื่อ | ตำแหน่ง | ชนิด | จำเป็น | คำอธิบาย |
| --- | --- | --- | --- | --- |
| `workspaceId` | path | `string` | ใช่ | The workspace, by id. It must be the installation's. |
| `Agentlab-On-Behalf-Of` | header | `string` | ใช่ | The account id of the member the installation acts for: a current member of the workspace whose sign-in to the application there is still live, neither revoked nor expired. When the member's sign-in expires, the application acts for them again once they sign in again. |
| `entryId` | path | `string` | ใช่ | The Q&A entry, by id. |

### คำตอบ

| สถานะ | เนื้อหา | คำอธิบาย |
| --- | --- | --- |
| `204` | — | Deleted. |
| `400` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | The request itself is wrong, such as a `cursor` this list did not answer (`recovery: none`). |
| `401` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No token, or a token the platform does not honor. |
| `403` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Refused: `SCOPE_NOT_GRANTED` (`configure`); `WORKSPACE_NOT_INSTALLED`, the path names a workspace other than the installation's (`configure`); `MEMBER_REQUIRED`, no single `Agentlab-On-Behalf-Of` (`none`); `MEMBER_NOT_AUTHORIZED`, the named account is not a current member who signed in to the application here, or the member may not read or do this (`authorize`); `SERVER_TO_SERVER_ONLY`, sent from a browser (`none`); `PRODUCT_ACCESS_DENIED`, the workspace's plan does not include it (`configure`). |
| `404` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | No such operation or resource. |
| `429` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Rate limited (`recovery: retry`). |
| `503` | `application/json`: [Error](https://agentlab.cresclab.com/docs/th/api/schemas.md#Error) | Try again later (`recovery: retry`). |
