Winkle Run API
Run code in 40+ languages over HTTP. Judge0-compatible: point any Judge0 client at https://run.usewinkle.com and use your Winkle Run key.
Authentication
Every request carries your API key, in either header:
X-Auth-Token: wr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Authorization: Bearer wr_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Keep the key on your server. It is shown once, when it is created; if you lose it, ask for a new one.
1. Pick a language
curl -s https://run.usewinkle.com/languages -H "X-Auth-Token: $WINKLE_RUN_KEY"
Free. Returns [{"id": 71, "name": "Python (3.8.1)"}, ...].
2. Submit code
curl -s -X POST "https://run.usewinkle.com/submissions?base64_encoded=false" \
-H "X-Auth-Token: $WINKLE_RUN_KEY" -H "Content-Type: application/json" \
-d '{"language_id": 71, "source_code": "print(input()[::-1])", "stdin": "hello"}'
{"token": "d85cd024-1548-4165-96c7-7bc88673f194"}
Optional fields: stdin, expected_output, cpu_time_limit (seconds), memory_limit (KB), compiler_options, command_line_arguments. Limits above your plan's caps are lowered to the cap. callback_url and enable_network are ignored, and wait=true is not supported: submit, then poll.
3. Poll for the result
curl -s "https://run.usewinkle.com/submissions/d85cd024-1548-4165-96c7-7bc88673f194?base64_encoded=false" \
-H "X-Auth-Token: $WINKLE_RUN_KEY"
{"stdout": "olleh\n", "status": {"id": 3, "description": "Accepted"}, "time": "0.012", "memory": 3200, ...}
Poll every 0.5 to 1 second until status.id is 3 or more. 1 is In Queue, 2 is Processing, 3 is Accepted, 4 Wrong Answer, 5 Time Limit Exceeded, 6 Compilation Error, 7 to 12 Runtime Error, 13 Internal Error, 14 Exec Format Error. Add &fields=stdout,status to get less back.
Batches
curl -s -X POST "https://run.usewinkle.com/submissions/batch?base64_encoded=false" \
-H "X-Auth-Token: $WINKLE_RUN_KEY" -H "Content-Type: application/json" \
-d '{"submissions": [{"language_id": 71, "source_code": "print(1)"}, {"language_id": 71, "source_code": "print(2)"}]}'
curl -s "https://run.usewinkle.com/submissions/batch?tokens=TOKEN1,TOKEN2&base64_encoded=false" \
-H "X-Auth-Token: $WINKLE_RUN_KEY"
Up to 20 submissions per batch. Results come back in the order you asked; a token that is not yours comes back as null.
Pricing
One credit per submission; a batch of n costs n. You are not charged when a submission is rejected (for example an unknown language) or when the runner fails with status 13. Reading results and the language list is free.
Pricing per run is announced soon. Talk to us for early access.
Errors
| HTTP | error | What to do |
|---|---|---|
| 400 | bad_request, batch_too_large, wait_not_supported | Fix the request. |
| 401 | unauthorized | Missing, malformed or revoked key. |
| 402 | insufficient_credits | Out of credits. The response includes balance. Top up and retry. |
| 403 | customer_suspended | The account is suspended. Contact us. |
| 404 | not_found | No such submission, or it belongs to another account. |
| 413 | payload_too_large | Requests are capped at 512 KB. |
| 422 | (Judge0's own message) | Judge0 rejected a field, e.g. an unknown language_id. Not charged. |
| 429 | rate_limited | Wait retry_after seconds (also in the Retry-After header). |
| 502 | upstream_unavailable | The runner did not answer. Not charged. Retry with backoff. |
Every error body is JSON: {"error": "...", "message": "..."}.
Status
Live status at https://run.usewinkle.com/, machine-readable at /status.json, and /health for uptime monitors.