For compiling and running code in several languages.
HackerEarth API V4 is a code-compilation-and-execution API that lets registered client applications submit source code in a specified programming language for compiling and running, along with optional input data, memory and time limits, and a callback URL. Access requires registering a web application to obtain a client-specific client-secret, which is passed in the request header for authentication. The API operates only asynchronously: a submission returns a temporary response while the request is queued, and results can be retrieved either by polling a getStatus endpoint or by receiving a callback POST once compilation and execution complete.
Requests are made via a single POST endpoint that handles both compilation and execution in one call, differing from the prior v3 API, which required two separate endpoint calls and supported both synchronous and asynchronous modes. Parameters include the language, source code, optional input, memory limit (up to 262144 KB), time limit (up to 5 seconds), a context string for passing client-side identifiers, and an optional callback URL that is invoked after compilation and again after execution, with up to 3 retries and 5 redirects supported. Responses include status codes such as REQUEST_INITIATED, REQUEST_QUEUED, CODE_COMPILED, REQUEST_COMPLETED, and REQUEST_FAILED, along with execution details like memory used, time used, exit code, and output.
This is aimed at developers building applications that need to compile and run user-submitted code, such as online coding platforms, judges, or educational tools, and who need programmatic access to execution results including compile status and runtime metrics.
Yes, there is a cap on the number of free requests a user can make, along with a cap on the number of clients a user can register.
You register your web application to receive a unique client-secret, which is then passed in the request header under the key client-secret.
No, API v4 only supports asynchronous code evaluation requests, unlike v3 which supported both synchronous and asynchronous.
You can either poll the getStatus endpoint or provide a callback URL in the request to receive a POST with compilation and execution results.
Requests must be sent as application/json with fields like lang, source, input, memory_limit, time_limit, context, and callback.
Show your product to thousands of developers
· 100k monthly pageviews
· 7k newsletter subscribers
Get access to Codeforces data.
For compiling and running code in several languages.
Run JMESPath queries on JSON data for filtering, transforming, and extracting results.
Online code execution system.
Create, retrieve, update, increment, and decrement counters identified by namespace and key.
PHP syntax checker.