Developers Console

Get Your API Key

Nice to meet you! Enter your details to register as a developer. Connect to me on Twitter or LinkedIn in case of any issue.

Your LinkedIn / Twitter / Project Link
API Documentation for Contest API
Here’s a detailed explanation for the API, including status codes, error messages, and successful responses, aimed at helping developers work with your API.

1. Register for an API Key

Endpoint: POST /api/developers/register
• Description: Developers can register for an API key by providing their LinkedIn and endpoint. Once registered, you will receive an API key via email. Keep in mind that only logger in users can register themselves.
• Request Headers:
   • Content-Type: application/json
   • Cookie: User login token for authentication.
• Request Body:
1
{
2
"endPoint": "<developer's endpoint>",
3
"linkedIn": "<developer's LinkedIn URL>"
4
}

• Possible Responses:
• 200 OK:
1
{
2
"result": {message: "Your API Key has been sent. Please use the API Key to access the api. Check Spam if not found."},
3
"code": 200,
4
"status": "ok"
5
}

• 400 Bad Request:
1
{
2
"message": "End Point or LinkedIn not found.",
3
"code": 400
4
}

• 401 Unauthorized:
1
{
2
"message": "Please login to continue.",
3
"code": 401
4
}


2. Check API Usage

Endpoint: GET /api/developers/usages
• Description: Developers can check their current API usage, including the number of calls made in the current month and the previous months. Default number of calls per month is 1000. To get more quota tag me on twitter or linkedIn to show what you are building.
• Request Headers:
   • Cookie: User login token for authentication.
• Possible Responses:
• 200 OK:
1
{
2
"result": [{
3
"_id": "6705c565343cf0e8254bfa94",
4
"email": "raunit@codingkaro.in",
5
"apiKey": "follow me on twitter",
6
"endpoint": "http://localhost:3000/api/developers/contests/apiKey",
7
"maxLimit": 1000,
8
"monthlyUsage": 20,
9
"lastReset": "2024-10-09T06:51:05.054Z",
10
"linkedIn": "https://linkedin.com/in/raunit",
11
"usageHistory": [
12
{
13
"month": 9,
14
"year": 2024,
15
"usage": 41,
16
"_id": "670627ce2fc2d3f80592d5f7"
17
}
18
],
19
"__v": 3
20
}],
21
"code": 200,
22
"status": "Ok"
23
}

• 401 Unauthorized:
1
{
2
"message": "Please login to continue.",
3
"code": 401
4
}


3. Retrieve Contest Data Using API Key

Endpoint: GET /api/developers/contests/yourApiKey
• Description: Fetch all available programming contests. Developers must provide their API key in the URL.
• Request Parameters:
   • apiKey: The API key provided upon registration.
• Possible Responses:
• 200 OK:
1
{
2
"code":200",
3
"status:": "Ok",
4
"result": [
5
{
6
"_id": "https://www.hackerearth.com/challenges/hackathon/ust-d3code-campus-hackathon24",
7
"name": "UST D3CODE Hackathon'24",
8
"url": "https://www.hackerearth.com/challenges/hackathon/ust-d3code-campus-hackathon24",
9
"start_time": "2024-09-18T22:00:00.000Z",
10
"end_time": "2024-10-06T12:59:00.000Z",
11
"duration": "1522740",
12
"site": "HackerEarth",
13
"status": "CODING"
14
}
15
]
16
}

• 400 Bad Request:
1
{
2
"message": "API Key not found. or Wrong api key or endpoint.",
3
"code": 400
4
}

• 429 Too Many Requests:
1
{
2
"message": "Monthly limit exceeded. Please upgrade your plan..",
3
"code": 429
4
}


Status Codes Summary

• 200 OK: The request was successful.
• 400 Bad Request: Invalid input, such as missing parameters.
• 401 Unauthorized: The user must be authenticated (logged in) or has provided an invalid API key.
• 403 Forbidden: The user’s email is not verified.
• 404 Not Found: The requested resource (user or contest) was not found.
• 429 Too Many Requests: The developer has exceeded their monthly quota.
• 500 Internal Server Error: Something went wrong on the server.