LiyaSupport
API Reference

Knowledge Base API

Programmatically manage knowledge base articles — create, update, search, and monitor retrieval analytics.

5 min read Updated July 2026

Endpoints

GET/v1/knowledge/articlesList articles
POST/v1/knowledge/articlesCreate an article
GET/v1/knowledge/articles/:idRetrieve an article
PATCH/v1/knowledge/articles/:idUpdate an article
DELETE/v1/knowledge/articles/:idDelete an article
POST/v1/knowledge/articles/:id/archiveArchive an article
POST/v1/knowledge/searchSearch articles
GET/v1/knowledge/gapsList knowledge gaps

Create an article

POST /v1/knowledge/articles

bash
curl -X POST https://api.liyasupport.com/v1/knowledge/articles \
  -H "Authorization: Bearer lsk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "title": "How to cancel my subscription",
    "body": "To cancel your subscription, go to Settings > Billing > Cancel plan...",
    "tags": ["billing", "cancellation"],
    "status": "published"
  }'

Request body parameters

ParameterTypeRequiredDescription
titlestringYesArticle title — used as the primary retrieval signal
bodystringYesArticle body text. Plain text or Markdown.
tagsstring[]NoTopic tags for filtering and retrieval context
statusstringNopublished (default) or draft. Drafts are not used in AI retrieval.

Response

json
{
  "id": "kb_01BILLING",
  "title": "How to cancel my subscription",
  "body": "To cancel your subscription...",
  "tags": ["billing", "cancellation"],
  "status": "published",
  "word_count": 187,
  "retrieval_count": 243,
  "indexed_at": "2026-07-03T14:22:05Z",
  "created_at": "2026-01-15T09:00:00Z",
  "updated_at": "2026-07-03T12:00:00Z"
}

Searching the knowledge base

Use the search endpoint to query your knowledge base using natural language — the same way Liya's AI retrieval works internally.

POST /v1/knowledge/search

bash
curl -X POST https://api.liyasupport.com/v1/knowledge/search \
  -H "Authorization: Bearer lsk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "query": "how do I get a refund for a cancelled order",
    "top_k": 5
  }'
json
{
  "results": [
    {
      "article_id": "kb_01REFUND",
      "title": "Refund policy and timelines",
      "relevance_score": 0.96,
      "excerpt": "Refunds are processed within 5–7 business days..."
    },
    {
      "article_id": "kb_01CANCEL",
      "title": "How to cancel an order",
      "relevance_score": 0.82,
      "excerpt": "Orders can be cancelled within 24 hours of placement..."
    }
  ]
}

Knowledge gap API

Programmatically access detected knowledge gaps — topics customers asked about where no article was found. Useful for building custom gap-triage workflows or exporting gaps to a content management system.

GET /v1/knowledge/gaps

bash
curl "https://api.liyasupport.com/v1/knowledge/gaps?limit=20&sort=frequency:desc" \
  -H "Authorization: Bearer lsk_live_..."
Use the Knowledge Gap API to build a weekly digest for your content team — export the top 10 gaps as a Notion database or Jira tickets to ensure new articles are written promptly.