API Reference
docs/API Reference/API Reference

API Reference

Complete API reference for KnowledgeSDK.

The KnowledgeSDK API is organized around REST. All requests and responses use JSON. The API is designed to be predictable: it uses standard HTTP status codes, returns consistent error formats, and follows conventional URL structures.

Base URL

All API requests should be made to:

terminal
https://api.knowledgesdk.com

Authentication

Every request must include your API key in the x-api-key header. You can get your API key from the dashboard.

terminal>_bash
curl https://api.knowledgesdk.com/v1/account \
  -H "x-api-key: sk_ks_your_api_key"

API keys start with the prefix sk_ks_ and are tied to your account. Keep your key secret — do not expose it in client-side code or public repositories.

Never expose your API key in frontend code, public repositories, or client-side applications. Always make API calls from your server.

Error Handling

The API returns standard HTTP status codes. Errors include a JSON body with a message field describing what went wrong.

Status CodeMeaning
200Success
400Bad request — check your parameters
401Unauthorized — invalid or missing API key
429Rate limited — you have exceeded your plan's rate limit
500Server error — something went wrong on our end
json snippet{}json
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid API key"
}

Rate Limits

Rate limits depend on your plan. When you exceed the limit, you will receive a 429 response with a Retry-After header indicating how many seconds to wait.

PlanRequests per minute
Usage10
Starter30
Pro60

Endpoints Overview

Knowledge Extraction

POST/v1/business

Synchronously run the full AI extraction pipeline on a URL. Crawls the site, classifies the business, and returns structured knowledge items. Typically takes 1-3 minutes.

POST/v1/business/async

Start an async business extraction job. Returns a jobId immediately. Poll with /v1/jobs/{jobId} or provide a callbackUrl to receive a webhook when complete.

POST/v1/business/stream

Stream business extraction progress via Server-Sent Events (SSE). Receive real-time updates as pages are scraped and knowledge is extracted.

POST/v1/search

Semantic search across your extracted knowledge using hybrid keyword + vector search. Filter by category and control result count.

Utilities

POST/v1/extract

Convert a single URL to clean, LLM-ready markdown. Useful for one-off page extraction without the full business pipeline.

POST/v1/screenshot

Capture a full-page screenshot of a URL. Returns a base64-encoded PNG image.

POST/v1/sitemap

Discover all URLs on a site via sitemap.xml parsing and link crawling.

Jobs

GET/v1/jobs/{jobId}

Check the status and result of an async extraction job.

Account

GET/v1/account

View your current plan, API key details, and usage statistics for the current billing period.

Detailed Endpoint Documentation