HTTP API
Run code over HTTP
One submission in, one result out, in the standard submission format: the same fields, status
ids and language ids code-execution clients already use. Authenticate with your API key as Authorization: Bearer … or X-Auth-Token: ….
Run and wait
curl -s "https://boltzlabs.cloud/api/execute?wait=true" \
-H "X-Auth-Token: $BOLTZLABS_API_KEY" -H "Content-Type: application/json" \
-d '{"source_code": "print(int(input()) * 2)", "language_id": 100,
"stdin": "21", "expected_output": "42", "cpu_time_limit": 1}'{
"stdout": "42\n",
"stderr": null,
"compile_output": null,
"message": null,
"status": { "id": 3, "description": "Accepted" },
"time": "0.012",
"memory": 9216,
"token": "5d1e3c2a-…"
}fields=* returns every field; base64_encoded=true takes and returns source, input and output as base64.
Request
| Field | Default | Meaning |
|---|---|---|
| source_code | required | The program. |
| language_id | required | See the table below. |
| stdin | — | The program's input. |
| expected_output | — | Compare stdout to it: Accepted or Wrong Answer. |
| cpu_time_limit | 15 | Seconds of CPU the program may use. |
| cpu_extra_time | 1 | How far past the CPU limit it may run before it is stopped. |
| wall_time_limit | 30 | Seconds of wall time; with only a CPU limit, about 2× it + 1. |
| memory_limit | 262144 | KB. |
| redirect_stderr_to_stdout | false | Merge stderr into stdout. |
| supersede_key | — | A newer run with the same key cancels this one. |
Limits only ever lower the platform's own; above them is a 422. So are fields this platform does not offer — compiler options, command-line arguments, extra files, callbacks and network access — rather than being silently ignored.
Response
| status | { id, description } — see the table below |
| stdout, stderr | The program's output |
| compile_output | The compiler's messages (compiled languages) |
| message | Why a run stopped, e.g. Time limit exceeded |
| time, wall_time | Seconds, as strings: "0.012". Sandbox setup is not in them. |
| memory | Peak memory, KB |
| exit_code, exit_signal | How the program ended |
| token | To fetch this submission again |
Statuses
| 1 | In Queue |
| 2 | Processing |
| 3 | Accepted |
| 4 | Wrong Answer |
| 5 | Time Limit Exceeded |
| 6 | Compilation Error |
| 7 | Runtime Error (SIGSEGV) |
| 8 | Runtime Error (SIGXFSZ) |
| 9 | Runtime Error (SIGFPE) |
| 10 | Runtime Error (SIGABRT) |
| 11 | Runtime Error (NZEC) |
| 12 | Runtime Error (Other) — including memory and output limits |
| 13 | Internal Error — our failure, never billed |
Languages
GET /api/languages is the live list. Ids, codes and versions are
listed on Supported languages.
Queue now, fetch later
Without wait=true you get a token at once; fetch the result with it.
Results are kept for an hour.
POST /api/execute → { "token": "…" }
GET /api/execute/{token} → the submission (status 1 and 2 while it waits and runs)
DELETE /api/execute/{token} → removes it, and cancels it if unfinishedBatches
Up to 20 submissions in one request — a problem's test cases, say. They run in parallel.
POST /api/execute/batch {"submissions": [ {…}, {…} ]} → [{"token": "…"}, …]
GET /api/execute/batch?tokens=a,b → {"submissions": [ {…}, {…} ]} (in the order asked)