Askmark Docs · 1.0.0 Also included as a PDF
Askmark · documentation · version 1.0.0

Install it, add your AI keys, sell it

Askmark is an AI chat assistant for websites that you run as your own software business. A business signs up, adds its website, files and questions, and puts one line of code on its site. Its assistant then answers visitors from that knowledge with links to the sources, says so when it does not know, takes the visitor's details, books calls and hands the chat to the team's live inbox. You sell plans and run everything from the platform admin.

This guide is written for first-time installers. Every command is shown in full, every setting says where to find it, and the Costs chapter shows what each reply costs before you set your prices.

Part 01

Get started

1Welcome

Thank you for choosing Askmark. This guide takes you from the download to a running AI chat assistant business, with your first assistant answering on a website and your first plan for sale.

What it is and who it is for

Visitors ask a website the same questions every day: "Do you install in my area?", "How long does a battery last?", "Can I book a survey?". Askmark answers them from the business's own pages and documents, shows where each answer comes from, and passes the chat to a person when that is better.

  • You, the buyer of this item, install Askmark on your own server, give it your AI provider keys and sell plans. You are the platform owner (the super-admin).
  • Your customers are businesses. Each one gets a workspace with its own team, knowledge, assistants, chats, leads and bookings, kept apart from every other workspace. One person can belong to several workspaces and switch between them.
  • In a workspace, the team builds the knowledge: sources (a website Askmark reads, uploaded files, or questions and answers typed in) hold documents, and every document is split into chunks that search can find.
  • An assistant is one chat assistant with its name, picture, colour, greeting, tone, rules, languages and handover rules. Its widget is the chat button a website shows after one <script> line.
  • Every visitor conversation is a chat. The assistant answers while the chat is with it; when the visitor asks for a person, the chat waits in the team's inbox until an agent takes it.
  • One assistant reply is one message credit. Each plan has a number of replies a month, and that is how you keep AI costs known.
What the assistant does, and what it does not

The assistant answers only from the workspace's own knowledge and cites it. When the knowledge has no answer, it says so and offers a person, instead of guessing. It does not browse the internet, it cannot see the visitor's screen, and like every AI it can still misread a source: the inbox, the ratings and the unanswered questions show what it said, so the team can check and add better answers.

What you get

  • The workspace for your customers: an overview of today's chats, leads and bookings; a live inbox with take over, reply, internal notes, assign, hand back and close; knowledge from websites (sitemap first, depth and page limits, robots.txt, include and exclude paths, re-crawl daily or weekly), files (PDF, Word, text, Markdown) and Q&A pairs, with a page to test what search finds; assistants with their behaviour, widget look, lead form and booking rules; leads with owners, notes and CSV export; bookings on built-in calendars, Google Calendar or Cal.com; analytics with the questions asked and the ones nobody answered; settings for the team, AI keys, plan and billing and notices; and a Developers area with API keys, webhooks and the MCP server.
  • The website widget: one script tag, plain TypeScript inside a Shadow DOM (the host page's styles cannot break it, and it cannot break them), about 30 KB gzipped, keyboard and screen-reader friendly, full screen on phones, light or dark, right to left for Arabic, with a small JavaScript API.
  • The platform admin for you: revenue, workspaces, messages and AI cost this month; workspaces (change plan, suspend, close, open as owner); plans; payments; AI providers and the price table; email and brand; languages; a setup check that tests every outside service live; background jobs.
  • Five kinds of AI provider behind one interface, with your own keys: OpenAI, Anthropic (Claude), Google Gemini, OpenRouter and any OpenAI-compatible endpoint. Workspaces whose plan allows it bring their own keys.
  • Four payment gateways behind one interface: Stripe, PayPal, Razorpay and Paystack.
  • An install wizard, three sample plans, an editable AI price table and a public demo mode, so the platform is ready the first time it opens.
  • One-command self-hosting with Docker: the app (one compiled Rust program that also serves the web app and the widget), PostgreSQL with pgvector, MinIO file storage and optional automatic HTTPS with Caddy.

What is in the download

PathWhat it is
apps/backend/The server, written in Rust (Axum): the /api/v1 API, the widget's API, the payment webhooks, the crawler, the background jobs and the built web app, compiled into one program called askmark.
apps/frontend/The web app: React 19, React Router 7, Vite, Tailwind CSS 4 and shadcn/ui components. Every screen your customers and you see.
apps/widget/The website chat widget in plain TypeScript, built into one file served at /widget.js.
crates/engines/The AI provider clients, the demo's stand-in, the text tools (web pages, PDF, Word, Markdown, chunks, language, robots.txt, sitemaps) and the price table.
migrations/The PostgreSQL database schema. The server applies it by itself when it starts.
docker/, compose.yamlThe Dockerfile, the Docker Compose stack and the Caddy HTTPS config.
.env.exampleEvery setting, explained. Copy it to .env.
docs/This documentation as one HTML file and as a PDF, plus the list of third-party licences.
README.md, CHANGELOG.md, LICENSE.txtA one-page overview, the version history and the licence notes.

AI disclosure

AI tools used to create this item: Yes

  • Source code: Yes. Written with Claude by Anthropic as an AI coding assistant, then reviewed, tested (server tests against a real PostgreSQL with pgvector, engine tests against recorded provider replies, widget and browser tests) and integrated by us.
  • Documentation: Yes. Drafted with Claude by Anthropic and checked against the code and the running app.
  • Graphics: No. No image was made with an AI image generator. The logo and the demo assistant's sun picture are simple SVGs drawn in code, and every screenshot in this guide is a capture of the running app.
  • Demo text: Yes. The demo business (Sunmere Solar, a solar installer), its knowledge pages, files and Q&A, its sample chats and the stored sample answers the public demo shows were written with Claude by Anthropic and edited by us. Every demo reply is labelled "Demo sample" in the widget.

AI-powered features: Yes

  • Assistant replies: each reply is written by OpenAI, Anthropic (Claude), Google Gemini, OpenRouter or an OpenAI-compatible endpoint, with your own API keys (or a workspace's own keys, on plans that allow them), from the workspace's own knowledge only.
  • Knowledge search: pages, files and questions are turned into embeddings by OpenAI, Gemini, OpenRouter or a compatible endpoint, with the same keys. Without an embedding key, search uses PostgreSQL full-text search only.
  • Each provider bills you directly for every reply and every embedded page; the chapter Costs gives the list prices and a worked example per plan, and each plan's replies a month keep that spend known.
  • Review the output. AI replies can be wrong, incomplete or out of date even when they cite a source. Askmark keeps the reply to the workspace's knowledge, removes source marks and links that are not in it, and answers "I don't know" when nothing relevant is found, but the business stays responsible for what its assistant says: check the inbox, the ratings and the unanswered questions, and test answers before going live.
Not affiliated

Askmark is not affiliated with, endorsed by or sponsored by OpenAI, Anthropic, Google or OpenRouter. ChatGPT, Claude, Gemini, Google Calendar, OpenRouter, Stripe, PayPal, Razorpay, Paystack, Cal.com, WordPress, Shopify, Webflow and Wix are trademarks of their owners. Askmark works with your own accounts at these services.

Screenshots

The main screens of the workspace, the widget, the platform admin and the phone layout. Every chapter in parts 03 and 04 has more.

Screenshot: workspace overview
The overview: chats, visitors waiting, leads and bookings today, and what the assistant could not answer
Screenshot: live inbox
The inbox: chats by state, the conversation with cited sources, notes and the visitor's details
Screenshot: knowledge sources
Knowledge: a website, files and Q&A pairs, with pages read, skipped and the plan's page use
Screenshot: the widget on a website
The widget on a business's website: an answer with its sources and a person on offer
Screenshot: analytics
Analytics: chats a day, how chats ended, from chat to customer and the busiest hours
Screenshot: platform admin overview
The platform admin: revenue, workspaces, messages this month, AI cost and what needs you
Phone: widget
The widget full screen on a phone
Phone: inbox
The inbox on a phone

2Requirements

To run it (recommended: Docker)

  • A 64-bit Linux server (Intel/AMD or ARM) with Docker Engine 24 or newer and Docker Compose 2.20 or newer (the stack uses Compose's include feature). Docker Desktop on macOS or Windows works for trying it on your own computer.
  • For the first build Docker compiles the Rust server and builds the web app and the widget from source, which needs more memory than running it: plan 2 processor cores and 4 GB of memory (or 2 GB plus swap) and at least 6 GB of free disk for Docker's build cache. docker builder prune gives the cache's space back once the app runs. You can also build on another computer and run the result on a smaller server (chapter 24).
  • To run it the server needs far less: the app is one small program. PostgreSQL and MinIO run beside it, so plan at least 1 GB of memory for a small platform, and more for PostgreSQL as the knowledge of your customers grows (chapter 24).
  • PostgreSQL with pgvector: the Docker stack ships PostgreSQL 17 with the pgvector extension (the pgvector/pgvector:pg17 image). Without Docker, or with a managed database: PostgreSQL 15 or newer with the vector extension (pgvector 0.5 or newer) and btree_gist (chapter 25).
  • A domain name and HTTPS for a public launch. Websites on https can only load the widget from an https address, the payment gateways send their webhooks only to https, and Google Calendar's sign-in returns only to https. The bundled Caddy gets a free certificate for you.
  • Outgoing HTTPS from the server to the AI providers (api.openai.com, api.anthropic.com, generativelanguage.googleapis.com, openrouter.ai or your own endpoint), the payment gateways you use, Google and Cal.com if your customers connect calendars, your email provider, and your customers' websites (the crawler reads them).
  • Browsers: a current version of Chrome, Edge, Firefox or Safari, for you, your customers and their visitors, on a computer or a phone.

To build or change it without Docker

  • Rust 1.90 or newer (stable) from rustup.rs.
  • Node.js 24 and pnpm 11 (corepack enable installs the pnpm version each app asks for).
  • PostgreSQL 15 or newer with pgvector and btree_gist.
  • Optional: any S3-compatible storage (MinIO, AWS S3, Cloudflare R2, Backblaze B2…). Without it, files are kept in a local folder.

Accounts you need

AccountWhat it is forNeeded
At least one AI provider: OpenAI, Anthropic, Google AI Studio (Gemini), OpenRouter, or an OpenAI-compatible endpointThe assistants' replies and, except with Anthropic, the knowledge embeddings. Each provider bills you per use (chapter 7).For replies. Without any key, assistants say they are not set up yet and offer a person.
A payment gateway: Stripe, PayPal, Razorpay or PaystackSelling plans to your customers.To charge customers
An SMTP email providerPassword resets, invites, new-chat and waiting notices, replies to visitors who left, transcripts, lead notices. Without it, each email is written to the app's log.For a public launch
A Google Cloud project with an OAuth clientLets your customers connect Google Calendar to their booking calendars.Optional
S3-compatible storageKnowledge files, pictures and logos. The bundled MinIO does this on the same server.Optional

3Install with Docker

This runs Askmark on your own computer or on a server. The first build compiles the server from source, so it takes longer than later starts.

  1. Unzip the download and open a terminal in the askmark/ folder (the one with compose.yaml in it).
  2. Create your settings file:
    cp .env.example .env
  3. Open .env in any text editor and fill in these values:
    APP_URL=http://localhost:8080                 # your public https:// address on a server
    APP_SECRET=paste-a-random-string-here         # make one with: openssl rand -hex 32
    POSTGRES_PASSWORD=pick-a-long-password        # letters and digits only
    S3_SECRET_ACCESS_KEY=pick-another-password    # at least 8 characters
    Change both passwords: the example values are public. Keep APP_SECRET safe and never change it after the install, because it seals the AI provider keys and the other secrets you save. Leave DATABASE_URL empty: Docker builds the database address from the values above. The AI provider keys can wait; the install wizard asks for one.
  4. Build and start everything, in one command:
    docker compose up -d --build
    Docker builds the app (the web app, the widget, then the Rust server), starts PostgreSQL with pgvector and MinIO (file storage), creates the storage bucket and starts the app, which adds the database extensions and applies the migrations by itself. Later builds reuse Docker's cache and are much quicker.
  5. Find the install token in the app's log (if the app has restarted, use the last one):
    docker compose logs app | grep -i "install token"
    The line reads Install token: am-install-… (open /install and paste it).
  6. Open http://localhost:8080. The install wizard opens: paste the token, check the database, create your platform account and add an AI key.
Good to know

See what the app is doing with docker compose logs -f app. Stop it with docker compose down; your data stays in Docker volumes. Use another port by setting APP_PORT=8090 in .env and running docker compose up -d. The app port is open on this computer only (APP_BIND=127.0.0.1); on a server, visitors come in through HTTPS, as chapter 24 shows.

Out of memory during the build

If the build stops with "signal: 9" or "killed", the server ran out of memory while compiling. Add swap (for example 4 GB) and run the same command again, or build on a bigger computer and copy the result (chapter 24, Build on another computer).

Install without Docker

You need Rust, Node.js 24 with pnpm and a PostgreSQL with pgvector and btree_gist (chapter 2). In the askmark/ folder:

# 1. the web app and the widget
cd apps/frontend && corepack enable && pnpm install && pnpm build && cd ../..
cd apps/widget && pnpm install && pnpm build && cd ../..
cp apps/widget/dist/widget.js apps/frontend/dist/client/widget.js

# 2. the server, packed with the web app into one program
cargo build --release -p askmark-server
./target/release/askmark pack apps/frontend/dist/client ./askmark

# 3. the database: as a PostgreSQL superuser, once
#    create extension if not exists vector; create extension if not exists btree_gist;

# 4. settings in .env next to where you start it: APP_URL, APP_SECRET, DATABASE_URL,
#    and STORAGE_DRIVER=local (or your S3 bucket)
BIND=127.0.0.1:8080 ./askmark serve

The server adds the extensions itself when its database login may (step 3 is for a login that may not), applies the migrations when it starts and prints the install token. Run it behind your own HTTPS proxy and keep it running with a service manager such as systemd (chapter 24).

4Install wizard

The first visit to a new install opens the wizard at /install; every other page sends you there until it is finished, and nobody can sign up before. It runs once; afterwards the page is locked. It has three steps.

  1. Database and admin. Paste the install token from the app's log. The app prints it at every start until the install is finished, and a restart makes a new one, so use the last line. Lost it? Set INSTALL_TOKEN in .env to a value of your choice and run docker compose up -d. The wizard then shows the database: the PostgreSQL version, pgvector ready (knowledge search), btree_gist ready (it stops double bookings) and the migrations still to run. Below it come the site address (from APP_URL; it must be https on a public server, because the widget loads from it) and your platform account: your name, email and password (at least 10 characters). This is the super-admin account you run the platform with.
  2. AI key and email. One AI provider key for every workspace (chapter 6): the provider, the key and, for an OpenAI-compatible endpoint, its base address. The wizard tests it and shows the answer model and the embedding model it found. Then your mail server, port, user, password and sender, with a test email (chapter 19). Both can be skipped: without a key, assistants say they are not set up yet and offer a person; without email, emails go to the app's log.
  3. Done. A summary of what is set up and what is not yet, with buttons to create your first workspace or open the platform admin. The three sample plans are added (chapter 15). Payment gateways are added afterwards in Platform admin → Payments (chapter 16).

When the database has no pgvector

Askmark needs two PostgreSQL extensions: vector (pgvector) for knowledge search and btree_gist for the rule that stops two bookings taking the same time. At every start the server runs create extension if not exists for both. The bundled pgvector/pgvector:pg17 image has both, so with Docker this step is always green.

When the extensions cannot be added (most often a managed or system PostgreSQL without pgvector), the server does not stop. It opens only the wizard's database step, which shows the reason in plain words and the fix, and a Check again button. Once the extensions are in, the full app starts by itself, in the same process. The fixes:

  • Use the bundled database: docker compose up -d starts the pgvector/pgvector:pg17 image, which has both extensions.
  • Or use a managed PostgreSQL with pgvector (Neon, Supabase, AWS RDS or Aurora, Google Cloud SQL, Azure Database for PostgreSQL, DigitalOcean): turn the extensions on there and press Check again (chapter 25).
  • On your own PostgreSQL server: install pgvector (for example apt install postgresql-17-pgvector), then run create extension vector; create extension btree_gist; as a superuser.
Step 1: the install token, the database with pgvector and btree_gist, and your platform account
Step 1: the install token, the database with pgvector and btree_gist, and your platform account
Step 2: one AI key, tested, and the mail server with a test email
Step 2: one AI key, tested, and the mail server with a test email

5Setup check

Platform admin → Setup check lists everything a running platform depends on, with a plain-words status, what to do about it and, where possible, a Test button that calls the service for real.

RowWhat it shows, and what Test does
DatabasePostgreSQL answers and how many migrations are applied. Test reads the PostgreSQL version.
File storageThe S3-compatible bucket or the server's own disk. Test writes, reads and deletes a small file.
Email (SMTP)The sender and server. Test connects and signs in, and sends a test email when you type an address.
Stripe and Stripe webhookWhether the keys and the webhook secret are set, and paid plans without a Stripe price. Test reads your Stripe balance and says whether the key is in test or live mode.
Other gatewaysPayPal, Razorpay and Paystack are tested from Platform admin → Payments, each with its own Test button (chapter 16).
AI providersWhich providers have a platform key (saved in the platform admin or in .env) and whether one can embed. Test tries the platform keys. With no key anywhere, assistants say they are not set up yet and offer a person (or suggest contacting the business, when the assistant offers no person).
App addressWhether APP_URL is https. Test calls APP_URL/api/health to prove the address reaches this server, which is also where websites load the widget from.
Visitor addressesThe TRUSTED_PROXY_HOPS setting (chapter 24).
Background jobsFailed jobs in the last 24 hours and jobs waiting for more than 10 minutes, with the reason a job failed and a Retry button (chapter 22).
InstallWhether the install wizard has finished.

Below the rows, Google Calendar sync holds the platform's Google OAuth client (chapter 12), and Demo data removes the sample workspaces before you open sign-ups (chapter 23).

Screenshot: setup check
Setup check: each service with a status, a fix and a live test, and the background jobs below
Part 02

AI providers and costs

The AI keys can be set in .env or in Platform admin → AI providers. Keys saved in the platform admin come before .env, are sealed with your APP_SECRET, and never come back to the browser once saved (only a short hint). Change one by pasting a new key.

6AI providers and keys

Askmark asks an AI model to write each reply from the workspace's own knowledge, and asks an embedding model to turn pages and questions into numbers that search can compare by meaning. You bring the keys; each provider bills you for what it does.

The providers

ProviderRepliesEmbeddings (search by meaning)Default models
OpenAIThe Responses API, streamed word by word.Yesgpt-5-mini and text-embedding-3-small
Anthropic (Claude)The Messages API, streamed.No: Anthropic has no embedding model. Add a second key that can embed (below), or search uses full-text only.claude-haiku-5-5
Google GeminigenerateContent, streamed.Yesgemini-2.5-flash and gemini-embedding-001
OpenRouterOne key for hundreds of models from many companies, at https://openrouter.ai/api/v1.Yesopenai/gpt-5-mini and openai/text-embedding-3-small
OpenAI-compatibleAny endpoint that speaks /chat/completions: Groq, Together, Mistral, DeepSeek, LiteLLM, or a model server you run yourself (Ollama, vLLM, LM Studio). Needs a base URL and a model name.When the endpoint offers /embeddings and you name an embedding modelNone: you name the models

Every embedding has 1,536 numbers, the size of the knowledge table's vector column, so an embedding model you choose must give 1,536 numbers (the defaults do; Askmark asks Gemini and OpenAI for that size). Every reply is stored with the model that wrote it, its tokens, how long it took and its cost at list prices.

Which key is used

For every reply, Askmark takes the first key that exists, in this order:

  1. The workspace's own key, when the workspace's plan allows own keys. Owners and admins add them in Settings → AI. Their provider bills them, not you, but each reply still counts toward the plan's replies a month.
  2. The platform's keys saved in Platform admin → AI providers: the first switched-on key, in the order OpenAI, Anthropic, Gemini, OpenRouter, OpenAI-compatible (the most recently changed first when a provider has two).
  3. The platform key in .env: OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY or OPENROUTER_API_KEY, in the same order. An OpenAI-compatible endpoint needs a base URL, so it is saved in the platform admin only.

Embeddings are picked the same way, among the keys that have an embedding model (never Anthropic). So a platform can write replies with Claude and embed with OpenAI or Gemini. With no key anywhere, an assistant says it is not set up yet and offers a person, and that uses no reply of the plan. Without an embedding key, knowledge search uses PostgreSQL full-text search only, which still finds pages that share the visitor's words.

Change the embedding model, and the background job embeds the knowledge again with the new one; until it has, search by meaning uses only the chunks already embedded with the new model, and full-text search covers the rest.

Get each key

OpenAI

  1. Sign in at platform.openai.com and add a payment method under Settings → Billing. OpenAI's API is paid separately from ChatGPT subscriptions.
  2. Open API keys → Create new secret key and copy it (it starts with sk-; it is shown once).
  3. Default models: gpt-5-mini for replies and text-embedding-3-small for embeddings. Others in the price table: gpt-5-nano, gpt-5, gpt-4.1-mini, gpt-4o-mini and text-embedding-3-large.

Anthropic (Claude)

  1. Sign in at console.anthropic.com and buy credits under Billing.
  2. Open API keys → Create key and copy it (it starts with sk-ant-).
  3. Default model: claude-haiku-5-5. Others in the price table: claude-sonnet-5-5, claude-opus-5-5, claude-haiku-4-5. Add an OpenAI, Gemini or OpenRouter key as well for search by meaning.

Google Gemini

  1. Sign in at Google AI Studio and press Get API key (it starts with AIza). For more than the free tier's limits, turn on billing for the key's Google Cloud project.
  2. Default models: gemini-2.5-flash and gemini-embedding-001. Others in the price table: gemini-2.5-flash-lite, gemini-2.5-pro.
  3. The Gemini API is not offered in every country; a refusal from your server's region shows as a bad_request error.

OpenRouter

  1. Sign in at openrouter.ai, buy credits under Credits, then open Keys → Create key (it starts with sk-or-v1-).
  2. Default models: openai/gpt-5-mini and openai/text-embedding-3-small. Any model OpenRouter lists works by its id, for example anthropic/claude-haiku-5-5 or google/gemini-2.5-flash.
  3. OpenRouter passes on each model's price and adds its own fee when you buy credits; see its pricing page.

An OpenAI-compatible endpoint

The service behind the endpoint bills you with its own pricing; a model server you run yourself costs only your own hardware.

  1. Get the endpoint's base URL (it ends before /chat/completions, for example https://api.groq.com/openai/v1), a key and the model names. A model server of your own may need no key.
  2. A model server on your own network (a private address such as 192.168.… or localhost) is refused by the outgoing-call guard (chapter 27) unless you set ALLOW_PRIVATE_FETCH=true in .env. Only do that when you trust every workspace's owner, because it also lets their crawls and webhooks reach that network.
  3. Add the model's row to the price table (chapter 17), so its cost figures are right: a model that is not in the table is priced by a built-in guess.

Add the keys

  • Platform keys: Platform admin → AI providers: the provider, the key, the answer model and the embeddings model (empty = the default), the base URL (OpenAI-compatible only) and an on/off switch. Or set the keys in .env and run docker compose up -d.
  • A workspace's own keys: Settings → AI in the workspace, for owners and admins, on plans whose Own AI keys switch is on (of the sample plans, only Agency has it; switch it on or off for any plan in Platform admin → Plans).
  • Keys are sealed in the database with APP_SECRET and only ever come back as a hint such as sk-…Q7fd.

Test a key

Every key has a Test button, and the setup check tests the platform keys too. OpenAI, Anthropic and Gemini are tested by reading the model's details, which costs nothing. OpenRouter and OpenAI-compatible endpoints are sent a one-token question, which costs a tiny fraction of a cent. The test checks the embedding model too when one is set, and says whether the key works, how long the provider took and the model it answered with, or the provider's reason in plain words.

Screenshot: platform admin, AI providers
Platform admin → AI providers: the keys with their test, the models, and this month's cost at list prices

When a provider refuses

A visitor's reply is never tried again behind their back: when the provider fails or takes longer than 60 seconds, the visitor sees "The assistant could not answer just now. Please try again in a moment.", nothing is stored, and the reply's message credit is given back, so a failed reply costs the workspace nothing. Embedding knowledge runs in the background: when the provider fails, the job tries again 2 minutes later, up to 5 tries in all, and meanwhile the chunks are found by full-text search.

CodeWhat it meansKindWhat you can do
authThe key is wrong, revoked or lacks access (HTTP 401/403)Needs youCopy the key again from the provider's dashboard, check that it is not revoked and may use the model, save it and press Test.
rate_limitedToo many requests right now (HTTP 429); trying again later worksPassingUsually nothing: the visitor can ask again a moment later. If it happens at every busy hour, ask the provider for a higher rate limit, or add a second provider.
quotaThe account is out of credit or over a hard quota; retrying will not helpNeeds youAdd credit, or raise the spending limit, on the provider's billing page. Replies work again at once.
bad_requestThe request was refused as invalid (unknown model, bad parameter)This questionUsually the model name: check it against the provider's model list (an embedding model must give 1,536 numbers). For Gemini it can also mean the API is not offered in the server's region.
timeoutNo answer within the configured timeoutPassingNothing for one reply. If it keeps happening, pick a faster model.
serverThe provider failed on its side (HTTP 5xx, overloaded)PassingNothing: the provider had a problem on its side. Check its status page if it lasts.
networkThe provider could not be reached (DNS, TLS, connection reset)PassingCheck that the server can reach the provider over HTTPS (firewall, DNS, outgoing proxy).
parseThe provider answered with something Askmark could not readThis questionRare. For an OpenAI-compatible endpoint, check that it speaks the Chat Completions format with streaming; otherwise update Askmark.
refusedThe provider declined to answer (safety filter, blocked prompt)This questionThe provider's safety filter declined this question. Nothing to do for one; if it happens often, read the assistant's rules again.
not_configuredSomething needed for the call is missing (key, base URL)Needs youAdd a key for this provider (and the base URL and model for an OpenAI-compatible endpoint), or turn the provider off.

"Passing" problems go away by themselves; "Needs you" problems stop every reply on that key until you act; "This question" problems affect one request only.

Each provider has its own pricing

OpenAI, Anthropic, Google, OpenRouter and the services behind an OpenAI-compatible endpoint are third-party services with their own pricing, and you, the buyer, pay for every reply and every embedding they make with your keys (a workspace using its own keys pays its own). The next chapter shows what a reply costs.

7Costs

Askmark has no monthly fee of its own. What you pay each month depends on how many replies your customers' assistants write, how many pages they add, and which outside services you use. Each of those services is run by another company with its own pricing, and you, the buyer, are responsible for every one of these costs.

What one reply costs

One reply is one assistant answer to one visitor message. Its cost is the provider's list price for the tokens the model reads and writes. To write a reply, the model reads the 6 best-matching knowledge chunks of about 700 tokens each, plus the assistant's rules, the recent turns and the question: about 5,000 tokens in, and about 250 tokens out (a reply stops at 800). These are the list prices (US dollars) in Askmark's price table, the same table every cost figure in the app uses; the real cost of each reply is worked out from its own token counts and stored with it.

ProviderModelInput / 1M tokensOutput / 1M tokensTypical replyLongest reply
OpenAIgpt-5-mini (default)$0.25$2$0.0018$0.0029
OpenAIgpt-5-nano$0.05$0.40$0.0003$0.0006
OpenAIgpt-5$1.25$10$0.0088$0.0143
OpenAIgpt-4.1-mini$0.40$1.60$0.0024$0.0033
OpenAIgpt-4o-mini$0.15$0.60$0.0009$0.0012
OpenAIany other model$1.25$10$0.0088$0.0143
Anthropicclaude-haiku-5-5 (default)$0.10$0.50$0.0006$0.0009
Anthropicclaude-sonnet-5-5$2$10$0.0125$0.0180
Anthropicclaude-opus-5-5$4$20$0.0250$0.0360
Anthropicclaude-haiku-4-5$1$5$0.0063$0.0090
Anthropicany other model$2$10$0.0125$0.0180
Google Geminigemini-2.5-flash-lite$0.10$0.40$0.0006$0.0008
Google Geminigemini-2.5-flash (default)$0.30$2.50$0.0021$0.0035
Google Geminigemini-2.5-pro$1.25$10$0.0088$0.0143
Google Geminiany other model$0.30$2.50$0.0021$0.0035
OpenRouteropenai/gpt-5-mini (default)$0.25$2$0.0018$0.0029
OpenRouteranthropic/claude-haiku-5-5$0.10$0.50$0.0006$0.0009
OpenRoutergoogle/gemini-2.5-flash$0.30$2.50$0.0021$0.0035
OpenRouterany other model$0.50$2$0.0030$0.0041
OpenAI-compatibleopenai/gpt-5-mini$0.25$2$0.0018$0.0029
OpenAI-compatibleany other model (no price: add yours)$0$0$0.0000$0.0000

Replies that call no model cost nothing: "I don't know" when the knowledge has nothing relevant, "not set up yet" when there is no key, and every message while a person has the chat.

What knowledge costs

Each page, file or Q&A pair is embedded once when it is added or changes (a re-crawl skips pages that did not change), and each visitor question is embedded once for search. With the default models:

ProviderModelPer 1M tokensPer page (about 1,500 tokens)Per 1,000 pages
OpenAItext-embedding-3-small (default)$0.02$0.00003$0.03
OpenAItext-embedding-3-large$0.13$0.00019$0.20
Google Geminigemini-embedding-001 (default)$0.15$0.00022$0.23
OpenRouteropenai/text-embedding-3-small (default)$0.02$0.00003$0.03

Crawling itself costs nothing but your server's time: Askmark reads the pages itself, without any outside service.

Each provider sets and changes its own prices

The prices above were the providers' published list prices in November 2026. Each provider sets and changes its own prices, some give free allowances or discounts, and a provider's invoice is what counts. Check each provider's pricing page (OpenAI, Anthropic, Google Gemini, OpenRouter) before you set your plan prices, and update the price table when they change (chapter 17).

A worked example

The most a workspace on the most popular sample plan can cost you in a month, with your platform keys: a workspace on the Growth plan that uses all 10,000 replies of its month on OpenAI gpt-5-mini costs about $17.50 in replies, plus about $0.06 to embed its 2,000 pages once ($17.57 in all, against the plan's $79).

WhatCountEachCost
Replies (gpt-5-mini)10,000$0.0018$17.50
Questions embedded for search (text-embedding-3-small, about 30 tokens each)10,000under $0.00001$0.01
Pages embedded once (text-embedding-3-small, about 1,500 tokens each)2,000$0.00003$0.06
The month at most, on these models$17.57
What the workspace pays you for the Growth plan$79.00

Most workspaces use far fewer replies than their plan allows, and a re-crawl embeds only the pages that changed.

How plans keep costs known

  • Replies a month (message credits). Every plan has a number of replies a calendar month (UTC). Before each model call, Askmark takes one credit from the month's meter, in one locked database step, so replies that start at the same moment can never pass the limit together, and a visitor message sent twice is never counted twice. When a call fails, its credit is given back. A test in Knowledge → Test answers (chapter 8) counts the same way: one credit for each answer the model writes, given back when the provider fails; the public demo's sample answers are free. When the month is used up, the assistant stops answering, the widget shows a short contact form instead (every message then arrives as a lead), and the owners and admins get one email that month.
  • Pages of knowledge. Every indexed page, file or Q&A pair counts as one page; a crawl stops when the plan's pages are used up, and says so, and a Q&A import that would pass them saves nothing.
  • What a plan can cost you. With your platform keys, the most a workspace can cost you in a month is its plan's replies times the cost of a reply, plus embedding its pages. At the default models:
PlanPrice a monthReplies a monthAll on OpenAI gpt-5-miniAll on Anthropic claude-haiku-5-5All on Google Gemini gemini-2.5-flashAll on OpenRouter openai/gpt-5-miniEmbedding all its pages once
Starter$291,500$2.63$0.94$3.19$2.63$0.01 to $0.07 (300 pages)
Growth$7910,000$17.50$6.25$21.25$17.50$0.06 to $0.45 (2,000 pages)
Agency$19940,000$70.00$25.00$85.00$70.00$0.30 to $2.25 (10,000 pages)

So a plan whose replies would all go to a dear model can cost more than its price. Keep each plan's replies, the platform's default model and its price in step with the table above, and remember that workspaces using their own keys (chapter 6) pay their providers themselves. The platform admin's overview and AI providers page show this month's AI cost at list prices.

Everything else

ServicePriceWhat that means for you
Stripe2.9% + 30¢Per successful US card payment, plus 0.7% of subscription volume for Stripe Billing: on a $79 plan, about $3.13 a month. Other countries and cards have their own rates on Stripe's pricing page.
PayPal3.49% + 49¢Per PayPal checkout payment in the USA; other countries have their own rates on PayPal's fees page.
Razorpay2% per paymentFor most Indian cards, UPI and net banking on the standard plan; international cards cost more. See Razorpay's pricing.
Paystack1.5% + ₦100Per local payment in Nigeria (capped at ₦2,000); international cards and other countries have their own rates on Paystack's pricing.
Server (VPS)about $10 to $40 a monthOne server with 2 cores and 4 GB of memory runs the whole Docker stack for many workspaces. The AI providers do the heavy work; PostgreSQL holds the knowledge.
Email (SMTP)about $0.10 per 1,000 (for example Amazon SES)Password resets, invites, waiting, lead and booking notices, booking emails to visitors, transcripts and replies to visitors who left. Other providers sell monthly plans with a free tier.
File storage$0 to $0.015 per GBThe bundled MinIO or the server's own disk costs nothing extra; each plan caps a workspace's files (chapter 15).
Google Calendar APIfreeFree and unlimited for this use; each customer connects their own Google account.
Cal.comthe customer's own planCustomers who connect Cal.com use their own Cal.com account and key.
Domain nameabout $10 to $20 a yearThe address of your platform, for example chat.yourbrand.com.
Screenshot: plan and billing with messages this month
A workspace's plan and billing: replies used this month, the plan's limits and its invoices
Part 03

Assistants and chats

This part follows your customer, a business owner, from an empty workspace to an assistant answering on their website. The workspace's sidebar has four groups: Conversations (Overview, Inbox, Leads, Bookings), Assistant (Knowledge, Assistants, Widget and install), Insights (Analytics) and Workspace (Settings, Developers).

8Knowledge

The assistant answers only from the workspace's knowledge. Knowledge has three kinds of source: a website Askmark reads, uploaded files, and questions with answers typed in. Every member can read it; owners and admins change it.

A website

Knowledge has five tabs: Sources, Website pages, Files, Q&A pairs and Test answers. Add a website with its start address: Askmark first shows the sitemap it found and how many pages it lists, then reads the site and shows the progress live: pages found, read, unchanged, skipped and failed. Pause ends a running crawl after its current batch and holds the scheduled re-crawls until you crawl it again; Stop and keep what's read ends it and keeps the pages read so far; Re-crawl now runs one at any time.

  • Sitemap first. Askmark reads the Sitemap: lines of the site's robots.txt, else /sitemap.xml, following sitemap indexes and gzipped sitemaps. Then it follows the start page's links, breadth first, on the same site ("Sitemap first, then follow links", recommended); "Only the pages in the sitemap" skips the links.
  • Depth and pages. Links are followed up to the source's depth (default 3, at most 10) and pages up to its page cap (default 500, at most 10,000) and the plan's remaining pages. A crawl stops after 8 minutes and the next one checks the rest.
  • robots.txt. The rules for AskmarkBot (or *) are kept, so pages the site closes to robots are skipped as "Blocked by robots.txt". A business that crawls its own site may turn this off for that source.
  • Include and exclude. Path patterns, up to 50 of each, in the style of robots.txt: /blog/ matches everything that starts with it, * matches any run of characters and a final $ ends the match. With include patterns, only matching pages are read; exclude patterns always win.
  • Clean addresses. The #fragment and the query string are dropped (unless the source keeps query strings), the page's canonical address wins, and the same text under two addresses is kept once.
  • Re-crawl off, daily or weekly. A re-crawl asks each page with its ETag and Last-Modified, keeps unchanged pages as they are (and does not embed them again) and updates the rest.
  • Pages are fetched four at a time, at most 2 MB and 10 seconds each and up to 5 redirects, only from public addresses (chapter 27). Website pages lists every page as read, skipped (with the reason), failed or excluded, problems first. Retry reads a failed page again; Exclude leaves a page out for good: its chunks go, it stops counting toward the plan, and later crawls skip it.

Files

Knowledge → Files takes PDF, Word (.docx), plain text and Markdown files of up to 20 MB each. Askmark reads the text with its headings and keeps the file in the workspace's storage, which counts toward the plan's file storage. A PDF that holds only scanned pictures has no text to read and is reported as such; run it through a text-recognition (OCR) tool first.

Questions and answers

Knowledge → Q&A pairs holds pairs the team writes: a question and its answer, for the things no page says well (opening hours, prices, policies). An answer added from Analytics → Unanswered questions is saved here too. A Q&A pair is found like any page, so write the question the way visitors ask it.

Import CSV adds many pairs at once from a spreadsheet saved as CSV (UTF-8), up to 2,000 rows and 2 MB:

question,answer,source_url
Do you install in Portland?,"Yes, across the Portland metro area.",https://www.example.com/areas
How long does a battery last?,Our batteries carry a 10-year warranty.,
  • The columns are question, answer and an optional source_url, in that order. A first row that names the columns is read as a header, and then the columns may come in any order.
  • A question that is already there (the same words, ignoring case, spacing and end punctuation) gets the new answer instead of a second pair.
  • Rows that can't be used are listed with their line number and the reason; the others are added.
  • The new pairs count toward the plan's pages: when they don't all fit, nothing is saved and the message says how many would.

Pages of knowledge

Every indexed crawled page, uploaded file and Q&A pair counts as one page of the plan's pages of knowledge. When the plan's pages are used up, a crawl stops and says so, and new files or pairs are refused with an upgrade prompt. Delete pages, exclude paths or upgrade to make room.

How knowledge is searched

Each document's text is split into chunks of about 700 tokens that overlap by 100, each with its headings, and its language is detected. For every question, Askmark runs PostgreSQL full-text search and, when the workspace has an embedding key, search by meaning (pgvector), then joins the two lists by reciprocal-rank fusion and gives the model the 6 best chunks. Every search is filtered on the workspace, and on the assistant's own source list when it has one, so a chat never reads another workspace's knowledge.

Test the answers

Knowledge → Test answers takes a question and shows the answer the widget would give, with its sources, and every chunk the assistant read, best first. The test never reaches the inbox and is not stored. Agents, admins and owners can run it; each answer the model writes uses one message credit of the plan, given back when the provider fails. "I don't know" and "not set up yet" answers cost nothing, and so do the public demo's sample answers. Use it before going live: when the right page does not come first, add a Q&A pair or exclude the noisy pages.

Screenshot: knowledge, website pages
A website source: pages read, skipped with the reason, and the crawl settings
Screenshot: knowledge test
Knowledge → Test answers: the answer, its sources and the chunks it read

9The assistant

An assistant is one chat assistant with its own look, behaviour and rules. A workspace can have as many as its plan allows (Assistants), for example one per website or per language.

Behaviour

SettingWhat it does
Name and pictureShown in the widget's header and beside each reply.
ToneFriendly (warm, short sentences, no jargon), Professional (polite and precise) or Concise (as few words as the answer needs). The rules always win over the tone.
RulesThe business's own instructions in plain words: "Never quote a price; offer a free survey instead", "Call our product Sunmere Home, never just Home".
LanguagesThe languages the assistant answers in, and its default. A visitor whose browser asks for one of them is answered in it; anyone else in the default. With no list, it answers in the visitor's language.
When there is no answerThe words the assistant says when the knowledge does not answer the question, and what it offers then (below).
Handover to a personWhether the assistant hands the chat to the team (below).
MemoryHow many recent turns of the chat the assistant reads with each question (2 to 20).
SourcesAll the workspace's knowledge, or only the sources you pick, for example one site per assistant.

How a reply is made

  1. The visitor's question is searched in the knowledge (chapter 8).
  2. When nothing relevant is found, the assistant says so in the "no answer" words without calling the model, and offers a person or a way to leave a message.
  3. Otherwise the model gets the assistant's tone and rules, the reply language and the instruction to answer only from the numbered sources and to cite them, then the sources as quoted data, the recent turns and the question. The visitor's words travel as data too, so a visitor cannot rewrite the rules ("ignore your instructions…").
  4. The reply streams to the visitor word by word; the visitor can press Stop. A reply stops at 800 tokens.
  5. Before it is shown and stored, every reply is checked: source marks that point at no source are removed, links that are not in the sources are removed, a reply that repeats the rules is replaced, and the model's "the sources don't say" becomes the "no answer" reply.
  6. The reply shows its sources as links under it, and is stored with its sources, model, tokens, cost and time.

Handover rules

The Behaviour tab decides when a person is offered:

  • When there is no answer, the assistant says so (in its own "no answer" words, when you write them) and then: Say so and offer a person (the default), Say so and ask for an email (the widget shows the contact form, so the team can write back), or Say so only.
  • Offer a person whenever the visitor asks (on or off): the visitor can ask at any time, with the widget's button or in words ("talk to a person", "speak to someone", in the widget's six languages). The assistant's own handover words, when it has some, replace the built-in phrases.
  • Hours for a person: Any time, or Set hours for each day of the week in the assistant's time zone. Inside the hours, a visitor who asks for a person waits in the inbox for a teammate, and the widget says the team replies in about 5 minutes. Outside them, the chat stays with the assistant, which says when the team is back and shows the contact form, so the visitor leaves a message and the team replies by email.

With neither (no offer after "no answer" and asking off), the widget's menu has no "Talk to a person" item and shows no reply time. Over the REST API, handoverMode (on_request, on_not_found or never) still sets these at once.

Look

The Look tab sets the colour (the widget works out readable shades for light and dark), the corner it sits in, the greeting, up to 6 suggested questions shown before the first message, light, dark or the visitor's own theme, the privacy page linked under the chat, and any of the widget's own words (for example "Type your question"). A preview shows the widget as you change it, on a computer and on a phone.

Screenshot: assistant behaviour with try-it chat
An assistant's behaviour: tone, rules, no-answer reply, handover and languages, with a try-it chat
Screenshot: assistant look and preview
The Look tab: colour, position, greeting and suggested questions, with a live preview

10Install the widget

The widget is the chat button a website shows. It is one small script (about 30 KB gzipped) that loads after the page, draws itself inside a Shadow DOM (the site's styles cannot change it, and it cannot change the site), works with the keyboard and screen readers, and opens full screen on phones (under 480 pixels wide).

The snippet

Widget and install (or the assistant's Install tab) shows the snippet with the assistant's public widget key, a Copy button and an "Email it to your developer" button:

<script src="https://chat.yourbrand.com/widget.js"
        data-assistant="pk_xxxxxxxxxxxxxxxxxxxxxxxx" async></script>

Paste it once, just before </body>, in the template every page uses. data-lang="es" on the tag picks the widget's language for that page (else the assistant's language setting, else the visitor's browser). The install check on the same page turns green once the widget has been seen on the site, and shows how fast it loaded.

The widget key is public

The pk_… key is meant to be seen in page source; it only names the assistant. What protects it is the list of allowed websites (below). Rotate key makes a new one; the old snippet stops working until the new one is pasted.

Where to paste it

WebsiteSteps
Plain HTMLOpen the site's main template (often footer.html or layout.html), paste the snippet just before </body>, publish, then open any page.
WordPressUse a header and footer plugin such as WPCode (it keeps the snippet when the theme updates), or Appearance → Theme File Editor. Paste the snippet in the footer section and save. Clear your cache plugin if the button does not show at once.
ShopifyOnline Store → Themes → Edit code → layout/theme.liquid. Paste the snippet just before </body> and save. It covers every page of the store, the cart included.
WebflowSite settings → Custom code → Footer code. Paste, save and publish: custom code runs only on the published site, not in the Designer.
WixSettings → Custom code (under Advanced) → Add custom code. Paste the snippet, choose All pages and Body - end, and apply. Wix runs custom code only on a premium site with a connected domain.
React, Next.jsA React app built with Vite or similar: paste the snippet into index.html before </body>. Next.js: in the root layout, add <Script src="https://chat.yourbrand.com/widget.js" data-assistant="pk_…" strategy="afterInteractive" /> from next/script. The widget loads once and stays across page changes.
Google Tag ManagerAdd a tag of type Custom HTML, paste the snippet, trigger it on All Pages, then submit and publish the container.

Allowed websites

In the Install tab, list the websites that may show the assistant, for example sunmeresolar.com. A www. in front is ignored, *.sunmeresolar.com also allows its subdomains, and the platform's own address is always allowed (for the previews). Every widget request from a page on another site is refused. With the list empty, any site may show it. Fill it in, so another site cannot use the business's assistant and its replies.

The JavaScript API

The page gets one global, window.Askmark, as soon as the script has run. Calls made before the widget is ready are kept and run when it is.

CallWhat it does
Askmark.open()Opens the chat.
Askmark.close()Closes it.
Askmark.ask("Do you install batteries?")Opens the chat and sends the question, as if the visitor typed it.
<button onclick="window.Askmark && Askmark.ask('Can I book a free survey?')">Book a survey</button>

When the site has a Content Security Policy

A site that sends a strict Content-Security-Policy header must allow the platform's address, or the browser blocks the widget: add it to script-src (the script), connect-src (questions and the live reply stream) and img-src (the assistant's picture). The widget's styles are built in code, so style-src needs no change.

White label

On plans with White label, a workspace replaces the Askmark name everywhere visitors and its own customers see it: Settings → General sets its own name, logo and colour for the widget and for the emails it sends to visitors, and each assistant can hide "Powered by Askmark" under the chat. On plans without it, the widget always shows "Powered by" with your product name (chapter 18).

Screenshot: widget and install
Widget and install: the snippet, where to paste it, the install check and the allowed websites
Screenshot: widget answer with sources
A reply in the widget, with its sources and a person on offer

11Inbox and handover

The inbox shows every chat live, as it happens, for the whole team. While the assistant has a chat, the team can watch; when a visitor asks for a person, the chat waits for the first teammate to take it.

The four states of a chat

StateWhat it meansHow it changes
BotThe assistant answers.A teammate takes over, or the visitor asks for a person (→ Waiting).
WaitingThe visitor asked for a person. The assistant stops replying, and the widget shows the visitor's place in the queue.A teammate takes it (→ Human), or the visitor stops waiting (→ Bot).
HumanA teammate has the chat; the assistant stays silent.The teammate hands it back to the assistant (→ Bot) or closes it.
ClosedThe chat ended; the visitor is asked to rate it.The visitor writes again, or a teammate presses Reopen (→ Bot).

Each change is one conditional database update, so two teammates who press Take over at the same moment cannot both get the chat: the second is told it was just taken. Every change adds a line to the chat, so the visitor and the team see what happened.

What the team can do

  • Take over a chat (it is assigned to you), assign it to a teammate, reply, add an internal note (never shown to the visitor), hand back to the assistant, close and reopen.
  • Email transcript sends the whole chat to the visitor, when they left an email (five times an hour per chat).
  • See the visitor's page, language and earlier chats, the details they left, the sources each reply used, and when the visitor is typing.
  • Filter chats with the tabs Open (every chat that is not closed), Waiting, Mine and Closed, and search them.

Notices

  • Each member chooses, in Settings → Notifications and language, which notices they get by email and in the browser: new chats, a visitor waiting for more than 60 seconds, new leads and (owners and admins) billing. The workspace can also send its chat and lead notices to up to 10 extra addresses.
  • A teammate's reply to a visitor who has left (no chat open in their browser for 2 minutes) is emailed to the visitor when they gave their email.
  • The visitor can have the chat emailed to them (three times an hour per chat).
  • The same moments are sent to the workspace's webhooks: chat.started, chat.waiting and chat.closed (chapter 29).
Screenshot: inbox, a waiting chat taken over
A visitor waiting for a person, taken over from the inbox
Screenshot: widget with a teammate replying
The visitor's side: a teammate has joined the chat

12Leads and bookings

The lead form

Each assistant's Lead form tab decides when the widget asks for the visitor's details:

  • Off.
  • When it fits: after the visitor asks about a price, a quote or being contacted (in the widget's six languages), or at their third question.
  • Before the chat: the form comes first, once per visitor.

The form asks for a name and an email; the phone number is off, optional or required. When the assistant is offline, or the workspace's replies are used up, the widget shows a contact form instead. One chat makes one lead; a second form updates it.

Every new lead appears live in Leads, is emailed to the members who want lead emails and is sent to the lead.created webhook. In Leads, the team sees the chat it came from and its booking, moves it through New, Contacted, Won and Lost, gives it an owner, adds notes (never shown to the visitor), adds leads by hand and downloads them as CSV (spreadsheet formulas are defused). Everyone reads leads; agents and up change them.

Calendars and bookings

Bookings lets visitors book a time inside the chat. A workspace adds calendars (one per kind of meeting, for example "Free roof survey"), each with its weekly hours per weekday, slot length, buffer between meetings, minimum notice, how many days ahead visitors may book, and time zone. In an assistant's Booking rules, switch bookings on and pick the calendar.

  • When a visitor asks to book ("book", "appointment", "survey", in the widget's six languages), the widget shows the free times. Free times are the weekly hours, minus confirmed bookings and their buffers, minus the times a synced calendar says are busy.
  • Two visitors can never hold the same time: a database rule refuses the second, who is told "That time was just taken" and shown the day's fresh times.
  • The visitor can move or cancel the booking from the chat; the team moves, cancels or adds bookings in the week view. New and cancelled bookings are sent to the booking.created and booking.cancelled webhooks.

Booking emails and the booking page

  • The visitor gets a "Booking confirmed" email with a private link to the booking's own page, APP_URL/booking/…. Later, a short email when the booking is moved or cancelled. The times are in the visitor's time zone and the words in the chat's language (English, Spanish, French, German, Portuguese or Arabic; other languages get the English email, which you can reword in Platform admin → Email and brand).
  • The booking page needs no account. It shows the booking with the business's name, logo and colour, and lets the visitor pick another free time or cancel, up to the calendar's minimum notice. When the time they picked was just taken, the page shows that day's free times again. The link holds a long random token; only its fingerprint is stored, and each link is limited to 120 views and 10 changes an hour.
  • The team: the members who keep lead and booking emails on get a "New booking" notice when the assistant books a time, and a notice when a visitor moves or cancels one.
  • The public demo and the demo workspaces send none of these: they only write them to the server log.

Google Calendar

On plans with Google Calendar and Cal.com, a calendar can be connected to a Google Calendar: Askmark then leaves out the times Google says are busy, and writes new, moved and cancelled bookings to it. Your customers connect with their own Google account; you set up one Google OAuth client for the whole platform, once:

  1. In the Google Cloud console, create a project (or pick one) and turn on the Google Calendar API under APIs and Services → Library.
  2. Under OAuth consent screen, choose External, give the app your product's name, support email and logo, and add the scopes …/auth/calendar.events, …/auth/calendar.freebusy and …/auth/userinfo.email.
  3. Under Credentials → Create credentials → OAuth client ID, choose Web application and add this Authorized redirect URI: your APP_URL plus /api/v1/calendars/google/callback, for example https://chat.yourbrand.com/api/v1/calendars/google/callback.
  4. In Askmark, open Platform admin → Setup check → Google Calendar sync. It shows the redirect URI to copy into step 3. Paste the client ID and client secret and save; the secret is sealed in the database and shown only by its last four characters. (Instead, you can put them in GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET in .env and run docker compose up -d; the ones saved on the screen win.)
  5. While the consent screen is in Testing, only the Google accounts you add as test users can connect. Calendar access is a sensitive scope: to let every customer connect, publish the app and pass Google's verification.

Then, in a calendar, a workspace admin presses Connect Google Calendar, signs in with Google and comes back connected. The Google token is sealed in the database; Disconnect removes it.

Cal.com

A business that already books with Cal.com can let the assistant offer its Cal.com times: in Cal.com, create an API key (Settings → Developer → API keys) and note the event type's id (in the event type's address or settings); in the Askmark calendar, press Connect Cal.com and paste both. Askmark checks them by reading a day of times, then offers Cal.com's own free times and books through Cal.com. The key is sealed in the database.

Screenshot: leads
Leads by status, with the chat each came from
Screenshot: bookings week view
Bookings: the week, with the calendars and their sync

13Analytics

Analytics shows how the assistants are doing over the last 7, 30 or 90 days in the workspace's time zone, for one assistant or all, each number next to the period before it:

  • Chats a day (a chat counts once it has a message).
  • Resolution: the share of chats closed as resolved without a person.
  • How chats ended: resolved by the assistant, a person asked for, no answer found, or handed over by a rule.
  • Leads (and how many were won) and bookings that came from chats.
  • Ratings visitors gave at the end of a chat, and the time to a first answer.
  • Top questions and unanswered questions: alike wordings are grouped into one question. Next to each unanswered question, Add an answer saves a Q&A pair (chapter 8), and every wording of that question leaves the list until it is asked again.
  • Languages visitors wrote in, and the busiest hours of the week.

The Overview page shows the chosen period at a glance, and every number opens the chats behind it: who is chatting right now (with Take over), chats and how many were resolved without a person, leads and bookings, ratings, the time to a first answer, this month's replies and when they reset, the questions the assistant could not answer, the top questions and the latest leads.

Screenshot: unanswered questions
Unanswered questions, grouped, with Add an answer

14Team, roles and data

Roles

RoleWhat they can do
OwnerEverything, plus the plan and billing, and deleting the workspace.
AdminEverything except billing and deleting: knowledge, assistants, the widget, the team, AI keys, settings, API keys and webhooks.
AgentAnswers chats (take over, reply, notes, hand back, close), and changes leads and bookings.
ViewerReads everything, changes nothing.

Roles are checked by the server on every request; the screens only hide what a role cannot use. Owners and admins invite people in Settings → Team; an invitation link works for 7 days. Members and open invitations together count toward the plan's seats. One person can belong to several workspaces and switch between them.

Visitors' data

  • The widget makes a random visitor token and keeps it in the visitor's browser; the server stores only a keyed hash of it. Without a name or email, a visitor is anonymous.
  • Askmark stores the chat's messages, the page it started on, the visitor's language, and the name, email and phone the visitor typed into a form.
  • Each assistant links its business's privacy page under the chat; the widget says the business keeps the chat so the team can reply. The business is responsible for its own privacy notice.

Export and delete

  • Export: owners and admins download everything the workspace holds as one JSON file or a zip of CSV files, one per table: the workspace, members and invitations, assistants, knowledge sources and documents, chats with their messages, visitors, leads, calendars and bookings, API keys (their prefix only) and webhooks (never their secrets). AI keys, calendar tokens and embeddings are never exported. The file is reached through a signed link that works for an hour, then deleted; a workspace can export ten times an hour.
  • Delete: the owner deletes the workspace in Settings → General by typing its name. Its paid plan is cancelled at once, and 30 days later everything it held is deleted. Payments and subscriptions are kept for the books, with the workspace's name blanked.
Screenshot: settings, team
Settings → Team: members, roles and open invitations
Part 04

Run the platform

15Plans, limits and trials

You sell plans to your customers. Each plan has a price, a free trial, limits and features; the server enforces them on every request.

Plans and their limits

Platform admin → Plans. Each plan has a name, a description, a monthly price and an optional yearly price, the currency, a free trial in days, a list of features shown on the pricing page, whether it is public, whether it is the default plan new workspaces start on, and an optional "Most popular" badge. Its limits are enforced on the server, inside the database transaction that adds the rows, under a lock per workspace, so two requests at once can never pass a limit together:

LimitWhat happens when it is reached
Replies a month (message credits)One assistant reply is one credit, taken before the model is called and given back when the call fails (chapter 7). When the month (UTC) is used up, the assistants stop answering and the widget shows a contact form until the next month or an upgrade.
Pages of knowledgeIndexed pages, files and Q&A pairs. A crawl stops at the limit and says so; new files and pairs are refused.
AssistantsA new assistant is refused. Archived assistants do not count.
SeatsMembers plus open invitations. Inviting another person is refused.
File storageAn upload that would pass the plan's storage is refused.
Bookings, Google Calendar and Cal.com, API keys webhooks and MCP, white label, own AI keysSwitches: the feature is off for workspaces on a plan without it, with an upgrade prompt.

An empty limit means no limit. A refused request answers 402 plan_limit and names the limit, and the screens show the upgrade dialog. Archiving a plan takes it off sale; its subscribers keep it, and you can restore it later.

The sample plans

The install wizard adds these three (you can change or archive them). A year costs ten months. Starter is the default plan, so a new workspace starts its free trial there.

LimitStarterGrowth (most popular)Agency
Price a month$29$79$199
Price a year$290$790$1,990
Free trial14 days14 days14 days
Replies a month (message credits)1,50010,00040,000
Pages of knowledge3002,00010,000
Assistants1315
Seats2515
File storage100 MB1 GB5 GB
BookingsYesYesYes
Google Calendar and Cal.comNoYesYes
API keys, webhooks and MCPNoYesYes
White labelNoNoYes
Own AI keysNoNoYes

Trials, failed payments and read-only workspaces

  • A workspace on a paid default plan gets the plan's free trial without a card. When the trial ends with no plan paid, the workspace turns read-only and its owners get one email: everything can be read and a plan can be paid, but nothing can be changed, and its assistants stop answering (the widget shows the contact form) until a plan is paid.
  • While the gateway retries a failed card, the workspace keeps working and the owner gets a "payment failed" email. After Stripe's last retry, the workspace is suspended the same way until it pays; paying lifts it at once.
  • A cancelled plan runs to the end of its paid period, then the workspace turns read-only the same way.
  • You can give any workspace any plan by hand in Platform admin → Workspaces (no gateway is charged), for example a free plan for a partner.
Test checkout without a gateway

DEMO_PAYMENTS="true" in .env turns on a test checkout that switches plans without any card. It is "false" in the shipped file and only works while no gateway is set up. Keep it "false" on a live site.

Licence

Charging your customers through Askmark (selling plans or subscriptions) requires the Envato Extended Licence. The Regular Licence covers a single product whose end users are not charged.

Screenshot: platform admin, plans and limits
Platform admin → Plans: prices, trial, limits and features of each plan
A workspace at a plan limit sees what the next plan gives
A workspace at a plan limit sees what the next plan gives

16Payment gateways

Askmark takes payments through your own account at Stripe, PayPal, Razorpay or Paystack: checkout and card changes happen on the gateway's own pages, and plans switch on only from the gateway's signed webhooks. Turn on one or several in Platform admin → Payments, where each gateway has its keys, an on/off switch and a Test button (or set the keys in .env). When more than one is on, the owner picks one at checkout.

Gateway fees

Every gateway is a third-party service with its own pricing, and you pay its fees on every payment (chapter 7 lists their list prices). Each gateway's pricing page has the rates for your country.

How payments stay right

  • Every webhook's signature is checked before it is read (a forged one is refused), and each event is stored with its gateway and event id in the same database transaction as its changes, so a delivery the gateway sends again is never applied twice, and an event that fails to apply stores nothing and is answered with an error, so the gateway sends it again.
  • Payments and subscriptions are never deleted with a workspace or a plan, so refunds and disputes still find their invoices. Invoices are numbered AM-0001 and up.
  • A cancelled plan runs to the end of its paid period. A closed workspace is never billed again: its subscription is cancelled at the gateway.

Each plan at each gateway

Each paid plan needs its price at every gateway you turn on, monthly and (if you sell it) yearly: a Stripe price ID (price_…), a PayPal plan ID (P-…), a Razorpay plan ID (plan_…) or a Paystack plan code (PLN_…). Create them at the gateway with the same amount and currency as the plan, then paste them into the plan in Platform admin → Plans, under "Prices at your payment gateways", and save. Leave a gateway empty if you don't use it. Askmark stores the IDs exactly as typed: a Stripe price ID must start with price_, and the others must be one word. It does not compare the amount with the gateway, so check that each price matches the plan before you open sign-ups, ideally with a test checkout.

Stripe

  1. In the Stripe Dashboard, switch to Test mode first. Under Developers → API keys, copy the Secret key (sk_test_…) and the Publishable key.
  2. Paste them into Platform admin → Payments → Stripe (or STRIPE_SECRET_KEY and STRIPE_PUBLISHABLE_KEY in .env).
  3. In Stripe, open Product catalog → Add product for each paid plan, with a recurring monthly price and, if you sell yearly, a recurring yearly price, and copy each price ID into the plan (above).
  4. Open Developers → Webhooks → Add endpoint with the URL https://chat.yourbrand.com/api/v1/webhooks/stripe (your APP_URL plus /api/v1/webhooks/stripe) and these events: checkout.session.completed, customer.subscription.created, customer.subscription.updated, customer.subscription.deleted, invoice.paid, invoice.payment_succeeded, invoice.payment_failed, charge.refunded, charge.dispute.created, charge.dispute.closed, customer.updated, customer.tax_id.created, customer.tax_id.updated, customer.tax_id.deleted, payment_method.attached and payment_method.updated.
  5. Copy the endpoint's Signing secret (whsec_…) into Payments → Stripe (or STRIPE_WEBHOOK_SECRET). Without it, paid plans never switch on, and the setup check says so.
  6. In Stripe, open Settings → Billing → Customer portal and activate it, with payment method updates, invoice history and cancellation turned on. Owners reach it from Settings → Plan and billing → Billing portal.
  7. Test a full upgrade with Stripe's test card 4242 4242 4242 4242. Then go live: repeat these steps in live mode with your live keys, live price IDs and a live webhook.

PayPal

  1. At developer.paypal.com, open Apps and Credentials, stay on Sandbox for testing and create a REST app. Copy its Client ID and Secret.
  2. For each paid plan, create a product and a subscription plan (monthly, and yearly if you sell it) in PayPal, and copy each plan ID (P-…) into the plan in Askmark.
  3. In the app, add a webhook with the URL https://chat.yourbrand.com/api/v1/webhooks/paypal and these events: BILLING.SUBSCRIPTION.ACTIVATED, BILLING.SUBSCRIPTION.RE-ACTIVATED, BILLING.SUBSCRIPTION.UPDATED, BILLING.SUBSCRIPTION.CANCELLED, BILLING.SUBSCRIPTION.SUSPENDED, BILLING.SUBSCRIPTION.EXPIRED, BILLING.SUBSCRIPTION.PAYMENT.FAILED, PAYMENT.SALE.COMPLETED, PAYMENT.SALE.REFUNDED, PAYMENT.SALE.REVERSED, PAYMENT.CAPTURE.REFUNDED and PAYMENT.CAPTURE.REVERSED. Copy the Webhook ID: Askmark checks every PayPal event through PayPal's own signature check with it.
  4. Paste the client ID, client secret and webhook ID into Platform admin → Payments → PayPal, with the mode sandbox while testing (or PAYPAL_CLIENT_ID, PAYPAL_CLIENT_SECRET, PAYPAL_WEBHOOK_ID and PAYPAL_MODE in .env).
  5. Test an upgrade with a sandbox buyer account. To go live, switch to Live in the developer dashboard, make a live app, plans and webhook, paste their values and set the mode to live.

When a PayPal subscription is cancelled, PayPal stops billing at once; Askmark keeps the plan to the end of the period already paid.

Razorpay

  1. In the Razorpay Dashboard, switch to Test Mode, open Account and Settings → API Keys and generate a key: copy the Key ID (rzp_test_…) and Key Secret. Subscriptions must be enabled on your account.
  2. Under Subscriptions → Plans, create a plan for each paid plan and interval, and copy each plan ID (plan_…) into the plan in Askmark.
  3. Under Webhooks → Add new webhook, use the URL https://chat.yourbrand.com/api/v1/webhooks/razorpay, choose a secret, and select subscription.activated, subscription.charged, subscription.updated, subscription.resumed, subscription.pending, subscription.halted, subscription.cancelled, subscription.completed, payment.refunded and refund.processed. Every event is checked with that secret (X-Razorpay-Signature).
  4. Paste the key ID, key secret and webhook secret into Platform admin → Payments → Razorpay (or RAZORPAY_KEY_ID, RAZORPAY_KEY_SECRET, RAZORPAY_WEBHOOK_SECRET).
  5. Test with Razorpay's test cards, then repeat in Live Mode with live keys, plans and webhook. A cancelled Razorpay subscription stops at the end of its billing cycle.

Paystack

  1. In the Paystack Dashboard, open Settings → API Keys and Webhooks in test mode and copy the Secret key (sk_test_…) and Public key.
  2. Under Plans, create a plan for each paid plan and interval (monthly or annually), and copy each plan code (PLN_…) into the plan in Askmark.
  3. On the API Keys and Webhooks page, set the Webhook URL to https://chat.yourbrand.com/api/v1/webhooks/paystack. Paystack sends every event there and signs it with your secret key (x-paystack-signature), so there is no separate webhook secret; Askmark reads charge.success, subscription.create, subscription.enable, subscription.not_renew, subscription.disable, invoice.payment_failed and refund.processed.
  4. Paste both keys into Platform admin → Payments → Paystack (or PAYSTACK_SECRET_KEY and PAYSTACK_PUBLIC_KEY).
  5. Test with Paystack's test cards, then switch the dashboard to live mode and paste the live keys, plan codes and webhook URL.
Screenshot: platform admin, payments
Platform admin → Payments: each gateway with its keys, webhook and test

17The platform admin

The platform admin is your side of Askmark, under /platform. The install wizard makes you its first admin.

Overview

Revenue, paying workspaces and trials, workspaces at risk (failed payments, trials ending, plans almost used up), replies this month and the AI cost of your keys at list prices, the busiest workspaces, and what needs you.

Workspaces

Search and filter by status and plan. Create a workspace opens one for a customer: its name, the owner's email and the plan, whose free trial starts at once. An owner who has no account yet gets an email with a link to choose a password. A workspace's details show its plan, usage, members, subscription and payments, and let you:

  • Change the plan by hand (no gateway is charged);
  • Suspend or reactivate it (suspending emails the owners; a suspended workspace can read everything and pay, but its assistants stop answering and nothing can be changed);
  • Close it: its paid plan is cancelled and its data is deleted 30 days later (chapter 14);
  • Open as owner, to see exactly what the customer sees: a 30-minute session that is written to the audit log and can never reveal secrets or reach the platform admin.

Plans, payments, AI providers

  • Plans: chapter 15. Payments: the gateways (chapter 16), every invoice (paid, failed, refunded) and every subscription with its status and renewal date.
  • AI providers: the platform's keys and models (chapter 6), which plans may bring their own keys, and this month's AI cost.
  • Email and brand: chapters 18 and 19. Languages: chapter 21. Setup check: chapter 5.

The price table

The list prices every cost figure uses (chapter 7) are kept per model. Every workspace sees them, read-only, beside its AI settings; a super-admin changes a model's input and output prices, or adds a model that is not in the table yet, with PUT /api/v1/provider-prices/{model} (chapter 33). A model that is not in the table is priced by its provider's row for other models. Saved prices are kept for the whole platform; models added to the built-in table by a later update still show up.

Platform staff

Platform admin → Users lists every person across every workspace, with the tabs All, Platform staff and Suspended. Give a person a Platform role:

  • Admin: everything you can do.
  • Viewer (read-only): reads every platform page and is refused every change, for a bookkeeper or an investor.
  • None: a normal customer account.

Suspend signs a person out everywhere and stops them signing in until you Reactivate them; their workspaces keep running. You can never change your own role or suspend yourself, and the last platform admin can never lose the role.

Screenshot: platform admin, workspaces
Workspaces with their plan, status, usage and actions
Screenshot: platform admin, AI providers and cost
AI providers: the platform's keys and this month's cost by model

18White label and rebrand

Your brand

Platform admin → Email and brand changes the product name, the logo, the main colour, the support email and the public site address without touching code. They show in the sidebar, the sign-in and sign-up pages, the public landing and pricing pages, the emails, the widget's "Powered by" line (your product name) and the browser tab, on the next page load. The app works out the lighter and darker shades of the colour for both themes. The logo must be a PNG, SVG or WebP of at most 1 MB; SVG files with scripts are refused.

Legal pages

The same page edits the terms of service, privacy policy and refund policy linked from the public pages: a blank line starts a paragraph, a line starting with # is a heading. Until you save your own, each page shows sample text with a note to replace it. Write your own: they are your agreement with your customers.

Your customers' white label

A workspace on a plan with White label puts its own name, logo and colour on its widget and on the emails it sends to visitors and its team, and can hide "Powered by" under its chats (chapter 10). Platform notices (payments, limits) stay yours.

Help links

Askmark never links to an address of ours. Set your own in Platform admin → Email and brand:

  • Help docs: where you publish your customers' help (for example this guide, docs/index.html). It is the Help and docs link in the account menu and the sidebar, and the public site's Docs link.
  • Support page: where people ask for help. The help links use it when there is no Help docs address, and the public site's and the sign-in page's Status link goes there.
  • Support email: the public site's Contact link.

Fill in all three before you go live: until you do, the account menu hides its help link and the other links point to a placeholder address (askmark.example) that leads nowhere.

Search engines

Askmark answers /robots.txt itself: search engines may index the public pages (landing, pricing, legal pages, sign-in and sign-up), while the workspaces, the platform admin, the install wizard, invitation and reset links, and the API stay closed. With SEARCH_INDEXING=off in .env, for a staging copy, /robots.txt closes every page and every answer also carries X-Robots-Tag: noindex, nofollow. Restart the app after changing it.

To change the public landing and pricing pages' text, or anything else beyond these settings, edit the React pages (chapter 32) and rebuild.

Screenshot: platform admin, email and brand
Email and brand: name, logo, colour, the mail server and the emails the app sends

19Email (SMTP)

Askmark sends password reset links (valid one hour), team invitations (valid 7 days), notices to the team (a new chat, a visitor waiting, a new lead), emails to visitors (a teammate's reply after they left, a transcript they asked for), and notices to owners and admins (a payment failed, a plan limit was reached, a workspace was suspended, a trial ended, a webhook was turned off). Each platform notice goes out at most once per event; emails never hold up the chat or the request that caused them, because jobs send them.

  1. Get SMTP details from any email provider (Amazon SES, Postmark, Brevo, Mailgun, your own mail server…): host, port, user name, password and a sender address on a domain you have verified with that provider.
  2. Enter them in Platform admin → Email and brand → SMTP (or the SMTP_* keys in .env). Use starttls on port 587, tls on port 465.
  3. Press Send test email with your own address, or Test on the Email row of the setup check.

Without SMTP, each email is written to the app's log with its link (docker compose logs app), which is enough for testing. The wording of every email is shown on the same page and can be changed there. Besides account emails (password resets, invites, payment notices), Askmark emails visitors their transcripts, a teammate's late replies and their booking emails (confirmed, moved, cancelled; chapter 12), and the team its waiting, lead and booking notices. Demo workspaces only ever write their emails to the log.

Email costs

Your email provider is a third-party service with its own pricing (for example about $0.10 per 1,000 emails at Amazon SES); you pay for the emails Askmark sends.

20File storage

Knowledge files, assistant pictures, workspace logos and exports are kept in file storage. Files are private: the browser gets them only through the app, which checks the workspace first.

  • The bundled MinIO (the default with Docker): an S3-compatible store on the same server, in the minio-data Docker volume. Docker creates its bucket on the first start. Set S3_SECRET_ACCESS_KEY in .env to a password of your own.
  • Any S3-compatible bucket (AWS S3, Cloudflare R2, Backblaze B2, Wasabi, DigitalOcean Spaces…): set STORAGE_DRIVER=s3, S3_ENDPOINT, S3_REGION, S3_BUCKET, S3_ACCESS_KEY_ID and S3_SECRET_ACCESS_KEY. The bucket stays private. MinIO can then be left running unused or removed.
  • The server's own disk: STORAGE_DRIVER=local keeps files in /app/storage (the app-storage volume). Fine for one server; with several copies of the server (chapter 24) use a bucket.

Each plan caps a workspace's files (File storage); a workspace's use is the sum of its files. Test the storage with the setup check, which writes, reads and deletes a small file.

Storage costs

The bundled MinIO and the local disk cost nothing beyond your server. A cloud bucket is a third-party service with its own pricing (for example Cloudflare R2 at $0.015 per GB a month).

21Languages and right to left

  • The widget speaks English, Spanish, French, German, Portuguese and Arabic. It picks the language from the snippet's data-lang, else the assistant's language, else the visitor's browser. In Arabic it reads right to left. Each assistant can change any of the widget's words (chapter 9, Look).
  • The assistant's replies follow the visitor's language when the assistant speaks it (chapter 9), whatever the language of the knowledge: the model reads the sources and answers in the reply language.
  • The web app has the same six interface languages. Each person picks theirs, the workspace has a default, and Arabic turns the whole app right to left, with an Arabic font (Noto Sans Arabic). The six catalogues hold the same keys, so no screen falls back to English.
  • Platform admin → Languages previews every language's words. To add a language: copy apps/frontend/src/i18n/locales/en.json, translate every value, add the language to LANGS in apps/frontend/src/i18n/index.ts, and rebuild. For the widget, add its words in apps/widget/src/i18n.ts.
Screenshot: widget in Arabic
The widget in Arabic, right to left

22Background jobs and the scheduler

Work that talks to outside services or takes time runs in the background, inside the same askmark program: there is no separate worker to start. The job queue is a table in PostgreSQL; each job is claimed by one worker (several workers and server copies never run one job twice), retried after a failure with a growing wait (10 seconds, doubling, at most an hour), and picked up again after a crash. JOB_WORKERS (default 4, from 1 to 32) sets how many run in each server copy, and one job may run for at most 10 minutes.

JobWhenWhat it does
CrawlWhen a website is added, on Re-crawl now, and on its daily or weekly scheduleReads the site (chapter 8).
EmbedAfter new or changed knowledge, and after the embedding model changesEmbeds the chunks that have no embedding of the current model, in batches.
Inbox emailsA new chat, a visitor waiting 60 seconds, a teammate's reply to a visitor who leftEmails the members who want it, or the visitor (chapter 11).
Webhook deliveryWhen a subscribed event happens, and on each retrySends the signed event (chapter 29).
Export clean-upAn hour after an exportDeletes the export file.
HousekeepingEvery hourClears expired sessions, rate-limit windows, reset links, old invitations and finished jobs older than 14 days; ends trials and plans nobody paid for; deletes workspaces closed more than 30 days ago.
Demo visitors and demo resetDemo mode onlyA new demo visitor every few minutes, and the demo put back as seeded at 03:00 UTC (chapter 23).

A scheduler in every server copy looks every minute: due crawls and webhook retries are queued, and the hourly and daily jobs are queued once per period, however many copies are running. To check it all works: Platform admin → Setup check → Background jobs shows failed and waiting jobs with their reason and a Retry button; docker compose logs -f app shows the jobs as they run.

23Demo mode and the seed commands

Demo mode

DEMO_MODE="true" turns an install into a public demo, like the item's live preview. It is "false" in the shipped .env.example: never turn it on for a real platform. With it on:

  • The demo data is added on start: Sunmere Solar, a solar installer on the Growth plan whose assistant "Sunny" answers its website's visitors, with its knowledge (pages, files and Q&A), 90 days of chats, leads, bookings and ratings, and two more businesses for the platform pages.
  • The sign-in page shows one-click sign-ins: the owner, an agent who answers chats, and a read-only platform admin. They work inside the marketplace's preview frame too. One address can use them 60 times an hour.
  • No AI provider is called. Sunny answers its suggested and most-asked questions with stored sample answers written from its knowledge, and other questions with a built-in stand-in; every demo reply is labelled "Demo sample" in the widget.
  • New visitors keep arriving every few minutes, and some ask for a person, so the inbox and the live screens keep moving.
  • Plan changes are test checkouts, the install wizard is off, demo emails only reach the log, and risky actions (AI keys, passwords, invitations, crawling and uploads, webhooks and API keys, platform settings and plans) are locked.
  • The demo data is removed and added again every night at 03:00 UTC.

Seed commands

CommandWhat it does
docker compose exec app askmark seed-demoAdds the demo data, every row marked as demo. It only adds rows and never deletes anything. It refuses to run on a database that has any real account; --confirm adds the demo next to real data anyway (for a staging copy).
docker compose exec app askmark reset-demoRemoves the demo rows and adds them again. It refuses to run when the database holds any real account.
Platform admin → Setup check → Remove demo data (super-admin; POST /api/v1/admin/demo-data/remove)After asking, deletes only rows marked as demo: the sample workspaces with their people, chats, leads, bookings and payments. Your own account and settings stay, and a demo workspace that has a real payment or subscription is kept. It is locked on the public demo.
docker compose exec app askmark migrateApplies the database migrations and stops (the server also does this on every start).
Screenshot: one-click demo sign-in
The public demo's sign-in page with its one-click sign-ins
Part 05

Deploy and maintain

24Deploy on a VPS

For a public launch, Askmark must be reachable at an https:// address: websites load the widget from it, the payment gateways send their webhooks to it, Google returns there after a calendar sign-in, and every email links there.

1. Pick a server

SizeGood for
2 cores, 4 GB memory, 40 GB diskBuilding on the server and running a growing platform. The AI providers write the replies; the server searches the knowledge, streams the replies and serves the screens.
1 to 2 cores, 1 to 2 GB memoryRunning a build made on another computer (below), or building with swap added, for a small platform.
4+ cores, 8+ GB memoryMany workspaces with large knowledge bases and busy widgets. Knowledge search runs in PostgreSQL, which is fastest when the search index fits in memory.

Any provider that sells Linux servers with Docker works. Disk use grows mainly with knowledge and chats: every chunk keeps its text and a 1,536-number embedding with its search index, so plan a few hundred MB for every 10,000 pages of knowledge, plus the chats, and keep backups (chapter 26).

2. DNS

At your domain registrar, add an A record for the address you want (for example chat for chat.yourbrand.com) pointing at your server's IP address. Wait until ping chat.yourbrand.com shows that IP.

3. Settings

In .env:

APP_URL=https://chat.yourbrand.com
APP_DOMAIN=chat.yourbrand.com
TRUSTED_PROXY_HOPS=1

4. Start with HTTPS (Caddy)

When nothing else on the server uses ports 80 and 443, the bundled Caddy does it all. Open both ports in your server's firewall, then:

docker compose --profile https up -d --build

The https profile adds Caddy, a web server that gets and renews a free certificate for APP_DOMAIN by itself. Open https://chat.yourbrand.com; the first visit takes a few seconds while the certificate is issued. Caddy passes the live streams (the widget's replies and the inbox's updates) through unbuffered.

Already running a proxy?

Caddy needs ports 80 and 443 for itself. If Traefik, Nginx Proxy Manager, Nginx or Apache already owns them, leave out --profile https, start with docker compose up -d --build and let your proxy pass visitors on to Askmark, as the next part shows.

Behind Traefik or another proxy you already run

  • Installed on the server itself (Nginx or Apache from the system's packages): point it at http://127.0.0.1:8080 (APP_PORT), the port the app opens on this server only.
  • In a Docker container (Traefik, Nginx Proxy Manager, an Nginx container): it cannot use 127.0.0.1:8080, because inside a container that address is the container itself. Put the app on the proxy's Docker network instead, with a compose.override.yaml file next to compose.yaml; Docker Compose reads it by itself. docker network ls shows the proxy's network name; the examples call it proxy.

Traefik: the labels tell Traefik the address, the entrypoint and the certificate resolver. Use the entrypoint and resolver names from your own Traefik setup (websecure and letsencrypt are common).

# compose.override.yaml: Askmark behind a Traefik that runs in Docker
services:
  app:
    networks: [default, proxy]    # default: the app's own database and storage
    labels:
      - traefik.enable=true
      - traefik.docker.network=proxy   # the same network name
      - traefik.http.routers.askmark.rule=Host(`chat.yourbrand.com`)
      - traefik.http.routers.askmark.entrypoints=websecure
      - traefik.http.routers.askmark.tls.certresolver=letsencrypt
      - traefik.http.services.askmark.loadbalancer.server.port=8080

networks:
  proxy:
    external: true
    name: proxy                   # your proxy's network, as docker network ls shows it

Nginx in a container, or Nginx Proxy Manager: join the network the same way and give the app a name there that no other container uses.

# compose.override.yaml: Askmark on the network of an Nginx container
services:
  app:
    networks:
      default:
      proxy:
        aliases: [askmark]

networks:
  proxy:
    external: true
    name: proxy                   # your proxy's network, as docker network ls shows it

Then send the traffic to http://askmark:8080. In Nginx:

location / {
    proxy_pass http://askmark:8080;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_http_version 1.1;
    proxy_buffering off;              # replies and live updates are streams
    proxy_read_timeout 300s;
    client_max_body_size 22m;         # knowledge files go up to 20 MB
}

In Nginx Proxy Manager, add a Proxy Host with scheme http, forward hostname askmark and port 8080, request its SSL certificate, and paste the last four lines above into the Advanced tab. Then start the app with docker compose up -d --build and keep TRUSTED_PROXY_HOPS=1.

5. Visitor addresses and rate limits

Askmark limits sign-ins, sign-ups, password resets and widget messages per visitor address, so nobody can guess passwords or flood an assistant at speed. It reads the visitor's address from the X-Forwarded-For header only behind the number of proxies you trust, set with TRUSTED_PROXY_HOPS. A visitor can type any X-Forwarded-For they like, so trusting it without a proxy would let them make up a new address for every try.

Your setupSetting
The bundled Caddy (--profile https)TRUSTED_PROXY_HOPS=1 (the Docker default). The app port is published on 127.0.0.1 only, so Caddy is the only way in, and Caddy replaces any X-Forwarded-For a visitor sends with the real address.
Your own Nginx, Apache or Traefik on the same serverTRUSTED_PROXY_HOPS=1 and keep APP_BIND=127.0.0.1. Turn off response buffering so the widget's replies and live updates stream.
A load balancer or CDN in front of your proxy (for example Cloudflare, then Caddy)TRUSTED_PROXY_HOPS=2: one hop for each proxy that adds an address. Never set a higher number than the proxies really in front of the app.
No proxy at all (app port open to the internet)TRUSTED_PROXY_HOPS=0 and APP_BIND=0.0.0.0. No header is trusted, every visitor counts as one address, and the per-account and per-visitor-token limits still apply. Without HTTPS this suits only testing.

Build on another computer

If your server is small, build the program on a bigger computer with Docker and copy it over. The packed program is one file that already holds the web app and the widget.

# on the bigger computer, in the askmark folder (use --platform linux/arm64 for an ARM server)
docker build -f docker/Dockerfile --target pack -t askmark-pack --platform linux/amd64 .
docker create --name askmark-pack-copy askmark-pack
mkdir -p prebuilt
docker cp askmark-pack-copy:/askmark prebuilt/askmark
docker rm askmark-pack-copy

# copy prebuilt/askmark into the same folder on the server, then on the server:
BUILD_TARGET=prebuilt docker compose --profile https up -d --build

Set BUILD_TARGET=prebuilt in .env to keep it for later starts. The program must match the server's processor type (Intel/AMD = linux/amd64, ARM = linux/arm64).

Without Docker

Build it as in chapter 3, Install without Docker, then run ./askmark serve behind your own HTTPS proxy and keep it running with a service manager such as systemd. The server applies the migrations when it starts; ./askmark migrate applies them on their own.

Several servers

Askmark can run as several copies of the same program behind one load balancer, for more traffic or no downtime: the job queue hands each job to one copy, live updates and saved settings reach every copy through PostgreSQL, and the sign-in limits are kept in the database. Give every copy the same .env (above all the same APP_SECRET) and the same DATABASE_URL, use a bucket for files (not STORAGE_DRIVER=local), and count the load balancer in TRUSTED_PROXY_HOPS. The other per-address limits are counted per copy.

Two copies on one server

To run a staging copy next to the live one, unzip Askmark into a second folder and give each copy its own .env:

# .env of the live copy
COMPOSE_PROJECT_NAME=askmark
APP_PORT=8080
APP_URL=https://chat.yourbrand.com

# .env of the staging copy
COMPOSE_PROJECT_NAME=askmark-staging
APP_PORT=8081
APP_URL=https://staging.yourbrand.com
SEARCH_INDEXING=off

COMPOSE_PROJECT_NAME keeps each copy's containers, database, files, network, image and build cache apart. Give each copy its own passwords and its own APP_SECRET, and its own AI keys if you can, so the staging copy's replies are not billed to the live keys. Only one copy can run the bundled Caddy, so put both behind one proxy you run yourself.

25Managed PostgreSQL and pgvector

The Docker stack runs its own PostgreSQL with pgvector, which is all most platforms need. To use a managed database instead, it must be PostgreSQL 15 or newer with the vector extension (pgvector 0.5 or newer, for the HNSW search index) and btree_gist.

Point the app at it

  1. Create a database and a login, and turn the extensions on (below).
  2. Put the connection string in .env as DATABASE_URL, for example postgres://askmark:password@db.example.com:5432/askmark?sslmode=require. Use a direct or session-mode address, not a transaction-mode pooler: Askmark listens for live updates on its database connection.
  3. With Docker, nothing else is needed: the stack hands the app the DATABASE_URL from .env when it is set, and its own database otherwise. The bundled database then stays empty; leave it running (it uses little memory) or remove the postgres service from docker/docker-compose.yml together with the app's depends_on entry for it.
  4. Run docker compose up -d. The app adds the extensions when its login may, and applies the migrations.

Turn on pgvector

ServiceWhat to do
Neonpgvector is built in. Run create extension vector; create extension btree_gist; in the SQL editor, or let Askmark do it. Use the connection string without -pooler in the host name.
SupabaseDatabase → Extensions: turn on vector and btree_gist. Use the direct connection or the session pooler (port 5432), not the transaction pooler (port 6543).
AWS RDS and Aurora PostgreSQLpgvector is available on current versions. As the master user, run create extension vector; create extension btree_gist;.
Google Cloud SQLpgvector is available. As the postgres user (a cloudsqlsuperuser), run the two create extension lines.
Azure Database for PostgreSQL (Flexible Server)Server parameters → azure.extensions: add VECTOR and BTREE_GIST and save. Then run the two create extension lines.
DigitalOcean Managed PostgreSQLpgvector is available. As doadmin, run the two create extension lines.

"extension vector is not available"

The install wizard's database step shows this when the PostgreSQL server has no pgvector installed. Fix it where the database runs:

  • Docker: the database image must be pgvector/pgvector:pg17, as shipped, not the plain postgres image. If you changed it, change it back and run docker compose up -d.
  • A managed database: turn the extension on as in the table above; on Azure it must be on the allow-list first.
  • Your own PostgreSQL server: install the package for your version (on Debian and Ubuntu with the PostgreSQL apt repository: apt install postgresql-17-pgvector), then run create extension vector; create extension btree_gist; as a superuser.
  • "permission denied to create extension" means the app's login may not add extensions: run the two lines once as the database's admin user.

Then press Check again in the wizard: the full app starts by itself.

26Backups, updates and exports

Back up

docker compose exec -T postgres sh -c 'pg_dump -U "$POSTGRES_USER" "$POSTGRES_DB"' > backup-$(date +%F).sql

Run it in the Askmark folder, every day (for example from cron), and keep copies off the server. It reads the database user and name from the postgres container; -T keeps a terminal out of the dump. Every chat, lead, booking and piece of knowledge your customers have lives in this database. With a managed database, use its own backups as well.

Also keep a copy of .env (above all APP_SECRET, without which the saved AI keys, gateway secrets and calendar tokens cannot be read) and of your files: the minio-data Docker volume, your own bucket, or the app-storage volume. Restore a database backup into an empty database with the pgvector image: docker compose exec -T postgres sh -c 'psql -U "$POSTGRES_USER" "$POSTGRES_DB"' < backup.sql.

Update

Upgrade in the same folder

Docker names the stack, and with it the database volume, after the folder unless COMPOSE_PROJECT_NAME is set. If you move or rename the folder, set COMPOSE_PROJECT_NAME to the old folder name first, or the app starts with an empty database. Your data isn't lost; it's under the old name (docker volume ls shows it before _postgres-data).

  1. Back up as above.
  2. From the folder that holds askmark/ (not inside it), run unzip -o askmark-x.y.z.zip with the new version's file name. The zip has a top-level askmark/ folder, so it unpacks over your install. Your .env, compose.override.yaml and prebuilt/ are kept, because the zip doesn't contain them.
  3. Compare your .env with the new .env.example: this lists the keys your .env doesn't have yet:
    cd askmark
    for k in $(grep -oE '^#? ?[A-Z][A-Z0-9_]*=' .env.example | tr -d '# ='); do grep -q "^$k=" .env || echo "$k"; done
    Copy the ones you need, with their comments, into .env; a key you leave out keeps its default.
  4. In the askmark folder, run docker compose up -d --build (with --profile https on your server). The new version applies any new migrations when it starts; your data stays. Websites keep their snippet: /widget.js serves the new widget, and visitors' browsers pick it up within a day.
  5. If disk is tight, run docker builder prune afterwards to free the build cache.

If you changed the code, compare your changes with the new version first. CHANGELOG.md lists what changed and marks security fixes. New list prices in an update show up for models you have not edited yourself.

Exports

Each workspace can download all its data at any time (chapter 14), so a customer who leaves takes their chats, leads and knowledge with them. For the whole platform, the database backup above is the export.

27Security notes

What the server checks and limits, so you can answer your customers' questions and know what to keep safe.

Workspaces are kept apart

  • The current workspace always comes from the signed-in session (or the API key), never from the request. Every query is filtered by it, knowledge search included, so a chat never reads another workspace's knowledge. Another workspace's id answers "not found".
  • Roles are checked by the server on every request; the screens only hide what a role cannot use.
  • The widget's requests carry the visitor's own token and are checked against the assistant's allowed websites before anything is read or written; a visitor sees only their own chats.

Accounts and sessions

  • Passwords (at least 10 characters) are hashed with Argon2id. A password change or reset signs the person out on every other device.
  • The session cookie (am_session) is HttpOnly, Secure and SameSite=Lax (on the public demo only, cross-site, so the marketplace's preview frame can sign in); it lasts 30 days and is renewed while in use, or only until the browser closes when "keep me signed in" is off.
  • Every change made with the session cookie must carry the header x-askmark: 1, which browsers cannot add from another site, so other sites cannot make changes for a signed-in person.
  • Session tokens, password reset links, invitations, API keys and visitor tokens are stored only as hashes.
  • AI provider keys, gateway and SMTP secrets, calendar tokens and webhook secrets are sealed with AES-256-GCM, with a key derived from APP_SECRET. Keep APP_SECRET and your backups safe, and never change it after the install.
  • "Open as owner" sessions last 30 minutes, never renew, are audit-logged and cannot reveal secrets or reach the platform admin.

Outgoing calls

  • Crawled websites, webhook addresses and OpenAI-compatible endpoints are typed by your customers, so every such call goes only to public addresses: never to a private, local, link-local or cloud-metadata address. The check runs after the name is resolved, and the connection is pinned to the checked address, so a name that changes its answer cannot reach your inside network. ALLOW_PRIVATE_FETCH=true lifts this; keep it off.
  • Crawled pages are read with size and time limits (2 MB and 10 seconds a page); webhooks wait at most 10 seconds.
  • AI provider keys never appear in logs or error messages. Every AI call is made by your server, never by a visitor's browser.
  • The knowledge and the visitor's words are sent to the model as quoted data after the rules, and every reply is checked before it is shown (chapter 9), so a page or a visitor cannot make the assistant follow new instructions or link to a site outside the knowledge.

Rate limits

These limits are kept in PostgreSQL or per visitor, so they hold across restarts. They are keyed by a keyed hash of the account, the visitor token or the visitor address (taken only from trusted proxies, chapter 24), never by a plain address:

LimitAllowedWhat it protects
Booking page views, per link120 per hourReads of one booking page an hour
Booking page changes, per link10 per hourChanges from one booking page an hour
Transcript emails from the inbox, per chat5 per hourTranscript emails from the inbox per chat an hour
Data exports, per workspace10 per hourExports a workspace may make in an hour (each one reads every chat it holds)
Sign-in, per address20 per 15 minutesSign-in attempts from one address
Sign-in, per account5 per 15 minutesWrong passwords for one account; after five the account waits, even for the right password
Sign-up, per address5 per hourNew accounts from one address
Password reset, per address5 per hourPassword reset emails asked for from one address
Password reset, per account3 per hourPassword reset emails sent to one account
Reset and invite links, per address20 per hourTries at a reset or invite link from one address
Demo sign-in, per address60 per hourPublic demo sign-ins from one address
Invites, per workspace50 per hourInvites sent by one workspace
Widget messages, per visitor20 per minuteMessages one visitor may send a minute
Widget messages, per assistant (all its visitors)600 per minuteMessages one assistant takes a minute (all visitors together)
New chats, per visitor20 per hourNew chats one visitor may start an hour
Transcript emails, per chat3 per hourTranscripts one chat may email an hour
Lead, contact and booking forms, per visitor10 per hourForms (lead, contact, booking) one visitor may send an hour

Every other API call takes from short-term allowances in memory: each signed-in person may make 240 calls at once and then 20 a second, and all calls from one visitor address together (counted only behind a trusted proxy) 1,200 at once and then 60 a second. A REST API key may make 120 calls at once and then 4 a second. The payment webhooks are never limited. A refused call answers 429 with a Retry-After header.

Money

  • Plans switch on only from verified gateway events; a workspace cannot give itself a plan. Plan limits and the reply meter are checked on the server and spent inside locked database steps, so parallel requests cannot go past them.
  • DEMO_PAYMENTS and DEMO_MODE are "false" in the shipped file; a fresh install never grants a plan without payment.
  • Payment and subscription records are never deleted with a workspace or a plan.
  • The demo seed and reset commands touch only rows marked as demo and refuse to run on a database with real data (chapter 23).

What loads from other servers

The web app loads nothing from other servers: its fonts and icons are part of the build, and its pages send a Content-Security-Policy that allows scripts from your own address only. The widget loads only from your platform's address. Checkout and the billing portal open on the gateway's own pages, and a Google Calendar connection on Google's sign-in page.

Keep it safe

  • Use https (chapter 24), long unique passwords and two-factor sign-in on your server, gateway, email and AI provider accounts.
  • Set a monthly spending limit with each AI provider, as a second stop behind the plans' replies.
  • Keep .env and your backups private; anyone with APP_SECRET and a backup can read the saved keys.
  • Install Askmark updates; security fixes are marked as such in the changelog.
Part 06

For developers

28Architecture and money flow

Askmark is one compiled Rust program, askmark, next to PostgreSQL (with pgvector) and a file store. The program serves the web app, the widget's script, the API, the payment webhooks and the live streams, and runs the background jobs. There is no Redis, no separate worker and no Node.js server to run.

Askmark architecture: browsers, the askmark program, its database and storage, and the outside services Visitors on a website widget.js in a Shadow DOM Your customers' teams the web app: inbox, knowledge… You, the platform admin plans, gateways, AI keys Developers' systems REST API, webhooks, MCP askmark: one Rust program (Axum) Web app files and /widget.js /api/v1: sessions, roles, API keys, plan limits Widget API: visitor token, allowed websites Answer engine: search, prompt, stream, check Crawler and file readers (PDF, Word, text) Billing: checkout and signed gateway webhooks Job workers and the scheduler Live events (SSE) for the inbox and widget PostgreSQL + pgvector data, knowledge chunks, jobs, live events (LISTEN/NOTIFY) MinIO or an S3 bucket files, pictures, exports AI providers OpenAI · Anthropic · Gemini · OpenRouter Payment gateways Stripe · PayPal · Razorpay · Paystack Email, calendars, the web SMTP · Google Calendar · Cal.com · crawled sites · webhook receivers
  • The web app (React Router 7 in single-page mode, built with Vite) is attached to the program when it is built, so the program is the one file to ship. Public pages (landing, pricing, legal) are pre-rendered.
  • The widget is plain TypeScript built into one file and served at /widget.js. It talks only to /api/v1/widget/… with its visitor token, and receives replies as a stream (Server-Sent Events).
  • PostgreSQL holds everything, the job queue and the knowledge's embeddings included; LISTEN/NOTIFY carries live events and settings changes to every copy of the server.
  • The engines (crates/engines) hold the AI provider clients behind one interface, the text tools (web pages, PDF, Word, Markdown, chunks, language, robots.txt, sitemaps) and the price table.

Money flow: paying for a plan

Paying for a plan: checkout, the gateway, the signed webhook, the plan Owner's browser Askmark PostgreSQL Payment gateway Choose a plan Create a checkout The gateway's own payment page; the owner pays there Signed webhook (event id) One transaction: store the event id, switch the plan 200 OK (the same event again is ignored) Apply failed: nothing stored, error, the gateway sends it again Live update: the plan is active

A plan switches on only from the gateway's signed webhook, never from the browser coming back from checkout. The event's id is stored in the same transaction as its effect, so every delivery is applied exactly once, and every apply step is safe to run twice.

Money flow: one reply, one credit

One reply, one message credit: claimed before the model is called, given back when the call fails Visitor (widget) Askmark PostgreSQL AI provider Question (with its clientId) Search the knowledge (full-text + pgvector) Claim 1 credit (locked; once per clientId) Rules, sources and the question The words stream back Checked reply with its sources, word by word Failed or over 60 s: give the credit back "The assistant could not answer just now"

The credit is claimed before the AI provider is called, inside a locked database step that also counts the month, so replies that start at the same moment cannot pass the plan's limit, and a message the widget sends twice (same clientId) is never counted twice. When the call fails, the credit is given back once. "I don't know" and "not set up yet" replies call no model and claim nothing.

29REST API, webhooks and MCP

On plans with API keys, webhooks and MCP, a workspace's systems can read and change its data, hear about events as they happen, and let AI apps work with it. Owners and admins set it up in Developers.

The REST API

  1. Developers → API keys → Create key, with a name, a note and its scopes: read (lists and reads) or write (also creates and changes: leads, Q&A, replies as an agent). The key (am_live_…) is shown once; afterwards only its prefix is listed, with when it was last used. Revoke stops it at once.
  2. Send it as a Bearer token, without a cookie:
    curl "https://chat.yourbrand.com/api/v1/leads?status=new" \
      -H "Authorization: Bearer am_live_…"
  • A key may call the documented routes of its own workspace under /assistants, /sources, /documents, /qa, /knowledge/test, /chats, /leads, /bookings, /calendars and /analytics (chapter 33 lists every route). It acts as the member who made it, never with more than their current role and at most as an admin; a read-only key acts as a viewer. A key whose maker left the workspace stops working.
  • A workspace whose plan has no API access gets 402 plan_limit; a key may make 120 calls at once and then 4 a second (429 with Retry-After above that).
  • Writes are the same as the web app's: POST /api/v1/qa with {"question": "…", "answer": "…"} adds a Q&A pair, POST /api/v1/chats/{id}/reply with {"body": "…", "clientId": "…", "takeOver": true} answers a visitor as the key's member.

Webhooks

Developers → Webhooks → Add endpoint with an https address and the events it wants (none picked = all). Askmark then sends a signed POST for each event:

EventWhen
chat.startedA visitor starts a chat.
chat.waitingA visitor asks for a person.
chat.closedA chat is closed.
lead.createdA visitor leaves their details, or the team adds a lead.
booking.createdA time is booked.
booking.cancelledA booking is cancelled.

The body is JSON: {"id": "…", "event": "lead.created", "createdAt": "…", "data": {…}}, where data is the chat, lead or booking as the API shows it. The headers Askmark-Event and Askmark-Delivery name the event and the delivery, and Askmark-Signature: t=<unix time>,v1=<hex> signs it: v1 is the HMAC-SHA256 of t, a dot and the raw body, keyed with the workspace's signing secret (Developers → Webhooks → Secret, it starts with whsec_). Check it before you trust a delivery, and refuse one whose time is more than 5 minutes off.

Verify a delivery in Node.js

import crypto from "node:crypto";

// rawBody: the request body exactly as received (a Buffer), before any JSON parsing.
export function verifyAskmark(secret, header, rawBody, toleranceSeconds = 300) {
  const parts = Object.fromEntries(header.split(",").map((p) => p.trim().split("=")));
  const t = Number(parts.t);
  if (!t || Math.abs(Date.now() / 1000 - t) > toleranceSeconds) return false;
  const expected = crypto.createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest("hex");
  const given = Buffer.from(parts.v1 ?? "", "hex");
  const wanted = Buffer.from(expected, "hex");
  return given.length === wanted.length && crypto.timingSafeEqual(given, wanted);
}

Verify a delivery in PHP

<?php
function verify_askmark(string $secret, string $header, string $rawBody, int $tolerance = 300): bool {
    $parts = [];
    foreach (explode(',', $header) as $part) {
        [$k, $v] = array_pad(explode('=', trim($part), 2), 2, '');
        $parts[$k] = $v;
    }
    $t = (int) ($parts['t'] ?? 0);
    if ($t === 0 || abs(time() - $t) > $tolerance) return false;
    $expected = hash_hmac('sha256', $t . '.' . $rawBody, $secret);
    return hash_equals($expected, $parts['v1'] ?? '');
}

$ok = verify_askmark(getenv('ASKMARK_WEBHOOK_SECRET'), $_SERVER['HTTP_ASKMARK_SIGNATURE'] ?? '', file_get_contents('php://input'));

Retries and missed deliveries

  • Answer with any 2xx within 10 seconds. Anything else is tried again after 1 minute, 5 minutes, 30 minutes, 2 hours, 6 hours and 24 hours; then the delivery is marked failed.
  • An endpoint that has failed for 24 hours without one success is turned off, and the workspace's admins get one email.
  • Every delivery is listed with its tries and the answer it got. Send again sends one delivery again; Resend failed sends every failed delivery of an endpoint again. A delivery sent again keeps its event id, so your receiver can drop one it has already handled.
  • After a long outage, read what you missed from the REST API (GET /api/v1/leads, /chats, /bookings) and compare by id.
  • Test sends a signed test event at once and shows the answer. Rotate secret makes a new signing secret for every endpoint of the workspace.

The MCP server

Askmark is also an MCP server, so Claude, ChatGPT and other AI apps can read and act on a workspace in plain words ("Which questions couldn't Sunny answer this week?"). It answers at your APP_URL plus /mcp over Streamable HTTP (one JSON-RPC 2.0 message per POST, answered as JSON; MCP protocol versions 2025-06-18, 2025-03-26 and 2024-11-05) and signs in with the same API keys. Each tool calls the REST route it stands for with the same key, so the key's workspace, role, scopes and plan limits are exactly the REST API's; a tool that changes something needs a write key. Developers → MCP shows the address, each tool with the scope it needs, a button to create a key for it, and the latest calls.

  • Claude Desktop: Settings → Developer → Edit config, add the server, then restart Claude:
    {
      "mcpServers": {
        "askmark-sunmere": {
          "url": "https://chat.yourbrand.com/mcp",
          "headers": { "Authorization": "Bearer am_live_…" }
        }
      }
    }
  • ChatGPT: Settings → Connectors → add a custom connector with the address and the Authorization header.
  • Other apps: any MCP client that speaks Streamable HTTP; a raw request is POST /mcp with {"jsonrpc":"2.0","id":1,"method":"tools/list"}.
ToolWhat it does
search_knowledgeSearches the knowledge (pages, files, Q&A) the way the assistant does, and gives the best passages with their sources.
list_chats, get_chatChats, newest first, with their state and visitor; one chat with its messages (team notes included) and the visitor's lead and bookings.
reply_to_chatReplies to a chat as a person, taking over a chat nobody has yet; the assistant then pauses. Needs a write key.
list_leads, update_leadLeads, newest first, with status and owner; changes a lead's status or owner (write).
list_bookingsBookings from a date for a number of days.
add_qaAdds a question and answer to the knowledge, counted toward the plan's pages (write).
get_analyticsChats, resolution, handovers, leads, bookings, ratings and top questions for the last 7, 30 or 90 days.

The widget's API

The widget's own routes (/api/v1/widget/… in chapter 33) are public by design: they need no session, only the visitor token the widget makes (X-Visitor-Token), and each one checks the page's site against the assistant's allowed websites. A message is answered as a Server-Sent Events stream: the stored visitor message, the reply's words, then the stored reply (or the chat's new state when a person has it). Use them only to build your own chat window; for anything else use the REST API.

Import formats

WhatFormat
WebsitesHTML pages, found through robots.txt sitemaps or /sitemap.xml (sitemap indexes and .xml.gz files followed) and links. The main text is kept; menus, footers and scripts are dropped.
FilesPDF (its text layer), Word .docx, plain text .txt and Markdown .md, up to 20 MB each, through the screen or POST /api/v1/sources/{id}/files (multipart).
Q&A pairsOne at a time on the screen or with POST /api/v1/qa, or many at once with Import CSV (chapter 8): UTF-8, columns question,answer and an optional source_url, an optional header row, commas (or semicolons), up to 2,000 rows and 2 MB. A question already there gets the new answer.
LeadsOut as CSV from Leads; the whole workspace out as JSON or CSV (chapter 14).

30Every key, explained

Every setting in .env. The outside-service keys can also be set in the platform admin, which takes precedence. This table is generated from .env.example and the server's own settings code when the release is built.

KeyRequiredWhat it does
Required
APP_URLYesThe public address of the app, without a trailing slash, for example https://help.example.com. The widget snippet, the links in emails, the payment webhook addresses, the Google Calendar sign-in return address and secure cookies all come from it. Use https on a public server.
APP_SECRETYesA long random string of at least 32 characters (openssl rand -hex 32). It seals the AI provider keys, calendar tokens, webhook secrets and the other secrets you save, signs export links, and keys the hashed visitor tokens and addresses. Never change it after the install: saved keys could no longer be read.
POSTGRES_DBNoThe name of the database the stack creates. Default askmark.
POSTGRES_USERNoThe database user the stack creates. Default askmark.
POSTGRES_PASSWORDYesThe database password. Letters and digits only, because it goes into a connection address. Docker refuses to start without it.
DATABASE_URLOutside DockerThe database address, only when you run the server without Docker or use a managed database, for example postgres://askmark:password@db.example.com:5432/askmark?sslmode=require. The database needs the vector (pgvector) and btree_gist extensions (chapter 25). With Docker, the stack uses it when it is set. Leave it empty with the bundled database: the stack builds its own from the three keys above.
INSTALL_TOKENNoThe token the install wizard asks for. Empty: a new one is printed in the app's log at every start until the install is finished (docker compose logs app | grep -i "install token").
File storage (uploads, workspace pictures, white label logos, the brand logo)
STORAGE_DRIVERNos3 (the bundled MinIO, AWS S3, Cloudflare R2 or any S3-compatible store) or local (files in a Docker volume). Default in Docker s3.
S3_ENDPOINTWith s3The storage address. The bundled MinIO is http://minio:9000; for R2 use your account's S3 address; for AWS S3 leave it empty.
S3_REGIONNoThe bucket's region. Default us-east-1; R2 uses auto.
S3_BUCKETNoThe bucket name. Default askmark; the stack creates it in MinIO.
S3_ACCESS_KEY_IDWith s3The storage access key. With the bundled MinIO this is also its admin user.
S3_SECRET_ACCESS_KEYYesThe storage secret, at least 8 characters. With the bundled MinIO this is also its admin password, so Docker refuses to start without it.
Payments (all optional; every gateway left empty = paid plans off)
STRIPE_SECRET_KEYFor StripeYour Stripe secret key (sk_live_…, or sk_test_… while testing), from Stripe → Developers → API keys (chapter 16).
STRIPE_WEBHOOK_SECRETFor StripeThe signing secret (whsec_…) of your Stripe webhook endpoint <APP_URL>/api/v1/webhooks/stripe. Without it, Stripe payments never switch a plan on (chapter 16).
STRIPE_PUBLISHABLE_KEYNoYour Stripe publishable key (pk_…). Shown next to the secret key in the platform settings, so you can see which Stripe account is in use.
PAYPAL_CLIENT_IDFor PayPalThe client id of your PayPal REST app, from developer.paypal.com → Apps and credentials (chapter 16).
PAYPAL_CLIENT_SECRETFor PayPalThe secret of the same PayPal REST app.
PAYPAL_WEBHOOK_IDFor PayPalThe id PayPal gives the webhook that points at <APP_URL>/api/v1/webhooks/paypal. Askmark asks PayPal to verify every event against it.
PAYPAL_MODEFor PayPalsandbox while you test with PayPal's sandbox accounts, live for real payments. Use the sandbox app's id and secret with sandbox.
RAZORPAY_KEY_IDFor RazorpayYour Razorpay key id (rzp_test_… or rzp_live_…), from the Razorpay Dashboard → Account and settings → API keys (chapter 16).
RAZORPAY_KEY_SECRETFor RazorpayThe key secret shown once with that key id.
RAZORPAY_WEBHOOK_SECRETFor RazorpayThe secret you type when you add the webhook <APP_URL>/api/v1/webhooks/razorpay in Razorpay. Every event is checked against it (X-Razorpay-Signature).
PAYSTACK_SECRET_KEYFor PaystackYour Paystack secret key (sk_test_… or sk_live_…), from the Paystack Dashboard → Settings → API keys and webhooks. It also checks every webhook to <APP_URL>/api/v1/webhooks/paystack (x-paystack-signature, chapter 16).
PAYSTACK_PUBLIC_KEYNoYour Paystack public key (pk_…), shown in the platform settings so you can see which Paystack account is in use.
DEMO_PAYMENTSNo"true" turns on a test checkout that changes plans without any payment. It is "false" in the shipped file: keep it that way on a live site (chapter 16).
Email (SMTP; empty = emails are written to the app's log)
SMTP_HOSTFor emailYour email provider's SMTP server. Empty: emails (password resets, invites, new-chat and waiting notices, replies to visitors who left, transcripts, lead and booking notices) are written to the app's log instead of being sent.
SMTP_PORTNoThe SMTP port. Default 587.
SMTP_USERNAMEFor emailThe SMTP user name.
SMTP_PASSWORDFor emailThe SMTP password or API key.
SMTP_SECURENostarttls (port 587, the default), tls (port 465) or none.
SMTP_FROMFor emailThe sender, for example Askmark <help@example.com>. Use an address on a domain your provider has verified.
AI providers (optional)
OPENAI_API_KEYNoThe platform's OpenAI key (sk-…, from platform.openai.com → API keys), for replies and embeddings. Used for every workspace without a key of its own, unless a key saved in the platform admin → AI providers takes its place (chapter 6). OpenAI bills you for every reply and every embedded page.
ANTHROPIC_API_KEYNoThe platform's Anthropic (Claude) key (sk-ant-…, from console.anthropic.com → API keys). Replies only: Anthropic has no embedding models, so pair it with an OpenAI, Gemini or OpenRouter key for embeddings (chapter 6).
GEMINI_API_KEYNoThe platform's Google Gemini key (AIza…, from Google AI Studio → Get API key), for replies and embeddings (chapter 6).
OPENROUTER_API_KEYNoThe platform's OpenRouter key (sk-or-…, from openrouter.ai → Keys), for replies and embeddings through OpenRouter's many models (chapter 6).
Calendars (optional)
GOOGLE_CLIENT_IDFor Google CalendarThe client id of your Google OAuth client, from Google Cloud Console → APIs and services → Credentials (chapter 12). It can also be saved in Platform admin → Setup check → Google Calendar sync, which takes precedence.
GOOGLE_CLIENT_SECRETFor Google CalendarThe client secret of the same Google OAuth client.
Network
APP_PORTNoThe port on this server where the app answers. Default 8080.
APP_BINDNoWhich address the port is open on. Default 127.0.0.1: this server only, so visitors come in through Caddy or your own proxy. Use 0.0.0.0 only with TRUSTED_PROXY_HOPS=0 or a firewall that lets only your proxy reach the port.
APP_DOMAINWith CaddyThe domain Caddy gets an HTTPS certificate for: the host of APP_URL, for example help.example.com.
TRUSTED_PROXY_HOPSNoHow many reverse proxies in front of the app add the visitor's address to X-Forwarded-For. 1 = the bundled Caddy (the default in Docker); 0 = trust no proxy. Never set it higher than the proxies really in front of the app (chapter 24).
ALLOW_PRIVATE_FETCHNo"true" lets crawled websites, outgoing webhooks, OpenAI-compatible endpoints and calendars reach private, local and cloud-metadata addresses. Only for a model server or website on your own network that you trust; keep "false" (chapter 27).
Advanced
COMPOSE_PROJECT_NAMENoOnly for a second copy on the same server (for example staging): give each copy its own name, so their containers, database, files, network, image and build cache stay apart. Empty = the name of the Askmark folder (chapter 24, Two copies on one server).
SEARCH_INDEXINGNoon (the default): search engines may index the public pages (landing, pricing, legal, sign-in), never the app or the API. off, for a staging copy: /robots.txt closes every page and every answer carries X-Robots-Tag: noindex, nofollow.
JOB_WORKERSNoBackground job workers in this server (crawls, embeddings, emails, webhook deliveries, housekeeping), 1 to 32. Default 4 (chapter 22).
DEMO_MODENoOnly for a public demo: "true" seeds the demo business and its one-click sign-ins, answers every visitor from stored sample answers (no paid AI call), sends no real email, locks risky actions and resets the data every night (chapter 23). It is "false" in the shipped file: never turn it on for a live site.
RUST_LOGNoHow much the server logs: info (the default), warn or debug.
STRIPE_API_URLNoFor tests only: another address for Stripe's API.
GOOGLE_API_URLNoFor tests only: one address for Google's sign-in, token and Calendar endpoints.
CALCOM_API_URLNoFor tests only, or a self-hosted Cal.com: another address for Cal.com's API.
PAYPAL_API_URLNoFor tests only: another address for PayPal's API (PAYPAL_MODE picks the sandbox or the live one).
RAZORPAY_API_URLNoFor tests only: another address for Razorpay's API.
PAYSTACK_API_URLNoFor tests only: another address for Paystack's API.
Set by Docker, or for development
ASSET_ARCHIVENoFor your own zero-downtime deploys: a folder that keeps older builds' files, so pages still open in a browser keep working.
BINDNoThe address the server listens on. Default 0.0.0.0: plus PORT.
BUILD_TARGETNoHow Docker gets the program: built (the default, built on this server) or prebuilt (uses prebuilt/askmark, built elsewhere; chapter 24).
DEMO_SITE_URLNoOnly with DEMO_MODE: the address of the demo business's website, which the demo knowledge links to and the demo widget may run on.
DRAIN_SECSNoFor your own zero-downtime deploys: seconds a stopping server keeps answering while the health check reports it is stopping. Default 0.
LOCAL_STORAGE_DIRSet by DockerThe folder for files with STORAGE_DRIVER=local (/app/storage in Docker, a volume).
PORTSet by DockerThe port the server listens on inside its container (8080).
READY_FILENoFor your own zero-downtime deploys: the health check passes only once this file exists.
WEB_DISTSet by DockerWhere the built web app is, when it is not packed into the program.

31File structure

askmark/
├── apps/
│   ├── backend/                 the Rust server (Axum): crate askmark-server, program "askmark"
│   │   ├── src/main.rs          the commands: serve, migrate, health, seed-demo, reset-demo, pack, export-assets
│   │   ├── src/lib.rs           the HTTP app: /api/health, /api/v1, /widget.js, the web app, middleware
│   │   ├── src/api/             one module per area: auth, workspace, assistants, knowledge, chats, leads,
│   │   │                        calendars, bookings, analytics, developers, widget, billing, providers, admin…
│   │   ├── src/answer/          the answer engine: prompt, the reply check, what to offer after a reply
│   │   ├── src/retrieval/       knowledge search (full-text + pgvector, reciprocal-rank fusion)
│   │   ├── src/crawler/         reading websites (sitemaps, robots.txt, the outgoing-call guard)
│   │   ├── src/knowledge/       sources, documents, chunks, file reading and the embedding job
│   │   ├── src/chats/           chats, messages and the handover state machine
│   │   ├── src/widget/          the widget's shared checks and /widget.js
│   │   ├── src/limits.rs        plan limits and the message credits
│   │   ├── src/billing.rs       checkout, portal, trials and signed gateway webhooks
│   │   ├── src/gateways/        Stripe, PayPal, Razorpay and Paystack behind one interface
│   │   ├── src/calendars.rs     Google Calendar and Cal.com
│   │   ├── src/booking_mail.rs  the booking emails to visitors and the team
│   │   ├── src/mcp.rs           the MCP server at /mcp
│   │   ├── src/webhooks.rs      outgoing webhooks, signing and retries
│   │   ├── src/jobs.rs          the background job queue (PostgreSQL, FOR UPDATE SKIP LOCKED)
│   │   ├── src/settings.rs      platform settings over .env, and the saved price table
│   │   ├── src/setup_check.rs   the setup check rows and live tests
│   │   ├── src/demo.rs, demo/   the sample plans and the public demo
│   │   ├── tests/               server tests (need a PostgreSQL with pgvector)
│   │   └── README.md            every module of the server, for developers
│   ├── frontend/                the web app (React Router 7, Vite, Tailwind CSS 4)
│   │   ├── src/routes.ts        every page: URL → file (src/routes/ lists each area)
│   │   ├── src/pages/           workspace/, platform/, auth/, install/, public/ (with the booking page)
│   │   ├── src/ui/              buttons, tables, sheets, charts, toasts shared by the pages
│   │   ├── src/i18n/            the interface languages
│   │   ├── src/api/             the API client and types
│   │   ├── src/styles.css       colours, fonts and sizes (design tokens)
│   │   └── e2e/                 browser tests (Playwright)
│   └── widget/                  the website widget (plain TypeScript, Shadow DOM)
│       ├── src/main.ts          the script tag, window.Askmark and start-up
│       ├── src/widget.ts        the chat window; src/ui/ its parts (messages, forms, booking)
│       ├── src/i18n.ts          the widget's words in six languages
│       ├── test/, e2e/          unit tests (Vitest) and browser tests (Playwright)
│       └── build.mjs            builds dist/widget.js
├── crates/engines/              AI provider clients, text tools, the price table, the demo's stand-in
├── migrations/                  the database schema (applied on start)
├── docker/                      Dockerfile, docker-compose.yml, Caddyfile
├── compose.yaml                 "docker compose up" from this folder
├── Cargo.toml, Cargo.lock       the Rust workspace
├── rustfmt.toml, clippy.toml    Rust formatting (lines up to 120 characters) and lint settings
├── .env.example                 every setting
└── docs/                        this guide (HTML and PDF) and the third-party licences

32Customise the code

Run it for development

  1. Start a PostgreSQL with pgvector (for example docker compose up -d postgres with ports: ["127.0.0.1:5432:5432"] added to the postgres service in a compose.override.yaml) and set DATABASE_URL in .env. For development set STORAGE_DRIVER=local.
  2. Start the server from apps/backend: cargo run -- serve (it reads .env from the folder or the ones above it and listens on port 8080).
  3. Start the web app from apps/frontend: pnpm install, then pnpm dev, and open http://localhost:5173. Calls to /api go to the server on port 8080. Screens reload as you save.
  4. Work on the widget from apps/widget: pnpm install, then pnpm dev builds it and serves a test page with a stand-in API; pnpm build writes dist/widget.js, which the server serves at /widget.js while you develop.

Theme tokens

  • Colours, fonts and sizes live in apps/frontend/src/styles.css as CSS variables, one block for light and one for dark ([data-theme="dark"]): surfaces (--bg, --surface, --surface-2, --line), text (--text, --text-2, --text-3), the brand (--brand, --brand-ink, --brand-soft, --on-brand), the visitor's message colour (--visitor), status colours (--up, --down, --warn, --blue) and the sidebar (--sidebar…).
  • The main colour set in Email and brand, and a workspace's white label colour, replace --brand at run time, so most rebrands need no code. The widget takes its colour from each assistant's Look tab.
  • Fonts: Gabarito for headings, Geist for text, Geist Mono for numbers and code, Noto Sans Arabic for Arabic, all bundled with the app.
  • Pages are in apps/frontend/src/pages/, one folder per area; src/routes.ts maps each URL to its file. The public landing and pricing pages are in src/pages/public/.

Change the server

  • Each area of the API is one module in apps/backend/src/api/; its routes() function lists the addresses. apps/backend/README.md lists every module.
  • How replies are written is in apps/backend/src/answer/ (prompt.rs for the instructions, check.rs for the reply check) and how knowledge is found in src/retrieval/; the chunk size is in crates/engines/src/text/chunk.rs.
  • A database change is a new file in migrations/ named YYYYMMDDHHMMSS_what.sql. Never edit a migration that has already run: the server checks them.

Tests, per suite

SuiteCommandWhat it covers
ServerTEST_DATABASE_URL=postgres://user:password@127.0.0.1:5432/postgres cargo test -p askmark-serverThe whole app in process against a real PostgreSQL with pgvector, one fresh database per test: sign-in, workspaces kept apart, knowledge and crawling (robots.txt, caps, the outgoing-call guard), answers and prompt injection, the take-over race, credits counted once, plan limits, billing, bookings (two visitors, one time), widget CORS, analytics, purge. Without TEST_DATABASE_URL these tests say so and pass.
Enginescargo test -p askmark-enginesThe AI provider clients against recorded replies (offline), errors, prices, and the text tools.
Rust checkscargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings, cargo deny checkFormatting (the shipped rustfmt.toml, 120 characters a line); lints; advisories and licences of every crate.
Web appin apps/frontend: pnpm typecheck, pnpm lint, pnpm test, pnpm e2eTypes, Biome lint, Vitest unit tests (API client, language catalogues…), Playwright browser tests.
Widgetin apps/widget: pnpm typecheck, pnpm lint, pnpm test, pnpm e2eVitest unit tests (Markdown, colours, languages…) and Playwright tests of the whole widget against a stand-in API, including a host page with hostile styles, phones, keyboard and right to left.

Worked example: add a provider

Most AI services speak the OpenAI Chat Completions format: then you need no code at all, only an OpenAI-compatible key with the service's base URL and model (chapter 6). For a service with its own format, all the work is in crates/engines:

  1. Add the kind to ProviderKind in crates/engines/src/providers/mod.rs: the enum, ALL, as_str (the name stored in the database, for example "acme"), parse, label, needs_key and can_embed.
  2. Add its default models and API address to default_chat_model, default_embed_model and default_base_url in providers/models.rs, and its list prices to DEFAULT_ROWS in providers/pricing.rs.
  3. Write providers/acme.rs after the model of anthropic.rs: build the request, stream the reply's words through the shared HTTP and SSE helpers (which time the call and turn HTTP errors into ProviderError), report the token counts, and add test_connection (and the embedding call, if it has one, giving 1,536 numbers).
  4. Send the new kind to it in chat_provider, embed_provider and test_connection in mod.rs.
  5. Add a recorded success reply and a few error replies with a test next to the others in crates/engines/tests/, and run cargo test -p askmark-engines.
  6. On the web app, add the provider's name where the others are listed in the AI settings.

The server reads provider kinds from the engine and stores the new name in provider_keys.provider. If the provider needs a platform key in .env, add it to apps/backend/src/config.rs and env_key in apps/backend/src/ai_keys.rs.

Rebuild and deploy your changes

docker compose up -d --build                    # or with --profile https on your server

Docker rebuilds only what changed; a change to the web app or the widget alone reuses the compiled server. Keep your changes in a Git repository, so you can compare them with each new Askmark version.

33API reference

The web app uses the same /api/v1 API. These 222 addresses are generated from the server code when the release is built.

  • JSON in and out with camelCase keys; times in ISO 8601 UTC; money in whole cents (…Cents) or millionths of a dollar (…Micros); rates from 0 to 1.
  • Errors: {"error": {"code": "…", "message": "…", "details": {…}}}. A plan limit answers 402 plan_limit with the limit it hit (for example messagesMonth, pages, assistants, seats, storageMb, or a feature such as apiAccess). A time someone else just booked answers 409 slot_taken with that day's free times in details.slots.
  • Changes made with the session cookie need the header x-askmark: 1; calls with an API key do not.
  • "Any member" means any member of the current workspace, viewers included; "Agent and up" an agent, admin or owner; "Platform admin (the read-only login reads)" lets the read-only platform login read too.
  • Live events: GET /api/v1/events is a Server-Sent Events stream for the current workspace (new chats and messages, chat states, typing, leads, crawl progress).
MethodAddressWho may call itWhat it does
System and the widget script
GET/api/healthAnyoneThe health check: 200 while the server is serving, 503 while a stopping copy hands over to a new one or the database still needs its extensions
GET/api/app-versionAnyoneThe running version: open pages compare it with their own and offer a reload after an update
GET/robots.txtAnyoneTells search engines which pages they may index: the public pages, or none with SEARCH_INDEXING=off
GET/widget.jsAnyone (the widget script)The chat widget script that websites load with one script tag; it reads the assistant's settings from the widget routes below
Public pages, install, the booking page and payment webhooks
GET/api/v1/public/configAnyoneThe brand, sign-up mode, demo sign-ins and what the web app needs before sign-in
GET/api/v1/public/plansAnyoneThe public plans for the pricing page
GET/api/v1/public/legal/{slug}AnyoneOne legal page, body empty when the platform has not written its own text (404 for a page that does not exist)
GET/api/v1/install/statusAnyone, until the install is done (install token)Whether the install wizard has run
POST/api/v1/install/databaseAnyone, until the install is done (install token)The wizard's database step: adds the extensions Askmark needs (pgvector and btree_gist) when they are missing
POST/api/v1/install/checkAnyone, until the install is done (install token)Checks the install token and the setup before the wizard's last step
POST/api/v1/install/completeAnyone, until the install is done (install token)Finishes the install: the super-admin, brand and sample plans (runs once)
POST/api/v1/webhooks/stripeStripe (signed webhook)A Stripe webhook event (signature checked, applied once)
GET/api/v1/public/bookings/{token}Anyone{ booking, business: { name, logoUrl, color }, brand, calendarName, canChange }
GET/api/v1/public/bookings/{token}/slotsAnyoneThe free times of the booking's calendar, by the visitor's dates
POST/api/v1/public/bookings/{token}/rescheduleAnyoneMoves the booking to another free time (409 with the day's fresh slots in details.slots when it was just taken)
POST/api/v1/public/bookings/{token}/cancelAnyoneCancels the booking
POST/api/v1/webhooks/paypalPayPal (signed webhook)A gateway event, signature checked first (400 when forged), applied once
POST/api/v1/webhooks/razorpayRazorpay (signed webhook)A gateway event, signature checked first (400 when forged), applied once
POST/api/v1/webhooks/paystackPaystack (signed webhook)A gateway event, signature checked first (400 when forged), applied once
Sign-in and account
POST/api/v1/auth/registerAnyoneCreates an account and its first workspace (when sign-ups are open); country is kept with the workspace for the platform's lists
POST/api/v1/auth/loginAnyoneSigns in with email and password (wrong passwords count down, then the account waits)
POST/api/v1/auth/logoutSigned inSigns out of this browser
GET/api/v1/auth/meSigned inThe signed-in user, their workspaces, role and capabilities
GET/api/v1/auth/sessionAnyoneThe signed-in user like /auth/me, or nobody (no error) when the browser is not signed in
POST/api/v1/auth/switch-workspaceSigned inMakes another of the user's workspaces the current one
POST/api/v1/auth/workspacesSigned inCreates another workspace owned by the user
POST/api/v1/auth/forgotAnyoneEmails a password reset link when the email belongs to an account
POST/api/v1/auth/resetAnyoneSets a new password with a reset link and signs in (each link works once)
GET/api/v1/auth/reset/{token}AnyoneWhose link this is (404 when it expired or was used)
POST/api/v1/auth/impersonation/exitSigned inEnds an "open as owner" session and goes back to the super-admin's own
GET/api/v1/auth/invites/{token}AnyoneWhat an invitation link is for (workspace, role, email)
POST/api/v1/auth/invites/acceptAnyoneAccepts an invitation, signing in or creating the account
PATCH/api/v1/auth/profileSigned inChanges the user's name, email or picture
POST/api/v1/auth/passwordSigned inChanges the password (the current one is asked for); other sessions end
POST/api/v1/auth/demoAnyone, public demo onlyOne-click demo sign-in as the owner, the agent or the read-only platform admin (DEMO_MODE only)
Workspace, team, notices, files, export and live events
GET/api/v1/workspaceAny memberThe current workspace
PATCH/api/v1/workspaceAdmin or ownerChanges the workspace (white label needs the plan's feature; the phone is the business phone the widget shows)
DELETE/api/v1/workspaceOwnerCloses the workspace (owner only)
POST/api/v1/workspace/pictureAdmin or ownerThe workspace picture (multipart file: PNG, JPEG or WebP up to 1 MB)
DELETE/api/v1/workspace/pictureAdmin or ownerRemoves the workspace picture
POST/api/v1/workspace/white-label/logoAdmin or ownerThe white label logo (needs the plan's white label)
DELETE/api/v1/workspace/white-label/logoAdmin or ownerRemoves the white label logo
GET/api/v1/public/workspace-picture/{ws}/{file}AnyoneA workspace picture or white label logo, with no sign-in (the name holds the file's hash: the widget and emails show it), cached for a year
GET/api/v1/teamAny memberThe members and, for admins, the open invitations, with the seats used
POST/api/v1/team/invitesAdmin or ownerInvites someone by email as admin, agent or viewer
POST/api/v1/team/invites/{id}/resendAdmin or ownerSends an invitation again with a new link
DELETE/api/v1/team/invites/{id}Admin or ownerWithdraws an invitation
PATCH/api/v1/team/members/{id}Admin or ownerChanges a member's role (owners are changed only by an owner, and the last owner stays)
DELETE/api/v1/team/members/{id}Admin or ownerRemoves a member (never the last owner); their sessions leave the workspace
GET/api/v1/notifications/preferencesAny memberMy notice choices in this workspace
PUT/api/v1/notifications/preferencesAny memberSaves my choices (any part of { chats: { email, browser }, waiting, leads, billing })
POST/api/v1/workspace/exportAdmin or ownerExports everything the workspace holds as one JSON file or a zip of CSV files; the signed download link works for an hour
GET/api/v1/public/exports/{ws}/{file}Anyone with the signed link, for an hourThe export file, for an hour after it was made, to whoever holds the signed link (403 link_expired after that, 404 for a wrong signature)
GET/api/v1/eventsAny memberThe live stream (Server-Sent Events) for the current workspace: new chats, messages, state changes and typing, with a heartbeat
POST/api/v1/mediaAdmin or ownerUploads a file (multipart file: a picture, PDF, Word, CSV, Markdown or text file of at most 10 MB)
GET/api/v1/media/{id}Any memberA workspace file, to members of that workspace only
GET/api/v1/public/logo/{file}AnyoneThe uploaded brand logo (no sign-in; long cache, the name changes with the file)
GET/api/v1/shellAny member{ needsPerson, waiting, live, unread, messages }: chats waiting plus my chats whose visitor wrote last, chats waiting, visitors chatting in the last two minutes, unread notices, and this month's messages against the plan (max null = unlimited)
GET/api/v1/noticesAny member{ rows: Notice[], unread }
POST/api/v1/notices/readAny memberMarks notices read
Plan and billing
GET/api/v1/billingOwnerThe plan, subscription, usage, invoices and card on file
GET/api/v1/billing/plansOwnerThe plans a workspace can pick
POST/api/v1/billing/checkoutOwnerStarts a plan change (Stripe Checkout link, test checkout, or a switch to a free plan)
POST/api/v1/billing/portalOwnerA Stripe customer portal link (owner only)
POST/api/v1/billing/cancelOwnerCancels the paid plan at the end of the period (owner only)
AI provider keys and list prices
GET/api/v1/ai/statusAdmin or ownerThe workspace's AiStatus
POST/api/v1/ai/testAdmin or ownerCalls the key the workspace answers with now, then answers its AiStatus with ok and error (409 when no key is set up anywhere)
GET/api/v1/admin/aiSuper-admin (the read-only login reads)The platform's PlatformAi
POST/api/v1/admin/ai/testSuper-adminTests every platform key for real
GET/api/v1/provider-keysAdmin or ownerThe workspace's own keys, hints only
POST/api/v1/provider-keysAdmin or ownerAdds a workspace key (plans with own AI keys only: 402 plan_limit ownAiKeys otherwise; 409 key_exists for a second key of a provider)
PATCH/api/v1/provider-keys/{id}Admin or ownerChanges a workspace key
DELETE/api/v1/provider-keys/{id}Admin or ownerRemoves a workspace key
POST/api/v1/provider-keys/{id}/testAdmin or ownerTests a workspace key
GET/api/v1/admin/provider-keysSuper-admin (the read-only login reads)The platform's keys, which .env keys are set, and demo mode
POST/api/v1/admin/provider-keysSuper-adminAdds a platform key
PATCH/api/v1/admin/provider-keys/{id}Super-adminChanges a platform key
DELETE/api/v1/admin/provider-keys/{id}Super-adminRemoves a platform key
POST/api/v1/admin/provider-keys/{id}/testSuper-adminTests a platform key
GET/api/v1/provider-pricesAny memberThe list prices reply costs use
GET/api/v1/admin/provider-pricesSuper-admin (the read-only login reads)The same list for the platform settings
PUT/api/v1/provider-prices/{model}Super-adminChanges the prices of a model (or adds the model)
Assistants
GET/api/v1/assistantsAny memberThe workspace's assistants with their look, rules and widget key
POST/api/v1/assistantsAdmin or ownerA new assistant (402 plan_limit assistants when the plan is full)
GET/api/v1/assistants/{id}Any memberOne assistant, with the snippet that puts its widget on a site
PATCH/api/v1/assistants/{id}Admin or ownerChanges the fields sent
DELETE/api/v1/assistants/{id}Admin or ownerArchives it (its chats stay; its widget stops answering)
POST/api/v1/assistants/{id}/keyAdmin or ownerA new widget key (the old snippet stops working)
POST/api/v1/assistants/{id}/install-checkAdmin or ownerLoads the site's page and looks for the widget's key in it
POST/api/v1/assistants/{id}/avatarAdmin or ownerA JPEG, PNG or WebP picture of up to 2 MB, counted in the workspace's storage; the old picture goes
Knowledge: sources, documents, Q&A and the search test
GET/api/v1/sourcesAny memberEvery source with its counts, and the plan's page usage
POST/api/v1/sourcesAdmin or ownerA website (crawled at once), a file source or a Q&A source
GET/api/v1/sources/{id}Any memberOne knowledge source with its settings, schedule, status and crawl progress
PATCH/api/v1/sources/{id}Admin or ownerChanges a source's name, address, crawl settings or re-crawl schedule
DELETE/api/v1/sources/{id}Admin or ownerThe source, its documents, chunks and files
POST/api/v1/sources/{id}/crawlAdmin or ownerReads a website again (files and Q&A pairs are read again at once)
GET/api/v1/sources/{id}/documentsAny memberThe source's documents, newest first
POST/api/v1/sources/{id}/filesAdmin or ownerAdds a PDF, Word, text or Markdown file to a file source
GET/api/v1/documents/{id}Any memberA document and its chunks
DELETE/api/v1/documents/{id}Admin or ownerThe document, its chunks and its file
POST/api/v1/documents/{id}/reindexAdmin or ownerReads one page or file again and replaces its chunks
GET/api/v1/qaAny memberEvery Q&A pair of the workspace, with how often it was cited in the last 30 days and the name of who typed it in (null for imported and sample pairs)
POST/api/v1/qaAdmin or ownerA new Q&A pair (counts toward the plan's pages), marked as added by the signed-in member
PATCH/api/v1/qa/{id}Admin or ownerChanges a Q&A pair's question and answer
DELETE/api/v1/qa/{id}Admin or ownerThe document, its chunks and its file
POST/api/v1/knowledge/testAny memberThe chunks search finds for a question (what the assistant would read)
GET/api/v1/knowledgeAny memberKnowledgeSummary (numbers, sources, files, what needs a look, the crawl running)
GET/api/v1/knowledge/pagesAny memberThe website pages (problems first), { rows: PageDoc[], total, page, size, counts }
GET/api/v1/knowledge/sources/previewAdmin or ownerA look at a site before it is added: { sitemap, listed, robots } (the sitemap found, the pages it lists, and whether the site has a robots.txt)
POST/api/v1/knowledge/sources/{id}/pauseAdmin or ownerA running crawl stops after its current batch and the source waits (paused, no scheduled runs) until it is crawled again
POST/api/v1/knowledge/sources/{id}/stopAdmin or ownerA running crawl stops after its current batch, a queued one is dropped; the pages read so far stay
POST/api/v1/knowledge/documents/{id}/excludeAdmin or ownerLeaves a website page out: its chunks go, it stops counting toward the plan, and later crawls skip it
POST/api/v1/knowledge/filesAdmin or ownerA PDF, Word or text file read into the workspace's "Files" source
POST/api/v1/knowledge/qa/importAnyoneImports Q&A pairs from a CSV file (question, answer, optional source URL; up to 2,000 rows and 2 MB); a question already there gets the new answer
Inbox: chats, replies, notes and handover
GET/api/v1/chatsAny memberChats where the visitor wrote, newest first, filtered by state (open = every state but closed), agent and words; with the counts per state and the next page's cursor
GET/api/v1/chats/{id}Any memberThe chat row, every message (notes too) and the visitor's other chats, lead and bookings
POST/api/v1/chats/{id}/takeAgent and upThe chat is mine (bot or waiting → human); 409 when someone else took it first
POST/api/v1/chats/{id}/assignAgent and upGives the chat to a team member (agent or above), or to nobody
POST/api/v1/chats/{id}/replyAgent and upAn agent's message to the visitor
POST/api/v1/chats/{id}/noteAgent and upAn internal note (never shown to the visitor)
POST/api/v1/chats/{id}/releaseAgent and upHands the chat back to the assistant (human → bot)
POST/api/v1/chats/{id}/closeAgent and upEnds the chat (the widget then asks for a rating)
POST/api/v1/chats/{id}/reopenAgent and upOpens a closed chat again with the assistant (closed → bot)
POST/api/v1/chats/{id}/transcriptAgent and upEmails the chat's transcript to the visitor's email (400 when the chat has none; five an hour per chat)
POST/api/v1/chats/{id}/typingAgent and upShows "Freya is typing…" in the widget
Leads
GET/api/v1/leadsAny memberThe leads, newest first, with filters (status, owner, assistant, words) and paging
POST/api/v1/leadsAgent and upA lead added by the team (emailed and sent to the lead.created webhook like any other)
GET/api/v1/leads/exportAgent and upEvery matching lead as a CSV file (agents and up)
GET/api/v1/leads/{id}Any memberThe lead with its extra fields, the chat it came from, its booking, notes and history
PATCH/api/v1/leads/{id}Agent and upChanges a lead's status (new, contacted, won, lost) or owner
POST/api/v1/leads/{id}/notesAgent and upA team note (never shown to the visitor)
Calendars and bookings
GET/api/v1/bookingsAny memberThe bookings starting in those days (workspace time zone), the weekdays no calendar opens, the numbers and the calendars
POST/api/v1/bookingsAgent and upBooks a time for a visitor from the app (409 when it was just taken)
GET/api/v1/bookings/{id}Any memberOne booking
POST/api/v1/bookings/{id}/cancelAgent and upCancels a booking (and its event in a synced calendar)
POST/api/v1/bookings/{id}/rescheduleAgent and upMoves a booking to another free time (409 when the new time is not free)
GET/api/v1/calendarsAny memberThe workspace's calendars with their hours, rules and connection
POST/api/v1/calendarsAdmin or ownerA new calendar: name, kind, time zone, weekly hours, slot length, buffer, notice and days ahead
GET/api/v1/calendars/google/callbackAdmin or ownerGoogle sends the admin back here; the refresh token is sealed on the calendar the signed state names (only within the admin's current workspace)
GET/api/v1/calendars/{id}Any memberOne calendar
PATCH/api/v1/calendars/{id}Admin or ownerChanges a calendar's hours and booking rules
DELETE/api/v1/calendars/{id}Admin or ownerRemoves a calendar and its past bookings (409 while it has upcoming ones)
GET/api/v1/calendars/{id}/slotsAny memberThe calendar's free times by day, in its time zone
POST/api/v1/calendars/{id}/google/connectAdmin or ownerThe Google consent page to open
POST/api/v1/calendars/{id}/calcom/connectAdmin or ownerChecked by reading a day of slots first
POST/api/v1/calendars/{id}/disconnectAdmin or ownerDisconnects Google Calendar or Cal.com (the calendar keeps its own hours)
GET/api/v1/assistants/{id}/bookingAny memberThe assistant's booking setup: whether it books, on which calendar, and that calendar's rules
PATCH/api/v1/assistants/{id}/bookingAdmin or ownerThe rules go on the assistant's calendar; types rename and resize existing meeting types (by id) and add new ones (no id)
POST/api/v1/assistants/{id}/calendars/{provider}/{action}Admin or ownerGoogle connect answers { url }; Cal.com connect takes { apiKey, eventTypeId }; disconnect answers { ok }
GET/api/v1/admin/calendar-syncSuper-admin (the read-only login reads)Google's OAuth client as saved (the secret masked), the return address to give Google and how many calendars are connected
PUT/api/v1/admin/calendar-syncSuper-adminGoogle's OAuth client (the secret sealed; "" clears)
Analytics
GET/api/v1/analyticsAny memberEvery card of the page
GET/api/v1/analytics/cards/{card}Any memberOne card — chats (per day), resolution, handover, leads, bookings, ratings, first-answer, top-questions, unanswered, languages or hours
GET/api/v1/analytics/unansweredAny memberGroups of questions the assistant could not answer, most asked first (total counts the questions)
POST/api/v1/analytics/unanswered/{id}/answerAdmin or ownerAdds a Q&A pair for the group (the plan's pages limit holds: 402 and nothing saved when full) and takes every wording of the group off the list
GET/api/v1/analytics/ratingsAny memberRated chats, newest first
GET/api/v1/overviewAny memberLive chats, the period's numbers and chart, today, the top and unanswered questions, the latest leads and the setup steps
Developers: API keys, webhooks and MCP
POST/mcpAPI key (Bearer)The MCP server: one JSON-RPC 2.0 message per request (initialize, ping, tools/list, tools/call), answered as JSON; the key decides the workspace and read or write
GET/api/v1/api-keysAdmin or ownerThe workspace's API keys (prefix, scopes, last use; revoked keys last)
POST/api/v1/api-keysAdmin or ownerThe whole key is in secret, shown this once
POST/api/v1/api-keys/{id}/revokeAdmin or ownerThe key stops working at once
GET/api/v1/webhooksAdmin or ownerThe webhook endpoints, the signing secret's hint and the latest 100 deliveries
POST/api/v1/webhooksAdmin or ownerAdds a webhook endpoint with the events it wants
GET/api/v1/webhooks/secretAdmin or ownerThe signing secret in full (never on the demo or while impersonating)
POST/api/v1/webhooks/secret/rotateAdmin or ownerA new signing secret for every endpoint
POST/api/v1/webhooks/deliveries/resend-failedAdmin or ownerSends every failed delivery of the endpoint again (each once)
POST/api/v1/webhooks/deliveries/{id}/resendAdmin or owner"Send again" (a new delivery with the same payload)
PATCH/api/v1/webhooks/{id}Admin or ownerChanges an endpoint's address, events or on/off (turning it on again clears its failures)
DELETE/api/v1/webhooks/{id}Admin or ownerRemoves the endpoint and its deliveries
POST/api/v1/webhooks/{id}/testAdmin or ownerSends a signed test event now and shows the answer (no retries)
GET/api/v1/mcpAdmin or ownerThe Developers page's MCP card: the server's address, its tools with the scope each needs, and the latest calls
The website widget
GET/api/v1/widget/configThe website widget (visitor token, from the assistant's allowed sites)The assistant's look, behaviour and state for the widget
POST/api/v1/widget/chatsThe website widget (visitor token, from the assistant's allowed sites)The visitor's open chat on the assistant, or a new one
GET/api/v1/widget/chats/{id}The website widget (visitor token, from the assistant's allowed sites)The chat, its messages (internal notes never) and its latest confirmed booking
POST/api/v1/widget/chats/{id}/messagesThe website widget (visitor token, from the assistant's allowed sites)Sends the visitor's message and streams the reply (Server-Sent Events): the message, the sources read, the words as they come and the stored reply; or the chat's state when people answer; a repeated clientId never writes or pays twice
GET/api/v1/widget/chats/{id}/eventsThe website widget (visitor token, from the assistant's allowed sites)The chat's live stream for the widget: the current state, messages missed since Last-Event-ID, then agent and system messages, state and typing as they happen (notes never), with a heartbeat every 20 seconds
POST/api/v1/widget/chats/{id}/handoverThe website widget (visitor token, from the assistant's allowed sites)The visitor asks for a person (409 when visitors can't ask for one)
POST/api/v1/widget/chats/{id}/leadThe website widget (visitor token, from the assistant's allowed sites)The chat's lead (a second form updates it)
POST/api/v1/widget/chats/{id}/handover/cancelThe website widget (visitor token, from the assistant's allowed sites)The visitor stops waiting for a person (409 when one is answering or the chat is closed)
POST/api/v1/widget/chats/{id}/ratingThe website widget (visitor token, from the assistant's allowed sites)Thumbs on one reply or on the chat
POST/api/v1/widget/chats/{id}/transcriptThe website widget (visitor token, from the assistant's allowed sites)Emails the chat to the visitor (three an hour per chat)
POST/api/v1/widget/contactThe website widget (visitor token, from the assistant's allowed sites)The offline / out-of-replies form → a lead
GET/api/v1/widget/assistants/{id}/avatarThe website widget (visitor token, from the assistant's allowed sites)The assistant's picture (public, cached for an hour)
GET/api/v1/widget/chats/{id}/slotsThe website widget (visitor token, from the assistant's allowed sites)The free times, by the visitor's dates, with the calendar's name
POST/api/v1/widget/chats/{id}/bookingsThe website widget (visitor token, from the assistant's allowed sites)Books a free time (409 with the day's fresh slots when it was just taken)
POST/api/v1/widget/chats/{id}/bookings/{booking}/rescheduleThe website widget (visitor token, from the assistant's allowed sites)Moves the booking to another free time (409 with the day's fresh slots when it was just taken)
POST/api/v1/widget/chats/{id}/bookings/{booking}/cancelThe website widget (visitor token, from the assistant's allowed sites)Cancels the booking (status cancelled)
Super-admin
GET/api/v1/admin/overviewSuper-admin (the read-only login reads)The platform dashboard: revenue, workspaces, chats, assistant replies, message credits and AI cost this month and last, the database, what needs attention, and the subscription figures (workspaces by status, trials ending this week, the past-due value, the busiest workspaces)
GET/api/v1/admin/workspacesSuper-admin (the read-only login reads)The workspace list (search, status and plan filters, sorting, paging)
GET/api/v1/admin/workspaces/{id}Super-admin (the read-only login reads)One workspace
PATCH/api/v1/admin/workspaces/{id}Super-adminChanges a workspace's plan or status (suspending emails the owners)
DELETE/api/v1/admin/workspaces/{id}Super-adminCloses a workspace after cancelling its paid subscription; the data is purged 30 days later
POST/api/v1/admin/workspaces/{id}/impersonateSuper-admin"Open as owner": a 30-minute session as the workspace's owner
GET/api/v1/admin/usersSuper-admin (the read-only login reads)The people of every workspace with their platform role and workspaces, newest first (search, platform role, status)
PATCH/api/v1/admin/users/{id}Super-adminChanges a user's platform role or status (never your own role, never the last admin's)
GET/api/v1/admin/plansSuper-admin (the read-only login reads)Every plan, archived ones too
POST/api/v1/admin/plansSuper-adminAdds a plan
POST/api/v1/admin/plans/check-priceSuper-adminThe "Found in Stripe" badge: reads a price id from Stripe
PATCH/api/v1/admin/plans/{id}Super-adminChanges a plan (prices, Stripe ids, limits, features)
DELETE/api/v1/admin/plans/{id}Super-adminTakes a plan off sale; its subscribers keep it
POST/api/v1/admin/plans/{id}/restoreSuper-adminPuts an archived plan back on sale
GET/api/v1/admin/paymentsSuper-admin (the read-only login reads)Every payment (filters, paging)
GET/api/v1/admin/subscriptionsSuper-admin (the read-only login reads)Every subscription (filters, paging)
GET/api/v1/admin/settingsSuper-admin (the read-only login reads)The platform settings (secrets masked), server facts and storage stats
POST/api/v1/admin/settings/branding/logoSuper-adminThe brand logo (PNG, SVG or WebP up to 1 MB, checked by content), served publicly as the logo and favicon
PUT/api/v1/admin/settings/{section}Super-adminSaves one settings section (secrets are sealed; an empty secret keeps .env)
GET/api/v1/admin/emailsSuper-admin (the read-only login reads)The platform emails with their built-in and saved wording, for the email editor
GET/api/v1/admin/setup-checkSuper-admin (the read-only login reads)The setup check rows, with the last full live run (lastRun, ranAt)
POST/api/v1/admin/setup-check/{id}/testSuper-adminTests one setup check row against the real service
GET/api/v1/admin/jobsSuper-admin (the read-only login reads)Background jobs (status and kind filters) with counts per status
POST/api/v1/admin/jobs/{id}/retrySuper-adminQueues a failed job again
POST/api/v1/admin/demo-data/removeSuper-adminRemoves the demo data (demo-marked rows only)
GET/api/v1/admin/brandSuper-admin (the read-only login reads)The platform's brand (name, logo, colour, support email, public site, docs and support links), the mail server and the emails it sends
PUT/api/v1/admin/brandSuper-adminSaves the brand fields sent (and from, the SMTP sender); answers PlatformBrand
POST/api/v1/admin/brand/test-emailSuper-adminSends a test email to the signed-in admin (409 until SMTP is set up)
GET/api/v1/admin/legalSuper-admin (the read-only login reads){ pages: LegalPage[] } (an empty body shows the sample text on the public site)
PUT/api/v1/admin/legal/{slug}Super-adminSaves a legal page's own title and text (an empty title keeps the built-in one)
POST/api/v1/admin/workspacesSuper-adminA workspace for someone, on that plan (its free days start now)
POST/api/v1/admin/setup-check/runSuper-adminTests every testable setup check against the real service and keeps the result
GET/api/v1/admin/gatewaysSuper-admin (the read-only login reads)Every gateway with its keys (secrets masked) and the latest payments
PUT/api/v1/admin/gateways/{provider}Super-adminSaves a gateway's keys and turns it on or off (secrets are sealed; an empty secret clears it)
POST/api/v1/admin/gateways/{provider}/testSuper-adminTries the keys at the gateway

34Database

PostgreSQL with pgvector and btree_gist. The schema is in migrations/ and is applied by the server on start. Ids are UUIDs, times are UTC, money is in whole cents or micros. Every row of a workspace carries its workspace id, knowledge chunks included; payment and subscription rows are never deleted with their workspace. These 38 tables are generated from the migrations when the release is built.

TableWhat it holdsKeysPoints to
Accounts and sign-in
usersEvery person: platform staff and workspace members, with their platform role (none, admin, or the read-only viewer) and interface languageprimary key id; unique email (any case)–
sessionsSigned-in browsers (only a hash of the cookie is stored), including a super-admin's 30-minute "open as owner" sessionsprimary key id; unique token_hashusers, workspaces
password_resetsPassword reset links (hashed, valid for a limited time, used once)primary key id; unique token_hashusers
invitesOpen invitations to a workspace, with the role to join as (admin, agent or viewer)primary key id; unique token_hash; unique email (any case) per workspace, when accepted_at is nullworkspaces, users
rate_limitsFixed-window counters for sign-in, sign-up, reset, invite, export and widget limits (keys hold a keyed hash, never a plain address)primary key key–
Workspaces and teams
workspacesYour customers' businesses: plan, status, trial end, time zone, interface language, white label and the customer ids at each payment gatewayprimary key id; unique slug; unique stripe_customer_idplans, users
workspace_membersWho belongs to a workspace, with which role (owner, admin, agent or viewer) and their own notice choicesprimary key workspace_id + user_idworkspaces, users
audit_logWhat was done in a workspace and by whom (impersonation, deletes, settings changes)primary key idworkspaces, users
mediaUploaded files (knowledge files, avatars, logos); a workspace's storage use is the sum of its rowsprimary key id; unique storage_keyworkspaces
Plans, billing and the message meter
plansThe plans you sell: prices, trial days, the ids at each payment gateway, limits (replies a month, pages, assistants, seats, storage) and features (white label, own AI keys, bookings, calendar sync, API access)primary key id–
subscriptionsSubscriptions at Stripe, PayPal, Razorpay or Paystack; never deleted with a workspaceprimary key id; unique provider + provider_refworkspaces, plans
paymentsInvoices paid, failed or refunded, numbered AM-0001 and up; never deleted with a workspaceprimary key id; unique number; unique provider + provider_refworkspaces, plans
gateway_eventsPayment gateway events already applied (provider and event id), so a delivery a gateway sends again is never applied twiceprimary key provider + event_id–
usage_monthsThe message meter: replies counted per workspace and calendar month (UTC)primary key workspace_id + monthworkspaces
message_creditsOne row per claimed message credit, keyed by the visitor message: a retried request is never counted twice, and a refund gives the credit back onceprimary key workspace_id + idempotency_keyworkspaces
email_noticesPlatform emails sent once per workspace and period (out of replies, payment failed, …)primary key workspace_id + kind + periodworkspaces
Platform
platform_settingsSettings saved in the platform admin (they override .env); secret fields are sealedprimary key keyusers
jobsThe durable background job queue (crawls, embeddings, emails, webhook deliveries, housekeeping, the demo's visitors)primary key id; unique dedupe_key, when dedupe_key is not null and status in ('queued', 'running')workspaces
AI provider keys
provider_keysAI provider keys, sealed: a workspace's own, or the platform's for every workspace; with the chat and embedding models, base URL and the last test resultprimary key idworkspaces
Assistants and knowledge
assistantsA workspace's chat assistants: name, avatar, colour, greeting, suggested questions, tone, rules, languages, handover and lead rules, booking calendar, allowed sites and the public widget keyprimary key id; unique widget_keyworkspaces, media, calendars
sourcesWhere knowledge comes from (a website, uploaded files or the Q&A pairs), with the crawl settings, schedule, status and progressprimary key idworkspaces
documentsOne crawled page, uploaded file or Q&A pair, with its language, content hash and whether it was indexed, skipped or excludedprimary key id; unique source_id + url, when kind = 'page' and url is not nullworkspaces, media, sources, users
chunksThe pieces of each document that search reads: text, headings, full-text index and the embedding (pgvector), always with its workspaceprimary key idworkspaces, documents
unanswered_answersAnswers added from Analytics → Unanswered questions, so the question drops off the listprimary key workspace_id + keyworkspaces, documents
stored_answersDemo only: written answers for the suggested and top questions of the demo assistant, matched on the questionprimary key id; unique assistant_id + normalizedworkspaces, assistants
Visitors, chats and messages
visitorsWebsite visitors per workspace (only a keyed hash of the widget's visitor token), with the name and email they gaveprimary key id; unique token_hashworkspaces
chatsOne visitor conversation with one assistant: state (bot, waiting, human, closed), the person it is assigned to, the page, rating and countsprimary key idworkspaces, visitors, leads, users, assistants
messagesEvery line of a chat (visitor, assistant, agent, system or internal note), with the cited sources, the model, tokens, cost and the visitor's idempotency keyprimary key id; unique chat_id + client_id; unique seqworkspaces, users, chats
Leads, calendars and bookings
leadsContact details a visitor left (or the team added), with status, owner and the answers to the assistant's extra fieldsprimary key id; unique chat_id, when chat_id is not nullworkspaces, assistants, chats, users
lead_notesThe team's notes on a lead (never shown to the visitor)primary key idleads, workspaces, users
lead_eventsWhat happened to a lead and who did itprimary key idleads, workspaces, users
calendarsCalendars visitors book on: weekly hours, slot length, buffer, notice, days ahead, time zone, and the Google Calendar or Cal.com connection (its token sealed)primary key idworkspaces
bookingsBooked times; a database rule makes two confirmed bookings on one calendar never overlapprimary key idworkspaces, chats, leads, calendars, users
API keys, webhooks and MCP
api_keysWorkspace API keys for the REST API and MCP: name, prefix, scopes and use (only a hash of the key is stored)primary key id; unique hashworkspaces, users
webhooksOutgoing webhook endpoints: address, events and delivery healthprimary key idworkspaces
webhook_secretsThe workspace's webhook signing secret (sealed)primary key workspace_idworkspaces
webhook_deliveriesEvery webhook delivery with its payload, tries, answer and next tryprimary key idworkspaces, webhooks
mcp_callsThe latest MCP tool calls of a workspace, for the Developers pageprimary key idworkspaces, api_keys
Part 07

Help

35Troubleshooting

A website's crawl is blocked or reads nothing

Open Knowledge → Website pages: every page that was not read shows its reason, and Retry reads one again. "Blocked by robots.txt": the site closes those pages to robots; the business can allow AskmarkBot in its robots.txt or, for its own site, turn robots.txt off for that source. Pages that answer 403 or a challenge page come from a firewall or bot protection (Cloudflare and others): allow the user agent AskmarkBot/1.0 or your server's IP address there. "No text on the page": the page draws its text with JavaScript only, which the crawler does not run; upload the content as files or Q&A instead. A crawl that stops after 8 minutes carries on at the next crawl.

The assistant answers "I don't know" or shows no sources

Ask the same question in Knowledge → Test answers. When no chunk comes back, the knowledge does not hold the answer (add a page, file or Q&A pair) or the assistant's source list leaves it out. When chunks come back but the reply still says it does not know, the chunks do not really answer it: write a Q&A pair in the visitor's words. Without an embedding key, only full-text search runs, which needs the visitor's words to appear in the text (chapter 6). The unanswered questions in Analytics list what to add next.

The assistant says it is not set up yet

No AI key was found for the workspace: none in the platform admin, none in .env and, on plans with own keys, none in the workspace. Add one and press Test (chapter 6). When a key exists but replies fail, the inbox and the AI providers page show the provider's reason; the table in chapter 6, When a provider refuses, says what to do.

The widget does not show on a website

  • Open the install check in Widget and install: "Widget not seen yet" means the snippet never ran. Check that it is on the published page, before </body>, and clear any cache plugin or CDN cache.
  • Open the browser's developer console on the website. A 403 on /api/v1/widget/… means the site is not in the assistant's allowed websites: add it (with *. for subdomains).
  • "Refused to load the script" or "violates the following Content Security Policy" means the site's CSP must allow your platform's address (chapter 10).
  • A website on https cannot load the widget from an http platform: your APP_URL must be https.
  • A workspace that is read-only, suspended or out of replies still shows the button, with a contact form instead of answers.

Emails don't arrive

Without SMTP, emails are written to docker compose logs app. With SMTP, press Send test email in Email and brand, or Test on the Email row of the setup check; check that the sender's domain is verified with your provider. Members choose their own notices in Settings → Notifications and language. Demo workspaces only write emails to the log.

Paid plans don't switch on

The setup check's gateway rows must be green. At the gateway, the webhook must point to your APP_URL plus /api/v1/webhooks/stripe (or /paypal, /razorpay, /paystack) and list the events in chapter 16; every gateway shows each delivery and the answer it got. Test-mode keys only work with test-mode webhooks and prices.

Replies or the inbox don't update live

A proxy is buffering the streams. With the bundled Caddy it works as is; with Nginx add proxy_buffering off; (chapter 24); behind Cloudflare, make sure the response is not cached.

The build stops with "killed" or "signal: 9"

The server ran out of memory while compiling. Add swap or build on another computer (chapter 24).

"extension vector is not available"

The database has no pgvector. Use the bundled pgvector/pgvector:pg17 image, or turn pgvector on at your managed database (chapter 25), then press Check again in the install wizard.

The install wizard asks for a token I don't have

The app prints it in its log at every start until the install is finished, and each restart makes a new one, so use the last line of docker compose logs app | grep -i "install token". Or set INSTALL_TOKEN in .env and run docker compose up -d.

After an upgrade everything is empty

The folder was moved or renamed: Docker names the stack and its database volume after the folder unless COMPOSE_PROJECT_NAME is set, so it started a new, empty one. docker volume ls shows the old one as <old name>_postgres-data. Stop the app with docker compose down, set COMPOSE_PROJECT_NAME to the part before _postgres-data and run docker compose up -d again.

The app does not start

docker compose logs app names the problem, for example "APP_SECRET must be at least 32 characters" or "DATABASE_URL is not set". docker compose ps shows whether PostgreSQL and MinIO are healthy.

Too many sign-in attempts from everyone at once

TRUSTED_PROXY_HOPS is 0 behind a proxy, so every visitor shares one address. Set it to the number of proxies in front of the app (chapter 24).

36FAQ

Does the assistant make things up?

It is told to answer only from the workspace's knowledge, to cite it, and to say when it does not know; every reply is checked for sources and links that are not in the knowledge (chapter 9). Like every AI it can still misread a source, so the inbox, the ratings and the unanswered questions show the business what it said.

Can I try it without any AI key?

Yes. Crawling, files, Q&A, the knowledge test, the inbox, leads and bookings all work without a key; the assistant then says it is not set up yet and offers a person. A test copy with DEMO_MODE="true" gives you the full demo with stored sample answers and 90 days of history (chapter 23).

How much will the AI replies cost me?

See chapter 7: with the default models one reply costs a fraction of a cent at list prices, and for example a workspace on the Growth plan that uses all 10,000 replies of its month on OpenAI gpt-5-mini costs about $17.50 in replies, plus about $0.06 to embed its 2,000 pages once ($17.57 in all, against the plan's $79). The plans' replies a month cap each workspace's use.

Can my customers use their own AI keys?

Yes, on plans whose Own AI keys switch is on: their workspace keys are used before yours, and their providers bill them. Their replies still count toward their plan.

Does it work with any website?

Yes: any site where you can add a script tag (chapter 10). The crawler reads pages that show their text in HTML; pages built only with JavaScript can be added as files or Q&A.

Do I need to know Rust?

No, not to install, rebrand or run it: Docker builds everything. Changing the screens needs React; changing the widget needs TypeScript; changing server rules needs Rust (chapter 32).

Can I use another database or host it without Docker?

PostgreSQL 15 or newer with pgvector is required; managed PostgreSQL services with pgvector work (chapter 25). Without Docker, run the one askmark program behind your own HTTPS proxy (chapter 3).

Which licence do I need?

To charge your customers (sell plans), the Envato Extended Licence. See chapter 39.

37Credits and licences

Askmark is built with these open-source projects, each under its own licence:

Every dependency

The Rust crates (from Cargo.lock) and the npm packages of the web app and the widget, counted by licence when the release is built. docs/third-party-licenses.txt lists every package by name, version and licence.

LicenceRust cratesnpm packages
MIT67278
Apache-2.0 OR MIT2424
Unicode-3.018–
ISC410
Apache-2.0110
MPL-2.042
BSD-3-Clause32
OFL-1.1–5
(MIT OR Apache-2.0) AND Unicode-3.03–
Apache-2.0 OR MIT OR Zlib3–
Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT3–
MIT OR Unlicense3–
0BSD11
Apache-2.0 OR BSD-2-Clause OR MIT2–
Apache-2.0 OR BSL-1.0 OR MIT2–
Apache-2.0 OR ISC OR MIT2–
Apache-2.0 OR LGPL-2.1-or-later OR MIT2–
BSD-2-Clause–2
CDLA-Permissive-2.02–
Zlib2–
(Apache-2.0 OR MIT) AND BSD-3-Clause1–
0BSD OR Apache-2.0 OR MIT1–
Apache-2.0 AND ISC1–
Apache-2.0 OR BSL-1.01–
Apache-2.0 OR CC0-1.0 OR MIT-01–
BlueOak-1.0.0–1
BSD-3-Clause OR MIT1–
CC-BY-4.0–1
MIT AND BSD-3-Clause1–
MIT-0–1
Unlicense–1
Total371318

Every licence above allows use in a commercial product. cargo deny check licenses checks the Rust crates against this list.

Third-party services

Askmark works with outside services you choose: OpenAI, Anthropic, Google Gemini, OpenRouter and any OpenAI-compatible endpoint for replies and embeddings; Stripe, PayPal, Razorpay or Paystack for payments; an SMTP email provider; optionally S3-compatible storage, Google Calendar and Cal.com. Each is run by another company with its own terms and its own pricing tiers, and you, the buyer, are responsible for any costs they charge (chapter 7 lists their list prices). Askmark is not affiliated with any of them.

Images

Askmark ships no stock photos. The logo and the demo assistant's sun picture are original SVGs drawn in code, and every image in this guide is a screenshot of the running app. The demo business's website seen in some screenshots shows a photo by NxTide from Pixabay (Pixabay Content License); that website is not part of the download.

38Changelog

1.0.0 (2026-11-30)

First release.

  • Knowledge: websites read sitemap first, with depth and page caps, robots.txt, include and exclude paths, clean addresses, duplicate text kept once, and daily or weekly re-crawls that skip unchanged pages; PDF, Word, text and Markdown files up to 20 MB; Q&A pairs, typed in or imported from CSV; each page's status and skip reason, with Pause, Stop, Retry and Exclude; a test that shows the answer, its sources and the chunks it read.
  • Answers: full-text and pgvector search joined by rank fusion; replies only from the workspace's own knowledge, with numbered sources shown as links; "I don't know" without a model call when nothing is found; every reply checked for sources and links that are not in the knowledge; the visitor's words and the knowledge passed as data, never as instructions; replies streamed word by word, with Stop.
  • AI providers: OpenAI, Anthropic Claude, Google Gemini, OpenRouter and any OpenAI-compatible endpoint behind one interface, with the buyer's own keys; platform keys in .env or the platform admin, and a workspace's own keys on plans that allow them; sealed at rest, shown only as a hint, each with a Test button; an editable list-price table behind every cost figure.
  • Assistants: name, picture, colour, position, greeting, suggested questions, tone, rules, languages, memory, sources, handover (when there is no answer or whenever the visitor asks, within weekly hours) and lead form, booking rules, allowed websites and a public widget key.
  • Website widget: one script tag, plain TypeScript in a Shadow DOM, about 30 KB gzipped, keyboard and screen reader friendly, full screen on phones, light and dark, six languages with Arabic right to left, sources under each reply, lead and contact forms, bookings in the chat, ratings, transcripts by email, and window.Askmark with open, close and ask.
  • Inbox and handover: live chats for the whole team in four states (with the assistant, waiting for a person, with a person, closed); take over, assign, reply, internal notes, hand back, close and reopen, with no two teammates able to take one chat; transcripts by email; the visitor's place in the queue; emails for new chats, visitors waiting and replies to visitors who left.
  • Leads and bookings: leads from the chat with statuses, owners, notes, history and CSV export; calendars with weekly hours, slot length, buffer, notice and days ahead; Google Calendar (free/busy and events) and Cal.com sync; a database rule that stops two visitors booking one time; moving and cancelling from the chat or from the booking's own page; booking emails to the visitor and notices to the team.
  • Analytics: chats, resolution, how chats ended, leads, bookings, ratings, first answer time, top and unanswered questions (grouped, with Add an answer), languages and busiest hours, over 7, 30 or 90 days, each against the period before.
  • Developers: a REST API with workspace API keys and read or write scopes; signed outgoing webhooks for chats, leads and bookings, retried for 24 hours, with Send again; an MCP server for Claude, ChatGPT and other AI apps.
  • Plans and billing: limits on replies a month, pages of knowledge, assistants, seats and file storage, plus bookings, calendar sync, API access, white label and own AI keys; enforced on the server, with a message credit claimed before each reply and given back when it fails. Stripe, PayPal, Razorpay and Paystack checkouts with signed webhooks applied once; trials; three sample plans.
  • Teams: owner, admin, agent and viewer roles, invitations, each person's notices and language; the web app in English, Spanish, French, German, Portuguese and Arabic (right to left).
  • Platform admin: revenue, workspaces, replies and AI cost; workspaces (create, plan, suspend, close, open as owner); users and platform roles; plans; payments; AI providers and prices; email and brand; legal pages; languages; a setup check with live tests, Google Calendar sync and demo data removal; background jobs with Retry.
  • Install and hosting: one Docker Compose command (the app, PostgreSQL with pgvector, MinIO and optional HTTPS with Caddy), an install wizard with a pgvector check, rebranding without code, workspace export (JSON or CSV) and the purge of closed workspaces after 30 days.
  • Demo mode: a solar installer with its knowledge, 90 days of chats, leads and bookings, stored sample answers, new visitors every few minutes, one-click sign-ins and a nightly reset, with no paid AI call.

39Support and licence

Questions, bug reports and help with installation: use the Support tab on the item's page on the marketplace. Please include your Askmark version (the top of CHANGELOG.md, or /api/app-version on your platform), how you host it, and what you see (a screenshot, or the lines from docker compose logs app). Never send us your .env, API keys, tokens or passwords.

Support covers questions about the item's features, help with bugs and help with installing it as described here. It does not cover custom changes to the code, or your accounts at the AI providers, payment gateways, calendars and other outside services, which are handled by those companies.

Licence

The Regular Licence lets you use Askmark for one product whose end users are not charged. To charge your customers (sell plans or subscriptions), you need the Envato Extended Licence. One licence covers one platform (one brand on one installation). The licences page at codecanyon.net/licenses/standard explains both licences in full.

Askmark is not affiliated with, endorsed by or sponsored by OpenAI, Anthropic, Google or OpenRouter.