Knowledge Base API Documentation

GET
/kb/api/articles

Retrieves a list of all articles in the knowledge base. Supports filtering and pagination.

Query Parameters

Name Type Required Description
category string No Filters articles by a specific category slug.
tag string No Filters articles by a specific tag slug.
search string No Performs a full-text search across article titles and content.
page integer No Specifies the page number for pagination (default: 1).
limit integer No Specifies the number of articles per page (default: 10).

Response Example (200 OK)

[
    {
        "id": "abc123xyz",
        "title": "Getting Started with the Knowledge Base API",
        "slug": "getting-started-kb-api",
        "summary": "A brief overview of how to use our API to access knowledge base content.",
        "created_at": "2023-10-27T10:00:00Z",
        "updated_at": "2023-10-27T10:00:00Z",
        "tags": ["api", "getting-started", "documentation"],
        "category": "api-documentation"
    },
    {
        "id": "def456uvw",
        "title": "Troubleshooting Common Issues",
        "slug": "troubleshooting-common-issues",
        "summary": "Solutions to frequently encountered problems within the platform.",
        "created_at": "2023-10-26T14:30:00Z",
        "updated_at": "2023-10-26T15:15:00Z",
        "tags": ["troubleshooting", "support", "faq"],
        "category": "support"
    }
]
GET
/kb/api/articles/{id}

Retrieves a single article by its unique ID.

Path Parameters

Name Type Required Description
id string Yes The unique identifier of the article to retrieve.

Response Example (200 OK)

{
    "id": "abc123xyz",
    "title": "Getting Started with the Knowledge Base API",
    "slug": "getting-started-kb-api",
    "summary": "A brief overview of how to use our API to access knowledge base content.",
    "content": "## Introduction\n\nWelcome to the Knowledge Base API! This API allows you to programmatically access all articles within our knowledge base. You can retrieve articles, filter them by category or tag, and even perform searches.\n\n## Endpoints\n\n### Getting All Articles\n\n- **Method:** GET\n- **Path:** `/kb/api/articles`\n- **Description:** Retrieves a list of articles. Supports query parameters for filtering and pagination.\n\n### Getting a Single Article\n\n- **Method:** GET\n- **Path:** `/kb/api/articles/{id}`\n- **Description:** Retrieves a specific article using its ID.\n\n```json\n{\n  \"id\": \"abc123xyz\",\n  \"title\": \"Getting Started with the Knowledge Base API\",\n  \"slug\": \"getting-started-kb-api\",\n  \"summary\": \"A brief overview of how to use our API to access knowledge base content.\",\n  \"created_at\": \"2023-10-27T10:00:00Z\",\n  \"updated_at\": \"2023-10-27T10:00:00Z\",\n  \"tags\": [\"api\", \"getting-started\", \"documentation\"],\n  \"category\": \"api-documentation\"\n}\n```\n\n...",
    "created_at": "2023-10-27T10:00:00Z",
    "updated_at": "2023-10-27T10:00:00Z",
    "tags": ["api", "getting-started", "documentation"],
    "category": "api-documentation"
}

Response Example (404 Not Found)

{
    "error": "Article not found",
    "message": "The article with the specified ID could not be found."
}
POST
/kb/api/articles

Creates a new article in the knowledge base.

Request Body

Requires a JSON object with the following fields:

Field Type Required Description
title string Yes The title of the article.
content string Yes The full content of the article (can be Markdown).
summary string No A brief summary or excerpt of the article.
tags array of strings No An array of tags associated with the article.
category string No The category slug for the article.

Response Example (201 Created)

{
    "id": "ghi789rst",
    "title": "New Feature: Advanced Search",
    "slug": "new-feature-advanced-search",
    "summary": "Introducing our powerful new search functionality.",
    "created_at": "2023-10-28T09:15:00Z",
    "updated_at": "2023-10-28T09:15:00Z",
    "tags": ["new-feature", "search", "api"],
    "category": "updates"
}

Response Example (400 Bad Request)

{
    "error": "Validation failed",
    "message": "Title and content are required fields."
}
PUT
/kb/api/articles/{id}

Updates an existing article identified by its ID.

Path Parameters

Name Type Required Description
id string Yes The unique identifier of the article to update.

Request Body

A JSON object containing the fields to update. All fields are optional.

Field Type Required Description
title string No The new title of the article.
content string No The new full content of the article.
summary string No The new summary or excerpt.
tags array of strings No The new array of tags.
category string No The new category slug.

Response Example (200 OK)

{
    "id": "abc123xyz",
    "title": "Getting Started with the Knowledge Base API (Updated)",
    "slug": "getting-started-kb-api",
    "summary": "An updated overview of how to use our API.",
    "created_at": "2023-10-27T10:00:00Z",
    "updated_at": "2023-10-28T11:45:00Z",
    "tags": ["api", "getting-started", "documentation", "updated"],
    "category": "api-documentation"
}

Response Example (404 Not Found)

{
    "error": "Article not found",
    "message": "The article with the specified ID could not be found."
}
DELETE
/kb/api/articles/{id}

Deletes an article from the knowledge base by its ID.

Path Parameters

Name Type Required Description
id string Yes The unique identifier of the article to delete.

Response Example (204 No Content)

A successful deletion returns no response body.

Response Example (404 Not Found)

{
    "error": "Article not found",
    "message": "The article with the specified ID could not be found."
}
GET
/kb/api/categories

Retrieves a list of all available categories.

Response Example (200 OK)

[
    {
        "id": "cat-001",
        "name": "API Documentation",
        "slug": "api-documentation",
        "article_count": 15
    },
    {
        "id": "cat-002",
        "name": "Support",
        "slug": "support",
        "article_count": 42
    },
    {
        "id": "cat-003",
        "name": "Product Updates",
        "slug": "updates",
        "article_count": 8
    }
]
GET
/kb/api/tags

Retrieves a list of all used tags.

Response Example (200 OK)

[
    {
        "id": "tag-001",
        "name": "API",
        "slug": "api",
        "article_count": 20
    },
    {
        "id": "tag-002",
        "name": "Getting Started",
        "slug": "getting-started",
        "article_count": 5
    },
    {
        "id": "tag-003",
        "name": "Troubleshooting",
        "slug": "troubleshooting",
        "article_count": 30
    }
]

Authentication

Requests to the Knowledge Base API generally do not require authentication for reading content. However, actions such as creating, updating, or deleting articles may require an API key or authentication token. Please consult your API provider for specific authentication requirements.

Common authentication methods include: