Knowledge and production

Query API

Call Kendr surfaces with cURL, JavaScript, Python, C#, Java, and Go.

Integration rules

Item Value
Base domain https://api.kendr.org
Public discovery GET /api/catalog, GET /api/public/models, and GET /api/openapi.json
Query execution POST /api/v1/query; Kendr validates auth and credits, executes the selected surface, then returns a stable Kendr result payload.
Primary server auth Authorization: Bearer kndr_live_... or X-API-Key: kndr_live_...
Customer state GET /api/me/dashboard returns user, packages, api_keys, purchases, ledger, and surfaces

Auth headers accepted by the query route

Mode Header When to use it
API key Authorization: Bearer kndr_live_... Best for server-to-server integrations and background jobs.
API key X-API-Key: kndr_live_... Alternative header when bearer auth is not convenient.
App session X-Kendr-Session: SESSION_TOKEN Best when your app just authenticated the user through Kendr.
OAuth bearer Authorization: Bearer kndr_oat_... Best for Kendr Desktop or CLI flows using PKCE or device code with the app scope.
Browser cookie kendr_session cookie Works for browser-origin requests after /api/auth/otp/verify.

Query request body

Field Required Meaning
surface Yes The Kendr surface key, such as web_search, ai_search, web_answer, google_search, google_maps, google_flights, or google_hotels.
query Yes The primary query string.
params No An object for optional values such as gl, hl, page, location, or travel fields.
Top-level extras No Optional params can also be sent beside surface and query. Kendr merges them with params.
{
  "surface": "google_search",
  "query": "best llm observability tools",
  "params": {
    "gl": "us",
    "hl": "en",
    "page": 1
  }
}

Query examples

Kendr is a plain HTTPS and JSON API. The same request contract works from JavaScript, Python, .NET, Java, and Go, so you can use whichever runtime already exists in your stack.

API key auth

curl https://api.kendr.org/api/v1/query \
  -X POST \
  -H "Authorization: Bearer $KENDR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "surface": "google_search",
    "query": "best llm observability tools",
    "params": {
      "gl": "us",
      "hl": "en",
      "page": 1
    }
  }'

App session auth

curl https://api.kendr.org/api/v1/query \
  -X POST \
  -H "X-Kendr-Session: $KENDR_SESSION" \
  -H "Content-Type: application/json" \
  -d '{
    "surface": "google_maps",
    "query": "coworking spaces in austin",
    "params": {
      "gl": "us",
      "hl": "en"
    }
  }'
Switch languages

Kendr currently ships helper clients for JavaScript and Python. Use the tabs to switch between Curl, JavaScript, Python, .NET, Java, and Go for the same query contract.

Server-side fetch request to POST /api/v1/query

const response = await fetch('https://api.kendr.org/api/v1/query', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.KENDR_API_KEY}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    surface: 'google_search',
    query: 'best llm observability tools',
    params: { gl: 'us', hl: 'en', page: 1 }
  })
});

const payload = await response.json();
console.log(payload.data, payload.remaining_credits);

Successful response and errors

Successful query response

{
  "ok": true,
  "surface": "google_search",
  "credits_charged": 1,
  "remaining_credits": 249,
  "data": {
    "results": [],
    "answer": "",
    "citations": []
  },
  "normalized": {
    "results": [],
    "answer": "",
    "citations": []
  }
}

Errors to handle

  • 400: invalid payload, missing surface, unsupported surface, or invalid JSON.
  • 401: no valid API key, session, or OAuth bearer token was supplied.
  • 402: the wallet does not have enough credits for the requested surface.
  • 502: the requested surface could not be completed.
Charging rule

Kendr charges credits only after the request succeeds. Failed attempts do not directly consume credits.