POST /api/submit#

Send code to run in a fresh, locked-down box.

Request#

curl -X POST "https://api.rustbox.sh/api/submit" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{
    "language": "python",
    "code": "print(2 + 2)",
    "stdin": ""
  }'
FieldTypeRequiredNotes
languagestringyespython py c cpp c++ cxx cc java javascript js typescript ts go rust rs
codestringyesYour code (max 64 KB)
stdinstringnoInput for the program (max 256 KB)

Webhooks are set on the project in the dashboard. Each run sends its result to the webhooks of the project its API key belongs to.

Get the result later (default)#

HTTP 202 Accepted
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "pending",
  "queue_depth": 0
}

Check GET /api/result/{id} for the result.

Wait for the result (?wait=true)#

curl -X POST "https://api.rustbox.sh/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "python", "code": "print(2 + 2)"}'

Keeps the connection open until the code finishes (up to 30 s), then returns the full result:

{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "schema_version": "2.0",
  "language": "python",
  "profile": "judge",
  "status": "completed",
  "timestamps": {
    "created_at": "2026-04-02T12:00:00.000Z",
    "started_at": "2026-04-02T12:00:00.001Z",
    "completed_at": "2026-04-02T12:00:00.046Z"
  },
  "result": {
    "verdict": "AC",
    "cause": "normal_exit",
    "actor": "runtime",
    "exit_code": 0,
    "signal": null,
    "error_message": null
  },
  "output": {
    "stdout": "4\n",
    "stderr": "",
    "integrity": "complete"
  },
  "metrics": {
    "cpu_time_secs": 0.012,
    "wall_time_secs": 0.014,
    "memory_peak_bytes": 8192000,
    "cpu_wall_ratio": 0.857,
    "divergence": "cpu_bound"
  },
  "evidence": {
    "isolation": {
      "mode": "strict",
      "controls_applied": ["pid_namespace", "mount_namespace", "network_namespace", "memory_limit", "process_limit", "no_new_privileges"],
      "controls_missing": [],
      "proc_policy": "hardened",
      "sys_policy": "builtin-deny",
      "pidfd_mode": "native",
      "reason": "All configured controls applied"
    },
    "limits": {
      "cgroup_backend": "cgroup_v2",
      "cgroup": {
        "memory_limit_bytes": 268435456,
        "memory_peak_bytes": 8192000,
        "oom_events": 0,
        "oom_kill_events": 0,
        "cpu_usage_usec": 12000,
        "process_count": 0,
        "process_limit": 10
      }
    },
    "teardown": {
      "reap_status": "clean",
      "descendant_containment": "ok",
      "zombie_count": 0,
      "cleanup_verified": true,
      "residual_mounts": [],
      "collection_errors": []
    }
  }
}

If the code does not finish in time, you get 408 Request Timeout with the run's id, so you can check for the result later.

Never run the same code twice (idempotency)#

Send an Idempotency-Key header (a UUID) so a retry doesn't start a second run:

Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000

If a run with that key already exists, you get that run back with 202. Use one on every request you might retry: a network retry should never run the same code again.

Errors#

StatusMeaning
400Unknown language, code too large, or webhook fields sent with the request (set webhooks on the project instead)
401API key missing or wrong
429Too many requests, or your plan's limit is used up
503The queue is full. This is on purpose, so the service stays fast; try again shortly

Error response examples#

HTTP 400 Bad Request
{"error": "code must not be empty"}
HTTP 400 Bad Request
{"error": "unsupported language: brainfuck. available: python, c, cpp, java, javascript, typescript, go, rust"}
HTTP 401 Unauthorized
{"error": "invalid or missing API key"}
HTTP 429 Too Many Requests
{"error": "API key quota exceeded"}
HTTP 503 Service Unavailable
{"error": "queue full, try again later"}