Use the REST API for server-side integrations. Requests are made to the API base URL configured for your environment; the production default is shown below. Keep access tokens and API keys on a trusted server, never in browser code.
Authenticate and make a request
The API uses JSON requests and returns a JSON envelope. Sign in with an account to receive an access token, then send it as a Bearer token. The app also supports API keys for server-to-server use; create and manage them in the API Keys area and follow the authentication format documented for your account.
The endpoint list and request methods are available in the API reference. For any request that changes data, handle non-success HTTP responses and the response envelope rather than assuming the operation succeeded.
Protect credentials
Store secrets in server-side environment variables or a managed secret store. Do not commit tokens, print them to logs, send them to analytics, or include them in frontend bundles. Revoke or rotate a credential if it was exposed.
Node.js: sign in, then list chatbots
const apiBase = process.env.PRIMEWEBKIT_API_URL ?? "https://api.primewebkit.com/api/v1";
const loginResponse = await fetch(`${apiBase}/auth/login`, {
method: "POST",
headers: { "Content-Type": "application/json", Accept: "application/json" },
body: JSON.stringify({
email: process.env.PRIMEWEBKIT_EMAIL,
password: process.env.PRIMEWEBKIT_PASSWORD,
}),
});
if (!loginResponse.ok) throw new Error(`Login failed: ${loginResponse.status}`);
const login = await loginResponse.json();
if (!login.success || !login.data?.access_token) throw new Error("Login response did not include an access token");
const botsResponse = await fetch(`${apiBase}/bots`, {
headers: { Accept: "application/json", Authorization: `Bearer ${login.data.access_token}` },
});
if (!botsResponse.ok) throw new Error(`Bot request failed: ${botsResponse.status}`);
console.log(await botsResponse.json());Create a chatbot
curl --request POST "$PRIMEWEBKIT_API_URL/bots" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $PRIMEWEBKIT_ACCESS_TOKEN" \
--data '{"name":"Support assistant","description":"Answers questions from approved help content"}'Frequently asked questions
What is the production API base URL?
The current frontend default is https://api.primewebkit.com/api/v1. Confirm the base URL for your own deployment or environment before making requests.
Can I call the API from browser code?
Do not put account credentials, access tokens, or API keys in public browser code. Proxy privileged calls through your server and apply your own authorization checks.
Where can I find endpoint details?
Use the API reference at /api and the specific documentation pages for webhooks, training sources, teams, and widget customization.