Compile API
Run BobShit from your scripts, bots, or tools. Same endpoint the editor uses.
Auth is a BobAI API key with scope bobcode (or *).
1. Endpoint
POST https://bob.xem.yt/bobcode/compile
Authorization: Bearer sk-YOUR_KEY
Content-Type: application/json
Alias also available: POST https://bob.xem.yt/api/v1/bobcode/compile
(same body / auth).
Create a key at bob.xem.yt/chat → API keys → enable scope bobcode.
GET on the same path returns a short discovery JSON (no key required for the hint payload;
execution always needs POST + Bearer).
2. Request body
| Field | Type | Required | Notes |
|---|---|---|---|
code |
string | yes | BobShit source. Aliases: source, program. |
lang |
string | no | Default bobshit. Allowed: bobshit, shit, bs. |
timeout |
number | no | Seconds, clamped between ~1 and 15. |
filename |
string | no | Optional label (editor sends it); not required by the runner. |
{
"code": "affiche \"yo\"\nx = 1 + 1\naffiche x",
"lang": "bobshit"
}
3. curl examples
Minimal
curl -sS -X POST 'https://bob.xem.yt/bobcode/compile' \
-H 'Authorization: Bearer sk-YOUR_KEY' \
-H 'Content-Type: application/json' \
-d '{"code":"affiche \"hello from curl\"","lang":"bobshit"}'
Pretty-print with jq
curl -sS -X POST 'https://bob.xem.yt/bobcode/compile' \
-H 'Authorization: Bearer sk-YOUR_KEY' \
-H 'Content-Type: application/json' \
-d @- <<'EOF' | jq .
{
"code": "POUR i DANS 1 JUSQUA 3\n affiche i\nFIN",
"lang": "bobshit",
"timeout": 5
}
EOF
From a file
CODE=$(python3 -c 'import json,sys; print(json.dumps(sys.stdin.read()))' < script.bs)
curl -sS -X POST 'https://bob.xem.yt/bobcode/compile' \
-H 'Authorization: Bearer sk-YOUR_KEY' \
-H 'Content-Type: application/json' \
-d "{\"code\":$CODE,\"lang\":\"bobshit\"}"
4. Response format
Success
HTTP 200 when the runner finishes (even if your program printed errors — check ok / exit_code).
{
"ok": true,
"lang": "bobshit",
"output": "yo\n2\n",
"errors": "",
"stdout": "yo\n2\n",
"stderr": "",
"exit_code": 0,
"error": null,
"api_key_id": "…"
}
| Field | Meaning |
|---|---|
ok | Runner considers the run successful. |
output / stdout | Program stdout (same content, two keys). |
errors / stderr | Stderr / soft warnings. |
exit_code | Process exit code when available. |
error | Machine-readable failure reason when ok is false. |
Auth / client errors
// 401 — missing or bad key
{ "ok": false, "error": "invalid_api_key" }
// 403 — key exists but no bobcode scope
{ "ok": false, "error": "insufficient_scope", "need": "bobcode" }
// 429 — slow down
{ "ok": false, "error": "rate_limited", "retry_after": 12 }
// 400 — empty code / bad lang / runtime error
{ "ok": false, "error": "code_required" }
{ "ok": false, "error": "unsupported_lang", "hint": "only bobshit for now" }
Timeout → HTTP 408 with error: "timeout".
Runner down → HTTP 502 (bobshit_unreachable…).
5. Limits
- Execution timeout capped (~15s max).
- Source size capped server-side (
code_too_largeif you go wild). - Per-key rate limit (RPM); respect
retry_afteron 429. - Sandbox: this is for snippets, not spawning the whole server. Stay wholesome.
BobCode API · https://bob.xem.yt/bobcode/compile · scope bobcode