# OnlineCompiler.io > Code execution API (also called an online compiler API). Send source code in one of 46 languages, with optional stdin, and get back stdout, stderr, exit code, wall-clock run time and memory; or send test cases and get a verdict for each. Judge0- and Piston-compatible endpoints, an embeddable code editor and an MCP server use the same sandbox: a fresh gVisor container per run with no network access. Free up to 100,000 requests a month, commercial use included, no credit card. Most users are developers building online judges and coding-challenge sites, coding courses and LMSs, and coding-test or interview platforms: anything that has to run code written by someone else, usually against stdin test cases. It also works as a sandbox for AI agents (MCP) and as an embeddable code editor for docs and blogs. Base URL: `https://api.onlinecompiler.io`. Authenticate with your API key in the `Authorization` header (`Authorization: YOUR_API_KEY`). Get a key by signing in at https://api.onlinecompiler.io/compilers/api-keys/. Example (sync, result in the response): ``` curl -X POST https://api.onlinecompiler.io/api/run-code-sync/ \ -H "Authorization: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"compiler": "python-3.14", "code": "print(int(input()) * 2)", "input": "21"}' ``` Response fields: `output` (stdout), `error` (stderr or compiler errors), `status` ("success" or "error"), `exit_code`, `signal`, `time` (run-command wall time in seconds; includes compilation inside Java, F#, Deno, Dart, Erlang, Elixir, Clojure, Groovy and Racket), `total` (seconds, including compilation), `memory` (KB), `truncated` (true when output or error went over 64 KB and was cut), `time_limit` (the run's time limit in seconds), `files` (files the program wrote to `$OUTPUT_DIR`, each `{name, mime, size, content_base64, url}`; see Python data science, files in and out) and `files_truncated`. Output and error are UTF-8 text; NUL bytes and invalid UTF-8 come back as U+FFFD. ## Ways to run code - [Sync REST API](https://onlinecompiler.io/docs/run-code#endpoint-sync): `POST /api/run-code-sync/` with `compiler`, `code` and optional `input` and `time_limit` (seconds the program may run, above 0 and up to 30; compiling before it does not count, and the run is stopped at it with exit code 124; Java, Groovy and F# compile as they start, so they get extra seconds on top: Java 1 s, Groovy 1.5 s and F# 2.5 s). Returns the result in the response. Optional `files` attach input files (see Python data science, files in and out). - [Run tests](https://onlinecompiler.io/docs/run-tests): `POST /api/run-tests/` runs one program against a list of tests and returns a verdict for each, an overall verdict and a score; same `Authorization` header, and it waits for the result. Body: `compiler`, `code`, `tests` (objects with `input`, `expected_output`, optional `hidden` and `weight`), and optional `time_limit` (seconds per test, default 2, up to 30; plus the start-up allowance for Java 1 s, Groovy 1.5 s and F# 2.5 s), `files` (input files shared by every test), `checker` (`trim` default, `exact`, `tokens`, `float` with `tolerance`, `rows` for an unordered set of rows, with the same `tolerance`: a line with `|`, a comma or a tab splits at each one into fields, empty fields kept and spaces around them ignored, any other line splits at whitespace), `scoring` (`all_or_nothing` default, `percent`, `weighted`) and `stop_on_failure`. Response: `verdict`, `score` (0 to 100), `passed`, `total`, `time_limit`, `compile_error` and `tests`. Verdicts: `accepted`, `wrong_answer`, `time_limit_exceeded`, `compilation_error`, `runtime_error`, `output_limit_exceeded`, `memory_limit_exceeded`, `internal_error` and `skipped` (never started), plus `incomplete` for the overall verdict (the start cut-off skipped tests, usually because the host or the account's other runs kept the sandboxes busy; retry the request, which runs and counts every test again). Hidden and skipped tests return only `verdict` and `hidden`. Each test counts as one run and takes one of the account's pending slots from the request's arrival until that test finishes. Tests per request: 8 on Free, 20 on Starter, 40 on Pro, 80 on Business; tests run in rounds of at most 4 at once, and a round takes up to time_limit + start-up allowance + round overhead (3 s for compiling and starting; Crystal 13 s, Kotlin 6 s, Nim 5.5 s, Zig 4.5 s, Scala 4 s, C# 4 s and Visual Basic 4 s, since each test compiles again; C, C++ and Java compile once per request when there are more tests than run at once); all rounds must fit in 60 s and the last must start within 45 s, after which no test starts; inputs and expected outputs total at most 1 MB. Visible tests return their output files, at most 4 MB of file content per response (later tests get `files_truncated`), with `url` null; hidden tests never return files. - [Async REST API](https://onlinecompiler.io/docs/run-code#endpoint): `POST /api/run-code/` returns 202 with a job id, then posts the result to the public HTTP(S) callback URL set on your API key; private IPs and redirects are rejected. Pass an `extra_params` JSON object (up to 8 KB) to get your own data back in the callback. - [WebSocket](https://onlinecompiler.io/docs/websocket): real-time results for browser apps, using a separate WebSocket key. - [Embeddable widget](https://onlinecompiler.io/docs/widget): add `` and a `
` (or `