
OCR API
Extract English text from common image formats
Build a private knowledge base and answer questions with citations
Upload PDF, TXT, Markdown, HTML, and DOCX files for product guides, policies, support content, and internal documentation.
Generate answers from the uploaded content and return the supporting document passages for review and display.
Separate content by product, project, customer, or tenant while using one consistent API contract.
Use familiar chat completion responses for regular requests or stream answer text as it is generated.
Send the complete conversation history your application wants the answer to consider on every request.
Refresh a same-name document safely or remove a document when its content is no longer needed.

HTTP Protocol:HTTPS
HTTP Method:POST
HTTP Endpoint:https://api.gugudata.io/ai/knowledge-bases/{knowledge_base_id}/chat/completions
Response Type:application/json; charset=utf-8
DEMO Endpoint:https://api.gugudata.io/ai/knowledge-bases/default/chat/completions/demo
Live Demo:Try Interactive Demo
Full API Docs:developers.gugudata.io
| Name | Type | Is Required | Default Value | Remark |
|---|---|---|---|---|
| knowledge_base_id | string | true | default | Knowledge base identifier in the URL path |
| appkey | string | true | YOUR_APPKEY | Application key obtained after subscription |
| model | string | false | gugudata-knowledge-chat | OpenAI Chat Completions compatible model name |
| messages | array<object> | true | [{"role":"user","content":"What does the documentation say?"}] | Complete client-managed conversation context with 1 to 20 system, user, or assistant messages |
| thread_id | string | false | Optional request correlation identifier; it does not restore server-side history | |
| tenant_id | string | false | default | Customer-defined knowledge base grouping; defaults to default |
| stream | boolean | false | false | Return real-time Server-Sent Events when true |
| top_k | integer | false | 6 | Number of retrieved source passages from 1 to 12 |
Upload documents and build a private knowledge base.
HTTP Endpoint:POST https://api.gugudata.io/ai/knowledge-bases/{knowledge_base_id}/documents
| Name | Type | Is Required | Remark |
|---|---|---|---|
| knowledge_base_id | string | true | Knowledge base identifier; default may be used |
| appkey | string | true | Application key obtained after subscription |
| files | array<file> | true | PDF, TXT, Markdown, HTML, or DOCX documents; up to 5 files and 20 MB per file |
| tenant_id | string | false | Customer-defined business grouping; defaults to default |
| metadata | object | false | Customer-defined metadata as a JSON object up to 8 KiB |
| replace_existing | boolean | false | Replace an existing document with the same name when true |
Delete one document and its searchable content from a private knowledge base.
HTTP Endpoint:DELETE https://api.gugudata.io/ai/knowledge-bases/{knowledge_base_id}/documents/{document_id}
| Name | Type | Is Required | Remark |
|---|---|---|---|
| knowledge_base_id | string | true | Knowledge base identifier |
| document_id | string | true | Document identifier returned by the upload operation |
| appkey | string | true | Application key obtained after subscription |
| tenant_id | string | false | Customer-defined knowledge base grouping; defaults to default |
| Name | Type | Remark |
|---|---|---|
| id | string | Chat completion response identifier |
| message_id | string | Identifier for the generated answer |
| object | string | OpenAI-compatible response object type |
| thread_id | string | Request correlation identifier returned to the client |
| choices[0].message.content | string | Answer generated from uploaded documents |
| sources | array<object> | Document passages cited by the answer |
| usage | object | Usage summary for the request |
| Status Code | Explanation of Status Code | Remarks |
|---|---|---|
| 200 | Request processed successfully. | Some endpoints expose a separate application-level status field in the response body, such as `dataStatus.statusCode`. |
| 400 | Invalid request parameters or request format. | Check required fields, data types, and request body format. |
| 401 | Missing or unknown application key. | Provide a valid `appkey` with the request. |
| 403 | The application key is recognized but access is not allowed. | The key may be expired, inactive, or not permitted for the requested API. |
| 429 | Request rate or trial usage limit exceeded. | Reduce concurrency or retry after the limit window resets. |
| 500 | Internal service error. | Retry later or contact support if the error persists. |
| 503 | Upstream service unavailable. | Retry later; the requested upstream dependency is temporarily unavailable. |
Connect your AI client once, authorize in the browser, and the client can use the GuGuData API tools available to your account. You do not need to paste an appkey into the MCP client.
https://mcp.gugudata.io/mcp{
"mcpServers": {
"gugudata": {
"url": "https://mcp.gugudata.io/mcp",
"transportType": "streamable-http"
}
}
}
Extract English text from common image formats

Extract searchable text from scanned PDFs

Turn scanned PDFs into editable Word documents.

Convert an image into an editable Word document with OCR