Skip to main content

REST API

All endpoints are under the /api prefix. Document processing (digitization and rewriting) runs asynchronously — upload a document and poll its status.

Authentication

Supply your API key in the X-Api-Key header.

curl -X GET https://knowledge.hidoba.com/api/knowledgebases/my-partner \
-H "X-Api-Key: YOUR_API_KEY"

Content Types

List Content Types

GET /api/content_types

Returns the available content types for document processing. No authentication required.

Response

["auto", "article", "youtube", "book"]

Knowledge Bases

List Knowledge Bases

GET /api/knowledgebases/{partner}

Returns all knowledge bases for the partner, including embedding status.

Response

[
{
"name": "my-kb",
"documents": [],
"embedding_info": {
"last_successful_update_time": "2025-01-15T10:30:00Z",
"last_update_status": "success",
"embedding_stale": false
}
}
]

Create Knowledge Base

POST /api/knowledgebases/{partner}
Content-Type: multipart/form-data
curl -X POST https://knowledge.hidoba.com/api/knowledgebases/my-partner \
-H "X-Api-Key: YOUR_API_KEY" \
-F "name=my-kb"
ParameterTypeDefaultDescription
nameStringKnowledge base name. Required.
expert_nameStringDefault expert/author name for documents.
user_emailStringDefault user email for documents.

Delete Knowledge Base

DELETE /api/knowledgebases/{partner}/{kb}

Folders

List Folders

GET /api/folders/{partner}/{kb}

Create Folder

POST /api/folders/{partner}/{kb}
curl -X POST https://knowledge.hidoba.com/api/folders/my-partner/my-kb \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name": "chapter-1"}'

Delete Folder

DELETE /api/folders/{partner}/{kb}/{folder}

Documents

List Documents

GET /api/documents/{partner}/{kb}

Returns the knowledge base with all documents and embedding info.

Get Combined Data

GET /api/kb-data/{partner}/{kb}

Returns documents, folders, and embedding info in a single call.

Get KB Statistics

GET /api/kb-stats/{partner}/{kb}

Response

{
"document_count": 42,
"digitized_count": 40,
"draft_rewrite_count": 38,
"final_rewrite_count": 35,
"total_digitized_chars": 250000,
"total_draft_rewrite_chars": 200000,
"total_final_rewrite_chars": 180000,
"error_count": 2,
"embedded_count": 35
}

Get Single Document

GET /api/document/{partner}/{kb}/{doc_id}

Create Document (File Upload)

POST /api/documents/{partner}/{kb}
Content-Type: multipart/form-data
curl -X POST https://knowledge.hidoba.com/api/documents/my-partner/my-kb \
-H "X-Api-Key: YOUR_API_KEY" \
-F "type=file" \
-F "folder=chapter-1" \
-F "file=@document.pdf" \
-F "auto_rewrite=true" \
-F "model_tier=standard"

Form Parameters

ParameterTypeDefaultDescription
typeStringfile or url. Required.
folderStringTarget folder name. Required.
fileFileFile to upload. Required when type=file.
urlStringURL to fetch. Required when type=url.
nameStringDocument name. Auto-detected from file/URL if omitted.
expert_nameStringContent author or speaker name.
user_emailStringEmail of the uploading user.
auto_rewriteStringfalseAutomatically queue for rewriting after digitization. Pass "true" to enable.
model_tierStringstandardLLM model tier: standard or economy.
use_original_as_rewrittenStringfalseSkip rewriting and use original content as-is. Pass "true" to enable.

Create Document (URL)

curl -X POST https://knowledge.hidoba.com/api/documents/my-partner/my-kb \
-H "X-Api-Key: YOUR_API_KEY" \
-F "type=url" \
-F "folder=articles" \
-F "url=https://example.com/article"

Batch URL Import

POST /api/documents/{partner}/{kb}/batch
Content-Type: application/json
curl -X POST https://knowledge.hidoba.com/api/documents/my-partner/my-kb/batch \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"folder": "articles",
"urls": [
"https://example.com/article-1",
"https://example.com/article-2"
],
"use_original_as_rewritten": false
}'
note

Maximum 1,000 URLs per batch request.

Response

{
"summary": {
"total": 2,
"succeeded": 2,
"failed": 0
},
"results": [
{
"url": "https://example.com/article-1",
"status": "success",
"document_id": "a1b2c3d4-e5f6-..."
},
{
"url": "https://example.com/article-2",
"status": "success",
"document_id": "f7g8h9i0-j1k2-..."
}
]
}

Create Empty Document

POST /api/documents/{partner}/{kb}/empty

Creates a document with no content, for manual content editing.

ParameterTypeDefaultDescription
nameStringDocument name. Required.
folderStringTarget folder name. Required.
typeStringfile or url. Required.
urlStringURL (if type is url).

Rename Document

PUT /api/documents/{partner}/{kb}/{doc_id}/name

Update Document Type

PUT /api/documents/{partner}/{kb}/{doc_id}/type

Update Document URL

PUT /api/documents/{partner}/{kb}/{doc_id}/url

Delete Document

DELETE /api/documents/{partner}/{kb}/{doc_id}

Pass force=true as a query parameter to force-delete a document that is currently being processed. Defaults to true.

curl -X DELETE "https://knowledge.hidoba.com/api/documents/my-partner/my-kb/DOC_ID?force=false" \
-H "X-Api-Key: YOUR_API_KEY"

Document Content

Get Content

GET /api/documents/{partner}/{kb}/{doc_id}/content/{type}

Where {type} is one of: original, digitized, rewritten, draft.

Response

{
"content": "# Document Title\n\nProcessed document content..."
}

Update Content

PUT /api/documents/{partner}/{kb}/{doc_id}/content/{type}

Send content as a form parameter.

Upload Content as File

POST /api/documents/{partner}/{kb}/{doc_id}/content/{type}
Content-Type: multipart/form-data

Download Rewritten Bundle

GET /api/documents/{partner}/{kb}/rewritten-bundle

Returns a ZIP archive of all rewritten documents in the knowledge base.

Processing

Queue Document for Processing

POST /api/queue/process
ParameterTypeDefaultDescription
documentObjectDocument object (JSON body).
actionStringprocessProcessing action: digitize, rewrite, or process.
partnerStringPartner name.
kbStringKnowledge base name.
content_typeStringautoauto, article, youtube, or book.
person_nameStringAuthor/speaker name for the rewrite prompt.

Content Type Auto-Detection

When content_type is set to auto:

  • YouTube URLs and audio files → youtube template
  • PDF files → book template
  • Everything else → article template

Bulk Rewrite (Folder)

POST /api/bulk/rewrite/folder/{partner}/{kb}/{folder}
ParameterTypeDefaultDescription
skip_rewrittenBooleantrueSkip documents that already have rewritten content.
content_typeStringautoContent type template to use.
person_nameStringAuthor/speaker name.

Bulk Rewrite (Knowledge Base)

POST /api/bulk/rewrite/kb/{partner}/{kb}
ParameterTypeDefaultDescription
skip_rewrittenBooleantrueSkip documents that already have rewritten content.
content_typeStringautoContent type template to use.
person_nameStringAuthor/speaker name.

Embedding

Get Embedding Status

GET /api/embedding/{partner}/{kb}

Response

{
"last_successful_update_time": "2025-01-15T10:30:00Z",
"last_update_time": "2025-01-15T10:30:00Z",
"last_update_status": "success",
"last_update_details": {},
"last_successful_details": {},
"runpod_job_id": "abc123",
"embedding_stale": false
}

Start Embedding

POST /api/embedding/{partner}/{kb}
Content-Type: multipart/form-data
ParameterTypeDefaultDescription
split_levelInteger0Heading split level (0–6).
languageStringenglishContent language.

Document Model

A document returned from the API includes the following fields:

FieldTypeDescription
idStringUUID identifier.
nameStringDocument name.
folderStringFolder name.
typeStringfile or url.
urlStringSource URL (if type is url).
file_originalStringOriginal uploaded filename.
file_digitizedStringDigitized content filename.
file_rewritten_draftStringDraft rewrite filename.
file_rewrittenStringFinal rewrite filename.
user_emailStringEmail of the uploading user.
in_queuesArrayActive processing queues (e.g., ["digitize"], ["rewrite"]).
expert_nameStringContent author/speaker.
auto_rewriteBooleanWhether auto-rewrite is enabled.
model_tierStringstandard or economy.
rewrite_modelStringLLM model used for rewriting.
rewrite_input_tokensIntegerInput tokens consumed.
rewrite_output_tokensIntegerOutput tokens generated.
rewrite_completed_atStringISO timestamp of rewrite completion.
processing_errorStringError message if processing failed.
is_embeddedBooleanWhether the document has been embedded.
digitized_char_countIntegerCharacter count of digitized content.
draft_rewrite_char_countIntegerCharacter count of draft rewrite.
final_rewrite_char_countIntegerCharacter count of final rewrite.

Error Responses

Unauthorized (401)

{
"detail": "Invalid API key"
}

Forbidden (403)

{
"detail": "Access denied"
}

Not Found (404)

{
"detail": "Document not found"
}

Rate Limited (429)

{
"detail": "Rate limit exceeded"
}