Your First API Call#

This guide takes you from API key to a working code execution in under 5 minutes.

Prerequisites#

1. Make your first call (sync)#

The simplest pattern: submit code and wait for the result in a single request.

curl -s -X POST "https://api.rustbox.orkait.com/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)"}' | jq

Replace rb_live_your_key_here with your actual API key. Request access to get one.

Response:

{
  "id": "f2c6c5f7-1203-46e5-8a4f-a619c12bfeb0",
  "language": "python",
  "job_status": "completed",
  "schema_version": "1.0",
  "verdict": "AC",
  "exit_code": 0,
  "signal": null,
  "stdout": "42\n",
  "stderr": "",
  "output_integrity": "complete",
  "error_message": null,
  "cpu_time_secs": 0.009142,
  "wall_time_secs": 0.01,
  "memory_peak_bytes": 3862528,
  "evidence": {
    "verdict_cause": "normal_exit",
    "verdict_actor": "runtime",
    "isolation_mode": "strict",
    "controls_applied": ["pid_namespace", "mount_namespace", "network_namespace", "memory_limit", "process_limit", "no_new_privileges"],
    "controls_missing": [],
    "cgroup": {
      "cpu_usage_usec": 9142,
      "memory_limit_bytes": 268435456,
      "memory_peak_bytes": 3862528,
      "oom_events": 0,
      "oom_kill_events": 0,
      "process_count": 0,
      "process_limit": 10
    },
    "timing": {
      "cpu_ms": 9,
      "wall_ms": 10,
      "cpu_wall_ratio": 0.9,
      "divergence": "cpu_bound"
    },
    "process_lifecycle": {
      "reap_status": "clean",
      "descendant_containment": "ok",
      "zombie_count": 0
    },
    "judge_actions": [],
    "collection_errors": []
  },
  "created_at": "2026-04-03T08:05:23.540110054+00:00",
  "started_at": "2026-04-03T08:05:23.540218508+00:00",
  "completed_at": "2026-04-03T08:05:23.570195915+00:00"
}

verdict: "AC" means the code ran successfully with a clean exit.

2. Async pattern (submit, then poll)#

For batch workloads or when you do not want to hold a connection open.

WorkerRustbox APIClientWorkerRustbox APIClientloop[until completed]POST /api/submit {language, code}1202 {id, job_status: "pending"}2enqueue(id)3sandbox · execute · evidence4GET /api/result/{id}5{job_status, verdict?, stdout?, evidence?}6

Submit:

curl -s -X POST "https://api.rustbox.orkait.com/api/submit" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "python", "code": "print(42)"}' | jq
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "job_status": "pending",
  "queue_depth": 0
}

Poll:

curl -s "https://api.rustbox.orkait.com/api/result/550e8400-e29b-41d4-a716-446655440000" \
  -H "X-API-Key: rb_live_your_key_here" | jq

Poll until job_status is completed or error.

3. Passing stdin#

Many use cases require feeding input to the executed code. Use the stdin field:

curl -s -X POST "https://api.rustbox.orkait.com/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{
    "language": "python",
    "code": "name = input()\nprint(f\"Hello, {name}!\")",
    "stdin": "World"
  }' | jq
{
  "id": "b1c2d3e4-5f6a-7b8c-9d0e-f1a2b3c4d5e6",
  "language": "python",
  "job_status": "completed",
  "schema_version": "1.0",
  "verdict": "AC",
  "exit_code": 0,
  "signal": null,
  "stdout": "Hello, World!\n",
  "stderr": "",
  "output_integrity": "complete",
  "error_message": null,
  "cpu_time_secs": 0.013,
  "wall_time_secs": 0.025,
  "memory_peak_bytes": 3200000
}

4. Webhooks (fire and forget)#

For high-throughput workloads, submit with a webhook URL and we will POST the result to your endpoint when execution completes.

curl -s -X POST "https://api.rustbox.orkait.com/api/submit" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{
    "language": "python",
    "code": "print(42)",
    "webhook_url": "https://your-app.com/hooks/result",
    "webhook_secret": "your-hmac-secret"
  }' | jq

The result is delivered to your URL with HMAC-SHA256 signature headers following the Standard Webhooks spec. See the Webhooks reference for verification details.

5. Handling errors#

Not all code runs cleanly. Here is what a runtime error looks like:

curl -s -X POST "https://api.rustbox.orkait.com/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "python", "code": "raise RuntimeError(\"something broke\")"}' | jq
{
  "id": "64374887-a809-4542-9c85-4002d2ebf3fa",
  "language": "python",
  "job_status": "completed",
  "schema_version": "1.0",
  "verdict": "RE",
  "exit_code": 1,
  "signal": null,
  "stdout": "",
  "stderr": "Traceback (most recent call last):\n  File \"/tmp/rustbox-uid-0/60000/workdir/solution.py\", line 1, in <module>\n    raise ValueError(\"boom\")\nValueError: boom\n",
  "output_integrity": "complete",
  "error_message": null,
  "cpu_time_secs": 0.009511,
  "wall_time_secs": 0.01,
  "memory_peak_bytes": 3858432,
  "evidence": {
    "verdict_cause": "re_nonzero_exit",
    "verdict_actor": "runtime",
    "isolation_mode": "strict"
  }
}

verdict: "RE" (Runtime Error) means the process exited with a non-zero code. The stderr field contains the traceback. The exit_code tells you exactly what the process returned.

6. Try another language#

All 8 languages work the same way. Just change the language field:

curl -s -X POST "https://api.rustbox.orkait.com/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "javascript", "code": "console.log(\"Hello from JS\")"}' | jq
 
curl -s -X POST "https://api.rustbox.orkait.com/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "c", "code": "#include <stdio.h>\nint main() { printf(\"Hello from C\\n\"); return 0; }"}' | jq
 
curl -s -X POST "https://api.rustbox.orkait.com/api/submit?wait=true" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: rb_live_your_key_here" \
  -d '{"language": "go", "code": "package main\nimport \"fmt\"\nfunc main() { fmt.Println(\"Hello from Go\") }"}' | jq

Next steps#