POST /api/submit
Request
Section titled “Request”{ "language": "python", "code": "print(2 + 2)", "stdin": "", "webhook_url": "https://your-app.com/hooks/judge", "webhook_secret": "your-hmac-secret"}| Field | Type | Required | Notes |
|---|---|---|---|
language | string | yes | python, py, cpp, c++, cxx, java |
code | string | yes | Source code (max 64KB) |
stdin | string | no | Input data (max 64KB) |
webhook_url | string | no | HTTPS URL for result delivery |
webhook_secret | string | conditional | Required if webhook_url is set (max 256 bytes) |
Async response (default)
Section titled “Async response (default)”HTTP 202 Accepted{ "id": "550e8400-e29b-41d4-a716-446655440000"}Poll GET /api/result/{id} for the result.
Sync response (?wait=true)
Section titled “Sync response (?wait=true)”POST /api/submit?wait=trueHolds the connection until execution completes (max 30s). Returns the full result directly:
{ "id": "550e8400-e29b-41d4-a716-446655440000", "status": "completed", "verdict": "AC", "exit_code": 0, "stdout": "4\n", "stderr": "", "cpu_time": 0.012, "wall_time": 0.045, "memory_peak": 8192000}If execution doesn’t finish in time: 408 Request Timeout with the submission ID so you can poll.
Idempotency
Section titled “Idempotency”Send an Idempotency-Key header (UUID) to avoid duplicate submissions:
Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000If a submission with that key already exists, the existing record is returned with 202.
Errors
Section titled “Errors”| Status | Meaning |
|---|---|
| 400 | Invalid language, code too large, missing webhook_secret |
| 401 | Bad or missing API key |
| 503 | Queue full - bounded capacity, deliberate backpressure |