Skip to content
ToolsHow it works
  • Online stores“kya ye blue mein bhi hai?”
  • Couriers“Where's my parcel?”
  • Clinics, salons and schools“Saturday ko walk-in hota hai?”
  • Agencies and studios“What would an app like this cost?”
  • Software and SaaS“Does it work with Shopify?”
  • Property listings“3-bed under 2 crore in DHA?”
See them side by side on the home page
PricingDevelopersHelp
Sign inStart free
ToolsHow it worksPricingDevelopersHelp
For your business
Online storesCouriersClinics, salons and schoolsAgencies and studiosSoftware and SaaSProperty listings
Sign inStart free

Your website just got a front desk. One that checks.

ToolsLeads and live chatHow it worksFor your businessPricingFAQHelp centreDevelopersAPIBuild sites for clients? Resell BitSign in
Bit forOnline storesCouriersClinics, salons and schoolsAgencies and studiosSoftware and SaaSProperty listings
CompareBit vs ChatbaseBit vs TidioBit vs ChatlingChatbots in Pakistan
© 2026 AskBitTermsPrivacyCookiesRefundsLegal
Help centre/API reference

API reference

Version 1 · Base URL https://askbit.io

In short

  • Make a key in your dashboard under Settings, Advanced, API keys. Each key works for one site.
  • Send it as Authorization: Bearer bit_… with every request.
  • POST /v1/sites/{siteId}/knowledge adds, updates and removes pages in your assistant's knowledge. It answers from them straight away.
  • Using WordPress? The Bit plugin does all of this for you; you don't need the API.

Contents

  1. Overview
  2. Authentication
  3. Send content
  4. Check a key
  5. Revoke a key
  6. Errors
  7. Limits and good practice
  8. Examples
  9. Signed pushes from your build

1. Overview

Bit's API lets your own code keep your assistant's knowledge up to date: your site's build can send every page when you deploy, or your CMS can send an article the moment it's published, instead of waiting for Bit to read your site again.

  • Every request goes to https://askbit.io over HTTPS, with a JSON body where there is one.
  • Responses are JSON. Errors have an error code (see Errors).
  • Your site id is in your dashboard's address (/dashboard/{siteId}), and GET /v1/key returns it.

More endpoints will come on the same keys, starting with reading leads and conversations.

2. Authentication

Owners and admins make keys in the dashboard, under Settings, Advanced, API keys. A key looks like bit_ followed by 43 letters, digits, - and _. It's shown once: store it in your server's environment variables, never in a web page or an app people can download, because anyone holding it can use it.

Send it with every request:

Header
Authorization: Bearer bit_YOUR_KEY

Each key works for one site and carries scopes, chosen when it's made:

ScopeLets the key
knowledge:writesend pages to the site's knowledge, and remove them
site:readread the site's id, assistant name and domains, and revoke itself

We keep only a fingerprint of each key, so a lost key can't be shown again: revoke it in the dashboard and make another. A revoked key stops working at once. The WordPress plugin makes its own key when you press Connect; it shows in the same list.

3. Send content

POST/v1/sites/{siteId}/knowledge

Scope knowledge:write. Adds or updates the documents you send, matched by url, and removes the addresses in remove. A document whose content hasn't changed since last time is left alone, so sending everything again is cheap. The assistant uses new content from its next reply.

Request body

FieldTypeWhat it is
documentsarray, requiredUp to 2,000 documents to add or update. Can be empty when you only remove.
removearray of stringsUp to 500 addresses to forget, whatever put them there (a page Bit read from your site, too). An address that's also in documents is kept.
completebooleanDefault false. When true, this request is everything you send: documents sent before through the API (or the WordPress plugin) that aren't in it are removed. Pages Bit read from your site and files you uploaded are never removed this way. Only use it when one request holds all your content.

A document

FieldTypeWhat it is
urlstring, requiredIts address, up to 500 characters. For pages on your own site use the path without a trailing slash (/pricing): the same key Bit gives a page it read, so yours replaces that copy. Unique within a request.
kindstring, requiredWhat it is, up to 40 characters: page, post, faq, product, service, policy…
titlestring, requiredUp to 300 characters.
summarystringOne or two sentences, up to 500 characters.
bodystring, requiredThe text, up to 200,000 characters. Plain text or light Markdown; ## headings help the assistant find the right part of a long page.
updatedAtstringWhen it last changed, as an ISO 8601 date. Optional.

Response

200 with counts: documents added, updated, unchanged and removed, and how many searchable pieces were stored.

200 OK
{
  "added": 1,
  "updated": 0,
  "unchanged": 0,
  "removed": 1,
  "chunks": 3,
  "data": []
}

4. Check a key

GET/v1/key

Scope site:read. Returns the key you called with and its site. Use it to check a key works, and that it's for the site you think.

200 OK
{
  "key": { "name": "Site build", "kind": "manual", "scopes": ["site:read", "knowledge:write"] },
  "site": {
    "id": "acme",
    "assistant": "Bit",
    "domains": ["acme.com", "www.acme.com"],
    "loader": "https://askbit.io/widget/loader.js",
    "dashboard": "https://askbit.io/dashboard/acme"
  }
}

5. Revoke a key

DELETE/v1/key

Scope site:read. Revokes the key you called with, for example when your integration is uninstalled. Answers 204 with no body. After that the key gets 401.

6. Errors

Errors answer with a status and a JSON body such as { "error": "bad_key" }.

StatuserrorWhat happened
400invalid_jsonThe body isn't JSON.
400invalid_bodyA field is missing, too long or the wrong type. issues lists up to five, with the path to each.
401missing_keyNo Authorization: Bearer header, or it isn't shaped like a key.
401bad_keyThe key is wrong, revoked, or for another site.
403missing_scopeThe key works but doesn't have the scope this needs (scope says which).
404site_not_foundNo site with that id.
500ingest_failedSomething went wrong storing it. Try again later; if it keeps happening, tell us.

7. Limits and good practice

  • Keep each request under 4 MB. About 100 ordinary pages fits easily. Send a big site in batches, one after another rather than all at once.
  • Send changes, not everything, day to day. Unchanged documents are skipped, but a large first send takes a while: allow up to a few minutes and use a long timeout.
  • Retry with a pause on network errors and 5xx, waiting longer each time. Don't retry a 4xx without fixing the request.
  • Send what visitors can read. Leave out drafts, private pages and anything behind a login: the assistant may quote what you send.
  • Prices and stock for a connected store are checked live; you don't need to send them.

8. Examples

curl

Shell
curl -X POST https://askbit.io/v1/sites/YOUR_SITE_ID/knowledge \
  -H "Authorization: Bearer $BIT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "documents": [
      {
        "url": "/pricing",
        "kind": "page",
        "title": "Pricing",
        "summary": "Plans and what each includes",
        "body": "## Starter\nRs 4,999 a month for one location.\n\n## Growth\nRs 9,999 a month, up to five locations."
      }
    ],
    "remove": ["/old-pricing"]
  }'

Node

JavaScript
// Node 18+ (fetch is built in). Keep the key in an environment variable.
const res = await fetch("https://askbit.io/v1/sites/YOUR_SITE_ID/knowledge", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.BIT_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    documents: [
      { url: "/blog/opening-hours", kind: "post", title: "New opening hours", body: "From 1 December we open at 9am." },
    ],
  }),
});
if (!res.ok) throw new Error(`Bit answered ${res.status}: ${await res.text()}`);
console.log(await res.json()); // { added: 1, updated: 0, unchanged: 0, removed: 0, chunks: 1, data: [] }

Python

Python
import os, requests

res = requests.post(
    "https://askbit.io/v1/sites/YOUR_SITE_ID/knowledge",
    headers={"Authorization": f"Bearer {os.environ['BIT_API_KEY']}"},
    json={
        "documents": [
            {"url": "/faq", "kind": "faq", "title": "FAQ", "body": "## Do you deliver?\nYes, across Lahore in 2 days."}
        ]
    },
    timeout=120,
)
res.raise_for_status()
print(res.json())

A whole site, in batches

JavaScript
// Sending a whole site: batches of 100, one after another, then one final call that removes
// anything you didn't send. Pages Bit read from your site or files you uploaded are never touched.
const all = await loadEveryPage(); // your own code: [{ url, kind, title, body }, …]
for (let i = 0; i < all.length; i += 100) {
  await push({ documents: all.slice(i, i + 100) });
}
// Optional: forget pages you deleted since last time (keep a list of what you sent before).
await push({ documents: [], remove: deletedUrls });

9. Signed pushes from your build

Before API keys, a site's build could send content signed with a shared secret instead of a key. It still works and takes the same body. Choose the secret in Settings, Advanced, Content push, then sign each request with an x-bit-signature header. A signature is good for 5 minutes either side of the time in it.

JavaScript
// The signature header: t=<unix seconds>,v1=<hex HMAC-SHA256 of "<t>.<raw body>">
import { createHmac } from "node:crypto";
const body = JSON.stringify({ documents, complete: true });
const t = Math.floor(Date.now() / 1000);
const v1 = createHmac("sha256", process.env.BIT_PUSH_SECRET).update(`${t}.${body}`).digest("hex");
await fetch("https://askbit.io/v1/sites/YOUR_SITE_ID/knowledge", {
  method: "POST",
  headers: { "Content-Type": "application/json", "x-bit-signature": `t=${t},v1=${v1}` },
  body,
});

For anything new, use an API key: it's simpler, and you can see when it was last used and revoke it.

Developers

  • API keys guide
  • The WordPress plugin
  • Your own tools
  • Terms of Service
Ask us a question →