API keys for the Witstally public API
Create a workspace API key in Settings, choose its scopes, copy it once, call the public API with it and revoke it when it is no longer needed.
An API key lets another system work with one Witstally workspace: a website form that creates leads, a script that reads counterparties, a warehouse sync that updates items. Each key belongs to one workspace, can do exactly what you allowed it to, and reaches only the public API at /api/v1/public, never the panel itself.
What you need
- A business workspace.
- The Owner or Full access role. Other roles do not see the API keys page.
Step 1. Open the API keys page
Open the workspace menu → Налаштування простору (Workspace settings) → API keys in the Integrations group. The page explains that a key works only in this workspace and links to the API reference.
Step 2. Create a key
In New key:
- Name: what the key is for, for example “Website form” or “Warehouse sync”.
- Valid until (optional): an expiry date. The key stops working at the start of that day (UTC), so pick the day after the last day it should work. Leave it empty for a key without expiry.
- What it may do: tick the scopes. Grant the minimum.
- Press Create key.
| Scope | Allows |
|---|---|
counterparties:read / counterparties:write | read / create, change and delete counterparties |
documents:read / documents:write | read documents / create drafts and delete |
items:read / items:write | read / change catalogue items |
leads:read | read deals of CRM boards |
leads:write | create CRM board deals only; reads nothing, so it is safe in a website’s code |
reports:read | read the receivables/payables and contracts reports |
A write scope also allows reading the same resource, except leads:write, which deliberately reads nothing. The deals:read and deals:write scopes (legacy pipeline) are listed, but no public endpoint uses them yet; use leads for CRM boards.
Step 3. Copy the key
The panel shows Key ”…” created with the key, which starts with wsk_. Press Copy and store it somewhere safe. Only a fingerprint is kept: the key cannot be shown again. Hide closes the panel.
Step 4. Call the API
Send the key in the X-Authorization-Key header:
curl https://api.witstally.com/api/v1/public/counterparties \
-H "X-Authorization-Key: wsk_YOUR_KEY"
The workspace is taken from the key itself. Lists return up to 50 rows per page by default, 200 at most. Each key may make 300 requests a minute. The interactive reference and the OpenAPI file are at https://api.witstally.com/api/v1/public/docs.
Responses to watch for:
401: the key is wrong, revoked or expired.403withinsufficient_scope: the key lacks the scope named inrequired.
For the most common case, a lead form on your site, follow Leads from your website via the API.
Step 5. Watch and revoke keys
Workspace keys lists every key with its name, the start of the key, its status (Active, Revoked, Expired), its scopes and when it was created, last used and valid until.
To stop a key, press Revoke and confirm. Integrations using it get 401 at once. The row stays in the list as revoked. To rotate a key, create a new one, switch the integration over, then revoke the old one.
Common problems
- I don’t see API keys in Settings. Only the Owner and Full access do, and only in a business workspace.
- I lost the key. It cannot be shown again. Create a new key and revoke the old one.
- “Expiry must be in the future.” The date you picked is today or earlier. Pick a later day.
403 insufficient_scope. Create a key with the scope the response names; scopes of an existing key cannot be changed.- The key works in one workspace only. That is by design. Create a key in each workspace the integration needs.
- A key cannot open panel pages or internal endpoints. Keys reach only
/api/v1/public.