Compiler API: run code from your own application

Send a program and its input, and get back what it printed, how long it took and the exit status. Each run happens in a sandbox that exists only for that execution, so you never host one.

114

Languages, frameworks and databases

1 credit

Per run, whatever the language

Developer calling the JDoodle compiler API

Trusted by teams and institutions worldwide

How it works

One request, one result

A run is a single POST. Send the program, the standard input it expects, the language and the version you want it built with.

curl -X POST https://api.jdoodle.com/v1/execute \
  -H "Content-Type: application/json" \
  -d '{
    "clientId": "your-client-id",
    "clientSecret": "your-client-secret",
    "script": "print(sum(int(x) for x in input().split()))",
    "stdin": "2 3 4",
    "language": "python3",
    "versionIndex": "6"
  }'

What comes back:

{
  "output": "9\n",
  "statusCode": 200,
  "memory": "7768",
  "cpuTime": "0.02"
}

That is the whole integration for most products. Your application keeps its own interface, its own data and its own logic. The REST reference has every field, and the WebSocket builds on the same request when you need output as it appears.

Features

What you get for one POST request

A sandbox per run

Every execution gets its own filesystem and process limits, with no route to your network. The hard part of running untrusted code is containing it, and that is the part you hand over.

Every language the site runs

114 languages, frameworks and databases, each with several versions you choose per request rather than being held to whichever is newest.

REST or WebSocket

One request and one response for grading and fixed input. A streaming connection when your user has to answer the program while it runs.

Programs that read input

Send stdin with the request, or let your user type it live over the socket. Interactive exercises behave the way a terminal does.

Output you can act on

Standard output, standard error, CPU time, memory used and the exit status come back on every call, so grading and diagnostics need no second request.

Credits you can predict

One run is one credit whatever the language, checking your balance is free, and there is a free tier to build against before committing.
Who runs code this way

Four products, one problem

The University of Kansas assesses students on it, iText demonstrate their PDF library with it, LINK Group put it inside their learning platform, and Outlier.org teach with it. Each needed to run code somebody else wrote, and none of them wanted to host the machine that does it.

Kansas, iText, LINK Group and Outlier each describe what they built.

If you want the editor too

API, or an embedded IDE?

An API is the right choice when you already have an interface and only need the run. If you want people writing code in your page as well, an embedded IDE is usually less work: a working editor drops into your page with no backend of your own. API or embed walks through which one a given product wants.

The request format, the credit rules and every error code are in the docs.

Plans and pricing

Every plan, side by side, with what each one includes.

See the plans

Frequently asked questions

There are more in the documentation.

What is a compiler API?

A compiler API runs source code on somebody else’s machines and returns the result to yours. You post a program and the input it needs, the code is compiled and executed in a sandbox, and you get back what it printed, what it wrote to standard error, how long it took and the exit status. It exists so a product that needs to run code somebody else wrote does not have to build and defend the machine that runs it.

How is it different from running code on my own servers?

The hard part of running untrusted code is not running it, it is containing it. Every run needs its own filesystem, its own process limits, no route to your network, and a way to stop a program that never ends. Doing that yourself means maintaining a sandbox and patching it for as long as the feature lives. The API gives you a fresh sandbox per run and someone else keeps it current.

Which languages does the JDoodle compiler API support?

JDoodle runs 114 languages, frameworks and databases, including every language on the site, so what you can run here you can run from the API. Each one offers several versions, and you choose the version per request rather than being held to whatever is newest.

What does the compiler API cost?

Your plan gives you a number of credits a day, and they reset daily. Running code costs one credit per run, whatever the language. Checking how many credits you have left is free however often you ask. There is a free tier to build against before you commit to anything.

REST or WebSocket?

Start with REST. One request, one response with the final output, which is what grading, fixed input and most integrations need. Use the WebSocket when your user has to answer the program while it runs, or when you want output to appear as it is produced rather than at the end. The socket builds on the same request, so moving between them is small.

Can I let people write code in my own page instead?

Yes, and if you want the editor as well as the execution, an embed is usually less work than an API. An embedded IDE drops a working editor into your page with no backend of your own. The API is the right choice when you already have an interface and only need the run.

Still stuck on something?

Ask our support team - they answer these themselves.

Contact support

This website uses cookies to ensure you get the best experience on our website.