Piston API
List every language and version Piston can run, then execute code in a sandbox over HTTP. No API key. Verified runtimes response and the rate limit that bites.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the Piston API?
Piston is a free, open source code execution engine with a public API. `GET https://emkc.org/api/v2/piston/runtimes` lists every language and version it can run, and `POST /api/v2/piston/execute` compiles and runs a snippet in an isolated container. No API key is required.
Piston is the engine behind a great many Discord bots and coding-practice sites, which is why its runtime list is so eclectic: alongside Python, Rust and Go you will find Befunge, Brainfuck, COBOL and BQN. Each entry is a language plus a specific version, so a single language name appears several times, and the version is part of the identity when you run code.
The `aliases` array is the field that saves you a lookup table: `sh` maps to `bash`, `bf` to `brainfuck`, `deno` to a Deno-hosted TypeScript runtime. Any alias is accepted where a language name is expected. The public instance is rate limited to a few requests per second per address, which is fine for a bot and hopeless for a batch grader, so anything at volume should self-host. The project ships as a container and is designed for exactly that.
Quick facts
- Base URL
https://emkc.org/api/v2/piston- Authentication
- No key on the public instance. Self-hosting is encouraged for anything beyond casual use and removes the shared rate limit entirely.
- Rate limit
- The public instance is documented as limiting to roughly 5 requests per second per IP address.
- Pricing
- Free and open source (MIT), self-hostable.
- CORS
- Enabled — callable directly from browser JavaScript
- Official docs
- Read the docs
How to use the Piston API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. List every language runtime available
GET https://emkc.org/api/v2/piston/runtimes
curl 'https://emkc.org/api/v2/piston/runtimes'const res = await fetch("https://emkc.org/api/v2/piston/runtimes");
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
res = requests.get("https://emkc.org/api/v2/piston/runtimes", timeout=20)
res.raise_for_status()
print(res.json())[
{
"language": "matl",
"version": "22.5.0",
"aliases": []
},
{
"language": "matl",
"version": "22.7.4",
"aliases": []
},
{
"language": "bash",
"version": "5.2.0",
"aliases": [
"sh"
]
},
{
"language": "befunge93",
"version": "0.2.0",
"aliases": [
"b93"
]
},
{
"language": "bqn",
"version": "1.0.0",
"aliases": []
},
{
"language": "brachylog",
"version": "1.0.0",
"aliases": []
},
{
"language": "brainfuck",
"version": "2.7.3",
"aliases": [
"bf"
]
},
{
"language": "cjam",
"version": "0.6.5",
"aliases": []
},
{
"language": "clojure",
"version": "1.10.3",
"aliases": [
"clojure",
"clj"
]
},
{
"language": "cobol",
"version": "3.1.2",
"aliases": [
"cob"
]
},
{
"language": "coffeescript",
"version": "2.5.1",
"aliases": [
"coffeescript",
"coffee"
]
},
{
"language": "cow",
"version": "1.0.0",
"aliases": [
"cow"
]
},
{
"language": "crystal",
"version": "0.36.1",
"aliases": [
"crystal",
"cr"
]
},
{
"language": "dart",
"version": "2.19.6",
"aliases": []
},
{
"language": "dash",
"version": "0.5.11",
"aliases": [
"dash"
]
},
{
"language": "typescript",
"version": "1.32.3",
"aliases": [
"deno",
"deno-ts"
],
"runtime": "deno"
},
{
"language": "javascript",
"version": "1.32.3",
"aliases": [
"deno-jParameters
| Parameter | Type | Required | Description |
|---|---|---|---|
(runtimes) | n/a | Optional | The runtimes endpoint takes no parameters. /runtimes |
language | string | Optional | For `POST /execute`: language name or any of its aliases. python |
version | string | Optional | For `POST /execute`: exact version from the runtimes list, or a semver range such as `3.x`. 3.10.0 |
files | array | Optional | For `POST /execute`: array of `{name, content}` objects. The first file is the entry point. [{"content":"print(1)"}] |
stdin | string | Optional | Standard input piped to the program. 42 |
run_timeout | integer | Optional | Execution timeout in milliseconds, subject to the instance's own ceiling. 3000 |
Response fields
(root)array- One object per runtime. The same language appears once per available version, so deduplicate before building a language picker.
languagestring- Canonical language name, which is what you send in an execute request.
versionstring- Exact version of that runtime. Required in an execute request, though a semver range is accepted.
aliasesarray of strings- Alternative names accepted in place of `language`, such as `sh` for `bash` or `b93` for `befunge93`. Frequently empty.
runtimestring- Present only when a language is hosted by another runtime, for example TypeScript and JavaScript under `deno`. Its absence is meaningful.
What you can build with the Piston API
- Add a runnable code block to documentation or a tutorial site
- Build a Discord or Slack bot that evaluates snippets on request
- Run automated exercises in a coding-practice product
- Test a snippet against several language versions to check compatibility
- Prototype an online judge before investing in your own sandbox infrastructure
Common errors and how to fix them
429
The public instance's per-second limit was exceeded.
Fix: Throttle to a few requests per second, or self-host Piston, which removes the shared limit.
400 on execute
The language and version pair does not exist.
Fix: Resolve both from a fresh `/runtimes` call. Versions are added and retired, so a hard-coded version will eventually break.
Empty output
The program wrote to stderr, or was killed by the timeout.
Fix: Read `run.stdout`, `run.stderr` and `run.code` separately rather than assuming stdout carries everything.
Piston API — frequently asked questions
Is the Piston API free?
Yes, the public instance needs no key. It is rate limited to a few requests per second, and the project encourages self-hosting for anything at volume.
How many languages does Piston support?
Well over sixty, counting multiple versions of each, ranging from mainstream languages to esoteric ones. `/runtimes` is the authoritative list at any moment.
Is running arbitrary code safe?
Piston executes in isolated containers with CPU, memory and process limits. Even so, sending untrusted user code to a shared public instance is a decision to make deliberately; self-host if the code or the workload is sensitive.
Do I have to specify a version?
The execute endpoint expects one, but it accepts semver ranges such as `3.x`, so you can pin loosely rather than to an exact build.
Tools that pair with this API
JSON Formatter
Format, beautify and minify JSON online with 2-space, 4-space or tab indentation. Sort keys alphabetically and catch syntax errors instantly — free and private.
Code Case Converter
Convert an identifier between camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, dot.case and Title Case — all forms at once. Free and private.
Text Compare
Compare two texts online free and highlight every difference. A private text comparison tool that finds matches and changes right in your browser.
cURL to Fetch Converter
Paste a curl command and get a ready-to-use JavaScript fetch() snippet plus an axios version — method, headers, body and auth mapped automatically, all offline.
Piston is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.