WebSalabim

API documentation

Base address https://websalabim.com/api/v1 · Sign up to get a key

1. What this API is for

This API lets your own AI agent or script do what you would otherwise do in the panel: create sites, ask the AI to revise a design or the business data, watch the job, and publish. It suits building several sites at once, automating recurring changes, or wiring this panel into your own tooling.

The rules are exactly the same as using the panel. Content filtering still applies, every AI request still uses 1 Magic token, and plan limits still hold. There is no looser path through the API.

2. Authentication

The API is available from any paid plan. During the free trial, keys cannot be created and requests are answered with 402. This documentation stays readable at any time, so you can prepare your agent first.

Create a key from the API menu inside the panel. The key is shown once — copy it and keep it like a password. We only store its hash, so we cannot read it back to you either.

Authorization: Bearer wsb_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

A key acts as your whole account. Revoke it from the panel as soon as it is unused; revocation takes effect immediately. Keys also die automatically if your account is suspended.

3. Request and response shape

Send the request body as JSON with Content-Type: application/json. Responses are always JSON, whatever your Accept header says. Every response carries a boolean ok; on failure there is an error string you can show your user directly.

{"ok": true,  "job": 42, "sumber": "paket", "kuota": {"total_sisa": 27}}
{"ok": false, "error": "Out of Magic tokens. Buy Magic tokens to continue.", "beli": "/tagihan#kredit", "ajak": "/ajak"}

4. Status codes

CodeMeaningWhat your agent should do
200SuccessCarry on
400Body is not valid JSONFix your serialisation
401Key missing, wrong, revoked, or account suspendedDo not retry — check the key
402Out of Magic tokens, the plan has expired, or the account has no paid planStop and tell the owner; retrying will not help
404Site or job does not exist, or belongs to someone elseCheck the id
405Wrong HTTP methodCheck GET vs POST
409An AI job is still running, the slug is taken, or the plan's site limit is reachedWait, or choose differently
422Invalid input, or rejected by the content filterDo not retry the same content
429Too many requestsWait — see the Retry-After header

5. Quota and rate limits

Only AI requests use Magic tokens (POST /situs/{id}/ai). Creating a site, reading status, and publishing cost nothing. Rejected requests — 402, 409, 422 — do not use quota either.

Order of use: the free allowance from sign-up, then purchased Magic tokens — a subscription does not include Magic tokens. The AI response includes sumber so your agent knows which one was spent.

Rate limits: 60 requests per minute per key across the API, and 6 AI requests per minute per account. A site may only have one AI job running at a time; further requests get 409 until it finishes.

6. Content policy

Every request and every new site is filtered first. Anything aimed at gambling, adult content, drugs, fraud, or impersonating others gets 422 and is never executed. Violations are recorded, counted together with violations made through the panel, and once the limit is reached the account is suspended — at which point API keys stop working immediately. An agent that retries the same content only reaches suspension faster.

7. Endpoints

GET /kuota

Magic tokens remaining and how long the plan runs.

curl -s https://websalabim.com/api/v1/kuota -H "Authorization: Bearer $KEY"

{"ok":true,"kuota":{"total_sisa":27,"gratis_sisa":0,"paket_sisa":9,"kredit":18},
 "paket":"Bisnis","berlaku_sampai":"2026-12-01"}

GET /situs

Every site belonging to the key holder.

{"ok":true,"situs":[{"id":12,"slug":"warungkopisari","nama_usaha":"Warung Kopi Sari",
 "jenis":"usaha","bahasa":"id","status":"published","alamat":"https://warungkopisari.websalabim.site"}]}

POST /situs

Create a site. Uses no Magic tokens, but is bounded by your plan's site limit.

FieldRequiredNotes
nama_usahayesBusiness name, at least 2 characters
deskripsiyesAt least 10 characters; the clearer it is, the better the AI's result
kategorinoFor example Food, Services, Shop
slugnoSubdomain; derived from the name if omitted. 3–40 lowercase letters/digits/-
jenisnousaha (default) or event
bahasanoLanguage of the website content: id or en
curl -s -X POST https://websalabim.com/api/v1/situs \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"nama_usaha":"Sari Coffee House","kategori":"Food",
       "deskripsi":"Single-origin robusta roasted in house, open daily 7am-10pm",
       "slug":"saricoffee","bahasa":"en"}'

{"ok":true,"id":12,"slug":"saricoffee","alamat":"https://saricoffee.websalabim.site"}

GET /situs/{id}

One site, with its draft version number and whether anything is waiting to be published.

POST /situs/{id}/ai

Uses quota. Send one request to the AI.

FieldRequiredNotes
promptyesAt least 5 characters. Plain language, as if briefing a designer
kanalnodesain (default) or data to change Business Data
modenorevisi (default) changes only what you ask; ulang rebuilds from scratch
curl -s -X POST https://websalabim.com/api/v1/situs/12/ai \
  -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" \
  -d '{"prompt":"make the main colour green and add a promo section below the hero"}'

{"ok":true,"job":42,"sumber":"paket","kuota":{"total_sisa":26}}

GET /situs/{id}/ai/{job}

Job status: queued, running, done, or failed. When done, the response includes the version number and a preview link valid for 15 minutes.

POST /situs/{id}/terbitkan

Make the draft the live version. Uses no quota.

8. A complete flow

The usual agent cycle: create the site, ask for a design, wait, publish.

#!/usr/bin/env bash
set -e
API="https://websalabim.com/api/v1"; H="Authorization: Bearer $KEY"; J="Content-Type: application/json"

SID=$(curl -s -X POST "$API/situs" -H "$H" -H "$J" \
  -d '{"nama_usaha":"Sari Coffee House","deskripsi":"Robusta roasted in house, open daily"}' \
  | php -r 'echo json_decode(file_get_contents("php://stdin"),true)["id"];')

JOB=$(curl -s -X POST "$API/situs/$SID/ai" -H "$H" -H "$J" \
  -d '{"prompt":"a warm brown page with the menu and a WhatsApp button"}' \
  | php -r 'echo json_decode(file_get_contents("php://stdin"),true)["job"];')

# wait for it — do not poll more often than once every 3 seconds
until curl -s "$API/situs/$SID/ai/$JOB" -H "$H" | grep -q '"status":"done"'; do sleep 3; done

curl -s -X POST "$API/situs/$SID/terbitkan" -H "$H"

9. Using it well

  • Do not poll status more than once every 3 seconds; a design job usually takes 1–2 minutes.
  • Stop your agent on 401, 402, and 422 — retrying will not succeed and can make things worse.
  • On 429, wait for as long as Retry-After says.
  • Keep keys in environment variables, not in code that ends up in a repository.
  • Use one key per agent or machine, so a leak only costs you that one key.