For builders

Run code from your backend

The API speaks two protocols. REST runs through your server and returns the finished result; WebSocket hands the browser a token so it can talk to us directly while the program runs. This page is REST, the one to start with and the one most products need.

Subscribe to an API plan, generate a Client ID and Client secret, and send them with the code.

One request

POST /v1/execute HTTP/1.1
Host: api.jdoodle.com
Content-Type: application/json

{
  "clientId": "yourClientId",
  "clientSecret": "yourClientSecret",
  "script": "print('Hello, World!')",
  "language": "python3",
  "versionIndex": "0"
}

What comes back is the output, along with how long it took and how much memory it used.

{
  "output": "Hello, World!",
  "statusCode": 200,
  "memory": "123456",
  "cpuTime": "0.02"
}

The parts worth understanding

  • language and versionIndex. The version is an index into that language's list, not a version number. Pinning it means a toolchain update does not change your results underneath you.
  • cpuTime and memory. Returned on every run. If you are grading, these are what turn "it worked" into "it worked within the limits".
  • statusCode. A program that fails to compile is a successful request with a failed program. Those are different failures and your code should treat them differently.

What next

A program that asks the user a question cannot be served by one request and one response. That needs a connection that stays open.

REST has every field, with samples in four languages.

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