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

shell
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}'
response.json
{
  "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

FieldDefaultMeaning
source_coderequiredThe program.
language_idrequiredSee the table below.
stdin—The program's input.
expected_output—Compare stdout to it: Accepted or Wrong Answer.
cpu_time_limit15Seconds of CPU the program may use.
cpu_extra_time1How far past the CPU limit it may run before it is stopped.
wall_time_limit30Seconds of wall time; with only a CPU limit, about 2× it + 1.
memory_limit262144KB.
redirect_stderr_to_stdoutfalseMerge 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, stderrThe program's output
compile_outputThe compiler's messages (compiled languages)
messageWhy a run stopped, e.g. Time limit exceeded
time, wall_timeSeconds, as strings: "0.012". Sandbox setup is not in them.
memoryPeak memory, KB
exit_code, exit_signalHow the program ended
tokenTo fetch this submission again

Statuses

1In Queue
2Processing
3Accepted
4Wrong Answer
5Time Limit Exceeded
6Compilation Error
7Runtime Error (SIGSEGV)
8Runtime Error (SIGXFSZ)
9Runtime Error (SIGFPE)
10Runtime Error (SIGABRT)
11Runtime Error (NZEC)
12Runtime Error (Other) — including memory and output limits
13Internal 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.

shell
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 unfinished

Batches

Up to 20 submissions in one request — a problem's test cases, say. They run in parallel.

shell
POST /api/execute/batch            {"submissions": [ {…}, {…} ]}  → [{"token": "…"}, …]
GET  /api/execute/batch?tokens=a,b → {"submissions": [ {…}, {…} ]}   (in the order asked)