Documents API
Create, read, update, and delete documents programmatically.
Read time:8 minUpdated:2026-01-10
Documents API
Manage your knowledge base documents through the API.
List Documents
GET /v1/documents
Query Parameters
| Parameter | Type | Description |
|---|---|---|
limit |
integer | Results per page (max 100) |
cursor |
string | Pagination cursor |
category_id |
string | Filter by category |
state |
string | Filter by state (draft, published, archived) |
author_id |
string | Filter by author |
search |
string | Full-text search |
Example Request
curl -X GET "https://api.tynebase.com/v1/documents?state=published&limit=10" \
-H "Authorization: Bearer YOUR_API_KEY"
Example Response
{
"success": true,
"data": [
{
"id": "doc_abc123",
"title": "Getting Started Guide",
"slug": "getting-started-guide",
"state": "published",
"category": {
"id": "cat_xyz",
"name": "Quick start"
},
"author": {
"id": "usr_123",
"name": "John Doe"
},
"view_count": 1250,
"created_at": "2026-01-05T10:00:00Z",
"updated_at": "2026-01-10T14:30:00Z",
"published_at": "2026-01-06T09:00:00Z"
}
],
"pagination": {
"has_more": true,
"next_cursor": "eyJpZCI6ImRvY180NTYifQ"
}
}
Get Document
GET /v1/documents/{document_id}
Example Response
{
"success": true,
"data": {
"id": "doc_abc123",
"title": "Getting Started Guide",
"slug": "getting-started-guide",
"content": "# Getting Started\n\nWelcome to TyneBase...",
"content_type": "markdown",
"state": "published",
"category_id": "cat_xyz",
"author_id": "usr_123",
"assigned_to": null,
"is_public": true,
"view_count": 1250,
"helpful_count": 45,
"current_version": 3,
"metadata": {
"tags": ["getting-started", "basics"],
"reading_time": 5
},
"created_at": "2026-01-05T10:00:00Z",
"updated_at": "2026-01-10T14:30:00Z"
}
}
Create Document
POST /v1/documents
Request Body
{
"title": "New API Guide",
"content": "# API Guide\n\nThis guide explains...",
"category_id": "cat_xyz",
"state": "draft",
"is_public": false,
"metadata": {
"tags": ["api", "integration"]
}
}
Example
curl -X POST "https://api.tynebase.com/v1/documents" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"title": "New API Guide",
"content": "# API Guide\n\nThis guide explains...",
"category_id": "cat_xyz"
}'
Update Document
PATCH /v1/documents/{document_id}
Request Body
{
"title": "Updated Title",
"content": "# Updated Content",
"state": "published"
}
Delete Document
DELETE /v1/documents/{document_id}
Note: Deleting a document also removes:
- All versions
- Embeddings from AI index
- Associated comments
For soft delete, set state to archived instead.
Document Versions
List Versions
GET /v1/documents/{document_id}/versions
Restore Version
POST /v1/documents/{document_id}/versions/{version_number}/restore