App platform
Blocks
Blocks are UI as JSON. Kweko asks your backend for them, checks them and draws them with its own components, so they look native, work on phones and follow the member's theme and language.
The blocks request
When a member opens a place where your app contributes blocks (a lead tab, a card on the lead panel, a dock widget…), Kweko sends a signed POST to your backend URL plus the app's blocks path (/kweko/blocks unless you changed it):
{
"context": {
"extension_point": "lead.panel.card",
"contribution_id": "stock",
"installation_id": "ins_01j8za1c2d3e4f5g6h7j8k9m0n",
"workspace": { "id": "ws_…", "name": "Acme", "currency": "UZS", "timezone": "Asia/Tashkent" },
"member": { "id": "mb_…", "name": "Aziz Rahimov", "locale": "uz", "role": "manager" },
"theme": { "mode": "light" },
"locale": "uz",
"issued_at": "2026-09-27T09:41:12Z",
"entity": { "type": "lead", "id": "ld_…" },
"action_token": "kwk_act_…"
},
"extension_point": "lead.panel.card",
"contribution_id": "stock"
}Headers: Kweko-App (your app id), Kweko-Timestamp and Kweko-Signature, signed like webhooks with your client secret. Verify the signature over the raw body and reject timestamps older than 5 minutes before you trust the context.
Answer within 1 second with 200 and:
{
"blocks": [
{ "type": "heading", "text": "Stock" },
{ "type": "key_value", "items": [ { "label": "Office chair Ergo", "value": { "type": "text", "text": "12 in stock" } } ] },
{ "type": "button", "label": "Reserve", "style": "primary", "action": { "id": "reserve" }, "confirm": "Reserve 2 items?" }
],
"cache_ttl": 30
}cache_ttl (0 to 3600 seconds) lets Kweko reuse the blocks. A slow, failing or invalid answer is not shown: Kweko shows an error in place of your blocks (app_slow, app_error, invalid_blocks).
Actions
When a member presses a button or submits a form in your blocks, Kweko posts to your actions path (/kweko/actions unless changed), signed the same way, with 10 seconds to answer:
{ "context": { … }, "contribution_id": "stock", "action_id": "reserve", "values": { "qty": "2" } }values holds the form fields by name. Composer contributions receive action_id composer.submit with values.text. Answer with any of:
| Key | Effect |
|---|---|
blocks | Replace the blocks |
toast | {"text": "Reserved", "tone": "success"}, text up to 300 characters |
navigate | An in-app path such as /leads/ld_… |
refresh | Record types to reload, for example ["lead"] (up to 10) |
open_frame | {"path": "/kweko/reserve", "title": "Reserve"}: open one of your pages as a frame |
Acting for the member
Every blocks and actions request carries context.action_token (kwk_act_…). When your backend then calls the Kweko API because of what the member did, send it next to your installation access token:
POST /v1/notes
Authorization: Bearer <installation access token>
Kweko-On-Behalf-Of: kwk_act_…- The call runs as Your app for Member name in the record's history and the audit log.
- It may do only what both your granted scopes and the member's role allow, on records the member can see. A viewer's token can read, never write.
- The token lives 5 minutes and belongs to one installation and one member. Use it for the work that follows a click; for background jobs use the access token alone.
- A tampered, expired or foreign token answers
401invalid_action_token. A member who was deactivated since answers403member_unavailable. The token is never accepted on its own as a bearer token.
apiHeaders({ accessToken, actionToken }) in @kweko/sdk/server builds the headers.
Images
An image block's url must be https://. Kweko never sends it to the member's browser: it rewrites it to a signed link on Kweko's own image proxy, which fetches the file from your server (no cookies, 5 second timeout, no redirects to another host, public addresses only) and serves it back.
- PNG, JPEG, GIF and WebP up to 2 MB, detected from the file's bytes, not its
Content-Type. SVG and anything else is refused and the image is not shown. - The link works only for members of the workspace it was made for, while your app is installed and turned on. Browsers may cache an image for 5 minutes.
Refreshing blocks
When data changes on your side, ask Kweko to refetch a contribution on every screen that shows it:
POST /v1/apps/ui/refresh
Authorization: Bearer <installation access token>
Content-Type: application/json
{ "contribution_id": "stock", "entity_type": "lead", "entity_id": "ld_…" }entity_type and entity_id are optional: without them every open copy of the contribution refetches. The push carries no data; each screen asks your backend again as its own member. Answers 202. Needs ui:extend, a Blocks contribution of your app, and at most about 1 refresh per second per installation (bursts of 10, then 429 with Retry-After). refreshUI() in @kweko/sdk/server sends it.
App data on records
Your app can keep small JSON values on leads, contacts and companies, for example a sync status or an external id, without a custom field the workspace has to create:
| Method | Path | Notes |
|---|---|---|
GET | /v1/{leads,contacts,companies}/{id}/app-data | Your keys on the record ({ "data": [{ "key", "value", "updated_at" }] }) |
GET | /v1/{leads,contacts,companies}/{id}/app-data/{key} | One key, 404 when not set |
PUT | /v1/{leads,contacts,companies}/{id}/app-data/{key} | Body { "value": … }, any JSON except null |
DELETE | /v1/{leads,contacts,companies}/{id}/app-data/{key} | 204 |
- Keys are
a-z,0-9and_, up to 40 characters. A value is up to 8 KB of JSON (payload_too_large); an app keeps up to 50 keys per record (422app_data_limit). - Each app sees only its own keys. Reading needs the record's read scope, writing its write scope, and an action token narrows both to what the member can do.
- A record another workspace owns, or one the caller can't see, answers
404.
Block types
Generated from the API's validator: each type accepts only these keys (besides type).
| Type | Keys |
|---|---|
text | text, tone |
heading | text |
key_value | items |
badge | text, tone |
button | label, style, action, confirm, optimistic, disabled |
button_group | buttons |
list | items |
table | columns, rows |
input | name, label, input_type, placeholder, value, required, hint |
select | name, label, options, multiple, value, required, placeholder |
checkbox | name, label, value |
toggle | name, label, value |
form | blocks, submit |
image | url, alt, width, height |
divider | none |
alert | tone, title, text, action |
progress | value, label |
chart | kind, title, series, stacked |
empty | text, action |
open_frame | label, path |
Tones (tone) are default, muted, neutral, success, warning, danger and info. Charts (kind) are area, line, bar or donut. A button_group holds up to 3 buttons, and form holds input blocks in blocks with a submit button.
Rules and limits
Kweko validates every response before it reaches a browser. A response that breaks a rule is not shown at all:
- Only the types and keys above. No HTML, scripts, styles or event handlers anywhere.
- Links and images must be
https://.navigateandopen_framepaths must be relative to Kweko or your app, starting with a single/. - At most 64 KB, 200 blocks, nesting 6 deep, 50 table rows, 500 points per chart series and 4000 characters of text.