{{errorMessage}}

Compiler API Documentation

  • What this service is?
  • JDoodle Compiler is an online API service to compile and execute Programs online via APIs, it supports Java, C/C++, PHP, Perl, Python, Ruby and many more languages.

  • What type of API it is?
  • It is a JSON based Rest API.

  • Can I call your API directly from a web page?
  • This APIs are meant for server to server call and protected with client ID and Client Secret, if you make call directly from web page then you have to expose your personal client ID and Secret in the page which is not secure and we request you not to do that. Best way is to direct the request from your webpage to your own server and call JDoodle API from your server.

  • Is Websocket supported?
  • Not at this stage, but if more customers interested in Websocket, we can introduce.

  • What is the request endpoint for compiler api?
  • https://api.jdoodle.com/v1/execute (only POST method supported with Content-Type: application/json)

  • What is the request endpoint to check my today's usage?
  • https://api.jdoodle.com/v1/credit-spent (only POST method supported with Content-Type: application/json)

  • What subscription options available?
  • We have got multiple plans including a Free plan, please refer compiler-api home page for current Plans.

  • Is plan costs are in USD?
  • All the cost mentioned is in USD.

  • Can I change from one plan to another plan?
  • Yes. if you are upgrading from lower volume plan to upper volume plan, your change will be immediate. if you are moving from upper volume plan to lower volume plan, your change will be effective from end of your current billing period.

  • What is a billing period and when my credit card charged?
  • When you subscribe to a paid plan first time, you are paying for the plan and your billing period starts from that date, your credit card will be charged every month on that day. For example, if you subscribe for a paid plan on 5th November, your billing period is 5th of every month, and you will be charged on 5th of every month.

  • How cost calculated when I move from lower volume plan to upper volume plan and when I will be charged (upgrade)?
  • You are always charged only on your billing date, that is at the end of current billing period. if you move to upper volume plan, the cost is calculated on prorate basis and the additional cost for the current billing period will be included in the next payment. For example, if your billing period starts on 1st April and your current plan is $10 per Month, if you are moving to $20 plan on 16th of April. Your next bill will be calculated approximately like = (usage on current plan $10 on prorate from 1st to 15th) $5 + (usage on new plan $20 for 16th to 30th on prorate basis) $10 + (next billing period cost for 1st May to 31st May) $20 - (Amount you have already paid for 1st to 30th April) $10 = $25

  • How cost calculated when I move from upper volume plan to lower volume plan (downgrade)?
  • When you are moving from upper volume plan to lower lower volume plan, the change is effective only from start of your next billing period, so you will be charged for new plan from start of new billing period. you can continue use your current plan until the end of current billing period, no refund provided.

  • What happens when I cancel my subscription?
  • if you are on Free plan, the cancellation will be processed immediately. if you are on Paid plan, your subscription will be cancelled at the end of your current billing period, you can use your plan until end of current billing period. no refund provided.

  • Can I reactivate my subscription?
  • If you cancelled, you can reactivate any time until the end of your current billing period. if end of billing period reached, you have to subscribe again.

  • Is My Credit Card Details safe?
  • We use Stripe for all Credit Card processing, we are not storing or handling your Credit Card details in our systems.

  • What are the Input Parameters for execute api call?
  • Parameter Description
    clientId Client ID for your subscription
    clientSecret Client Secret for your subscription
    script program to compile and execute
    stdin StdIn
    language language of the script (refer the supported language list below)
    versionIndex version of the language to be used (refere the supportoed languages and versions in list below)
  • What are the Output Parameters for execute api call when the execution is successful?
  • Parameter Description
    output Output of the program
    statusCode Status Code of the result
    memory Memory used by the program
    cpuTime CPU Time used by the program
  • What are the Output Parameters for execute api call when the execution failed?
  • Parameter Description
    error error message
    statusCode Status Code of the result
  • What are the Input Parameters for "credit-spent" api call?
  • Parameter Description
    clientId Client ID for your subscription
    clientSecret Client Secret for your subscription
  • What are the Output Parameters for "credit-spent" api call when the execution is successful?
  • Parameter Description
    used No of credits used today
  • What are the Output Parameters for "credit-spent" api call when the execution failed?
  • Parameter Description
    error error message
    statusCode Status Code of the result
  • What languages and versions supported?
  • Language (not passed in request) Language Code (passed in request) Version (not passed in request) VersionIndex (this is what passed in request)
    Java java JDK 1.8.0_660
    JDK 9.0.11
    JDK 10.0.12
    C c GCC 5.3.00
    Zapcc 5.0.01
    GCC 7.2.02
    GCC 8.1.03
    C-99 c99 GCC 5.3.00
    GCC 7.2.01
    GCC 8.1.02
    C++ cpp GCC 5.3.00
    Zapcc 5.0.01
    GCC 7.2.02
    GCC 8.1.03
    C++ 14 cpp14 g++ 14 GCC 5.3.00
    g++ 14 GCC 7.2.01
    g++ 14 GCC 8.1.02
    PHP php 5.6.160
    7.1.111
    7.2.52
    Perl perl 5.22.00
    5.26.11
    5.26.22
    Python 2 python2 2.7.110
    2.7.151
    Python 3 python3 3.5.10
    3.6.31
    3.6.52
    Ruby ruby 2.2.40
    2.4.2p1981
    2.5.1p572
    GO Lang go 1.5.20
    1.9.21
    1.10.22
    Scala scala 2.12.00
    2.12.41
    2.12.52
    Bash Shell bash 4.3.420
    4.4.121
    4.4.192
    SQL sql SQLite 3.9.20
    SQLite 3.21.01
    SQLite 3.23.12
    Pascal pascal fpc 3.0.00
    fpc-3.0.21
    fpc-3.0.42
    C# csharp mono 4.2.20
    mono 5.0.01
    mono 5.10.12
    VB.Net vbn mono 4.0.10
    mono 4.61
    mono 5.10.12
    Haskell haskell ghc 7.10.30
    ghc 8.2.11
    ghc 8.2.22
    Objective C objc GCC 5.3.00
    GCC 7.2.01
    GCC 8.1.02
    Swift swift 2.20
    3.1.11
    4.12
    Groovy groovy 2.4.6 JVM: 1.7.0_990
    2.4.12 JVM: 9.0.11
    2.4.15 JVM: 10.0.12
    Fortran fortran GNU 5.3.00
    GNU 7.2.01
    GNU 8.1.02
    Brainf**k brainfuck bfc-0.10
    Lua lua 5.3.20
    5.3.41
    TCL tcl 8.60
    8.6.71
    8.6.82
    Hack hack HipHop VM 3.13.00
    RUST rust 1.10.00
    1.21.01
    1.25.02
    D d DMD64 D Compiler v2.071.10
    Ada ada GNATMAKE 6.1.10
    GNATMAKE 7.2.01
    GNATMAKE 8.1.02
    R Language r 3.3.10
    3.4.21
    3.5.02
    FREE BASIC freebasic 1.05.00
    VERILOG verilog 10.10
    10.21
    COBOL cobol GNU COBOL 2.0.00
    GNU COBOL 2.2.01
    Dart dart 1.18.00
    1.24.21
    1.24.32
    YaBasic yabasic 2.7690
    Clojure clojure 1.8.00
    1.9.01
    NodeJS nodejs 6.3.10
    9.2.01
    10.1.02
    Scheme scheme Gauche 0.9.40
    Gauche 0.9.51
    Forth forth gforth 0.7.30
    Prolog prolog GNU Prolog 1.4.40
    Octave octave GNU 4.0.00
    GNU 4.2.11
    GNU 4.4.02
    CoffeeScript coffeescript 1.11.10
    2.0.01
    2.3.02
    Icon icon 9.4.30
    F# fsharp 4.10
    Assembler - NASM nasm 2.11.080
    2.13.011
    2.13.032
    Assembler - GCC gccasm GCC 6.2.10
    GCC 8.1.01
    Intercal intercal 0.300
    Nemerle nemerle 1.2.0.5070
    Ocaml ocaml 4.03.00
    Unlambda unlambda 0.1.30
    Picolisp picolisp 3.1.11.10
    17.11.141
    18.5.112
    SpiderMonkey spidermonkey 380
    45.0.21
    Rhino JS rhino 1.7.7.10
    BC bc 1.06.950
    1.07.11
    CLISP clisp GNU CLISP 2.49 - GNU C 5.2.0 0
    GNU CLISP 2.49 - GNU C 6.2.11
    GNU CLISP 2.49.93 - GNU 8.1.02
    Elixir elixir 1.3.40
    1.5.21
    1.6.42
    Factor factor 8.250
    8.281
    8.292
    Falcon falcon 0.9.6.8 (Chimera)0
    Fantom fantom 1.0.690
    Nim nim 0.15.00
    0.17.21
    0.18.02
    Pike pike v8.00
    SmallTalk smalltalk GNU SmallTalk 3.2.920
    OZ Mozart mozart 2.0.0 (OZ 3)0
    LOLCODE lolcode 0.10.50
    Racket racket 6.110
    6.121
    Kotlin kotlin 1.1.51 (JRE 9.0.1+11)0
    1.2.40 (JRE 10.0.1)1
    Whitespace whitespace 0.30
  • Java Example for Execute API Call?
  • Below is a quick and dirty Java example, but please use your favorite rest API client and JSON Java libraries for clean code and for production use.

    package com.jdoodle;
    
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.net.HttpURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    
    public class APITest {
        public static void main(String args[]) {
    
            String clientId = "YourClientID"; //Replace with your client ID
            String clientSecret = "YourClientSecret"; //Replace with your client Secret
            String script = "";
            String language = "php";
            String versionIndex = "0";
    
            try {
                URL url = new URL("https://api.jdoodle.com/v1/execute");
                HttpURLConnection connection = (HttpURLConnection) url.openConnection();
                connection.setDoOutput(true);
                connection.setRequestMethod("POST");
                connection.setRequestProperty("Content-Type", "application/json");
    
                String input = "{\"clientId\": \"" + clientId + "\",\"clientSecret\":\"" + clientSecret + "\",\"script\":\"" + script +
                "\",\"language\":\"" + language + "\",\"versionIndex\":\"" + versionIndex + "\"} ";
    
                System.out.println(input);
    
                OutputStream outputStream = connection.getOutputStream();
                outputStream.write(input.getBytes());
                outputStream.flush();
    
                if (connection.getResponseCode() != HttpURLConnection.HTTP_OK) {
                    throw new RuntimeException("Please check your inputs : HTTP error code : "+ connection.getResponseCode());
                }
    
                BufferedReader bufferedReader;
                bufferedReader = new BufferedReader(new InputStreamReader(
                (connection.getInputStream())));
    
                String output;
                System.out.println("Output from JDoodle .... \n");
                while ((output = bufferedReader.readLine()) != null) {
                    System.out.println(output);
                }
    
                connection.disconnect();
    
            } catch (MalformedURLException e) {
                e.printStackTrace();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
    
                
  • NodeJs Example for Execute API Call?
  • var request = require('request');
    
    var program = {
        script : "",
        language: "php",
        versionIndex: "0",
        clientId: "YourClientID",
        clientSecret:"YourClientSecret"
    };
    request({
        url: 'https://api.jdoodle.com/execute',
        method: "POST",
        json: program
    },
    function (error, response, body) {
        console.log('error:', error);
        console.log('statusCode:', response && response.statusCode);
        console.log('body:', body);
    });
            
  • Curl Example for execute API Call?
  • Below is an Curl example (note: may need slight syntax change in windows)

    curl -H "Content-Type: application/json; charset=UTF-8" -X POST -d '{"clientId": "YourClientId","clientSecret":"YourClientSecret","script":"","language":"php","versionIndex":"0"}' https://api.jdoodle.com/v1/execute
                
  • Curl Example for "credit-spent" API Call?
  • Below is an Curl example (note: may need slight syntax change in windows)

    curl -H "Content-Type: application/json; charset=UTF-8" -X POST -d '{"clientId": "YourClientId","clientSecret":"YourClientSecret"}' https://api.jdoodle.com/v1/credit-spent
                
  • Postman Examples?






  • Do yo have any client Library for these APIs?
  • We don't provide API client libraries, but you can generate client libraries in so many different languages, using http://editor.swagger.io/ and the below JSON API Description. Simply go to http://editor.swagger.io/, copy paste the below JSON into the editor, click on Generate Client and select the language.

    
        {
            "swagger": "2.0",
            "info": {
                "description": "JDoodle Compiler API",
                    "version": "1.0.0",
                    "title": "JDoodle Compiler API",
                    "termsOfService": "https://www.jdoodle.com/terms",
                    "contact": {
                    "email": "jdoodle@nutpan.com"
                }
            },
            "host": "api.jdoodle.com",
            "basePath": "/v1",
            "consumes": [
                "application/json"
            ],
            "produces": [
                "application/json"
            ],
            "paths": {
            "/execute": {
                "post": {
                    "summary": "Execute Program",
                        "description": "Endpoint to execute code",
                        "tags": [
                            "execute"
                        ],
                        "parameters": [
                        {
                            "name": "execute",
                            "in": "body",
                            "description": "the body",
                            "required": true,
                            "schema": {
                                "properties": {
                                    "clientId": {
                                        "type": "string"
                                    },
                                    "clientSecret": {
                                        "type": "string"
                                    },
                                    "script": {
                                        "type": "string"
                                    },
                                    "language": {
                                        "type": "string"
                                    },
                                    "versionIndex": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    ],
                        "responses": {
                        "200": {
                            "description": "Execution success"
                        },
                        "401": {
                            "description": "Unauthorized"
                        },
                        "429": {
                            "description": "Daily limit reached"
                        }
                    }
                }
            },
            "/credit-spent": {
                "post": {
                    "summary": "Credit Spent",
                        "description": "Endpoint to execute code",
                        "tags": [
                        "credit-spent"
                    ],
                        "parameters": [
                        {
                            "name": "credit",
                            "in": "body",
                            "description": "the body",
                            "required": true,
                            "schema": {
                                "properties": {
                                    "clientId": {
                                        "type": "string"
                                    },
                                    "clientSecret": {
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    ],
                        "responses": {
                        "200": {
                            "description": "Execution success"
                        },
                        "401": {
                            "description": "Unauthorized"
                        }
                    }
                }
            }
        },
            "externalDocs": {
            "description": "Find out more about JDoodle Compiler API",
                "url": "https://www.jdoodle.com/compiler-api"
        }
    }
                
  • Where can I find help and support?
  • for any help, doubts, suggestions, etc, get in touch with us at jdoodle@nutpan.com

Sign in

New to JDoodle ? -
or
{{this.signInForm.loginErrorMessage}}
JDoodle is trying to signin you in, Please wait...

Register

Thanks for registering!!!
We have sent you an email for confirmation.
Before login, Please check your email to complete the registration!
Already Have an Account ? -
We recommend
or you can register with your email below
{{ message }}
JDoodle is creating an account for you, Please wait...
By registering, you agree to the Terms of Service

Forgot Password

{{this.forgotPasswordForm.message}}

Please check your email for password reset link.

JDoodle is checking your details, Please wait...

Unlock Account

{{this.unlockAccountForm.message}}

Please check your email for unlock link.

JDoodle is checking your details, Please wait...

Change Password

Password Successfully Changed

{{this.changePasswordForm.message}}

Change Display Name

{{this.changeDisplayNameForm.message}}

Display Name Successfully Updated

Welcome to JDoodle

app loading now, please wait...