API FAQs
Frequently Asked Questions
What is a credit?
JDoodle uses a credit system to manage daily API usage. Based on your subscription plan, a fixed number of credits are allocated each day. These credits expire at the end of the day and do not roll over; new credits are allocated daily.
Why am I getting a timeout response on my code?
This happens because the REST API has a limited timeout duration. If your program is too large or uses too many libraries, it might exceed this duration. To resolve this, use the WebSocket API, which has a longer timeout.
How can I resolve a CORS issue when testing my application locally?
CORS issues are common when calling APIs from the front end. To avoid this, host the API in your backend instead of calling it directly from the front end.
Can I enable internet access for my API calls?
You can enable internet access by setting the _internetEnabled_ field to _True_. Note that this feature is only available for paid users with at least a $10 API plan and consumes two credits per REST call. Example:
{
"script": "public class MyClass { public static void main(String args[]) { int x=10; int y=25; int z=x+y; System.out.println(\"Sum of x+y = \" + z); } }",
"internetEnabled": True
}
Can I embed an IDE instead of calling the API directly?
Yes—besides APIs, JDoodle offers Embeds to drop a ready-to-use IDE into your site and still execute on JDoodle’s infrastructure.
Which API should I use—REST or WebSocket—for code execution?
Use REST for one-off runs; use WebSocket for interactive/streaming sessions (multiple inputs, live output).
Is there an API to compile and run user code from my app?
Yes, JDoodle has compiler APIs (REST and WebSocket) to execute user code securely from your backend or serverless functions.
