Hackerearth API

Programming / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

HackerEarth is a developer assessment platform, and its API lets you compile and execute code in over 30 programming languages programmatically. You submit source code and input, and the API returns the output, execution time, and memory usage. It is useful for building coding playgrounds, online judges, or automated code evaluation tools.

💡

Beginner Tip

Always check the compile_status field first before reading the output — a compilation error will have an empty run_status output. Use language codes like PYTHON3, C, JAVA exactly as listed in the docs.

Available Data

translated text
source language
target language
confidence score

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from Hackerearth",
    "description": "For compiling and running code in several languages",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

compile_status Compilation result: OK if successful, or CE if there was a compilation error.
run_status.status Execution result code: AC (accepted), TLE (time limit exceeded), MLE (memory limit exceeded), or RE (runtime error).
run_status.output Standard output produced by the executed program.
run_status.time_used Actual CPU time consumed by the program in seconds.
run_status.memory_used Memory consumed by the program in kilobytes.

Implementation Example

// ⚠️ Note: This URL may be a documentation page. Check official docs for actual API endpoint.
const url = "https://www.hackerearth.com/docs/wiki/developers/v4/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

HTTP 401 Unauthorized The client-secret header is missing or contains an invalid API key.
Log into HackerEarth, go to your API settings, copy the client secret, and send it as the client-secret header.
compile_status: CE (Compilation Error) The submitted source code contains syntax errors for the selected language.
Test your code locally first, then verify the language code matches the source (e.g., use PYTHON3 for Python 3 syntax).
run_status: TLE (Time Limit Exceeded) The code ran longer than the allowed execution time limit.
Optimize your algorithm or increase the time_limit parameter in the request (subject to plan limits).

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Category Programming
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →