Create Interview


You can schedule interviews using following API endpoint:

 https://api.hackerearth.com/partner/hackerearth/interviews/

Authentication

The client authentication is done using your unique client_id and client_secret.

You can refer to your Dashboard settings, for client_id and client_secret under API details.

client_id

Type: String

Description: client_id is a 67 character random key that serves as an identification for a particular client. It must be provided when communicating with the API as a parameter to the API endpoint.

Example: d8a20ae8e475209er4b1faa72ede88a174423cc2029c.api.hackerearth.com

client_secret

Type: String

Description: client_secret is a 40 character random key that serves as an identification for a particular client. It must be provided when communicating with the API as a parameter to the API endpoint.

Example: 2b0ff29f4f8751487540604cdab5611e6135f41c


Making requests

All the requests to the API must be made using the POST request method.

client_id, client_secret, title, start_datetime, candidate_details and interviewers are the required parameters for making the request to this API endpoint. eval_params, inform_candidate and inform_interviewers are optional parameters. All these parameters have been explained below.

client_id and client_secret are explained above.

title

Type: String

Description: title should contain the interview title.

Example: Technical Interview

start_datetime

Type: String

Description: start_datetime should contain the start date and start time of the interview in ISO8601 date-time format.

Example: 2019-07-31T21:25:02+05:30

candidate_details

Type: Dictionary

Description: candidate_details should consist of full_name, email_id and contact_number fields which contain candidate's full name, email address and contact number respectively. full_name and email_id are the required fields while contact_number is optional.

interviewers

Type: List

Description: interviewers should be a list of dictionaries where each dictionary represents an interviewer's details.

Each interviewer's details should consist of full_name, email_id and feedback_redirect_url fields which contain interviewer's full name, email address and the redirect url for feedback submission respectively. full_name and email_id are the required fields while feedback_redirect_url is optional.

If feedback_redirect_url is specified then the interviewer would be redirected to that url for feedback submission as soon as he/she ends the interview at HackerEarth.

Note: The length of interviewers list should range between 1 and 5. That is, minimum 1 and maximum 5 interviewers details can be specified in this list.

eval_params (Optional)

Type: List

Description: eval_params should be a list of strings containing evaluation parameters/criteria for the interview.

inform_candidate (Optional)

Type: Boolean value (True/False)

Description: The value of this field indicates whether to send interview invite email to the candidate. If this field is not provided, then by default inform_candidate will be True and candidate will receive interview invite email.

inform_interviewers (Optional)

Type: Boolean value (True/False)

Description: The value of this field indicates whether to send interview invite email to the interviewers. If this field is not provided, then by default inform_interviewers will be True and interviewers will receive interview invite email.

Sample request using *python*

#!/usr/bin/env python

import json
import requests

CLIENT_ID = "abcdefghijklm123456789nopqrstuvwxyz.api.hackerearth.com"
CLIENT_SECRET = "abcdefghijklm123456789nopqrstuvwxyz"
TITLE = "Technical Interview"
START_DATETIME = "2020-05-31T21:25:02+05:30"
CANDIDATE_DETAILS = {
    "full_name": "Sergio Marquina",
    "email_id": "sergio.marquina@gmail.com",
    "contact_number": "919603329860"
}
INTERVIEWERS = [
    {
        "full_name": "John Smith",
        "email_id": "john.smith55@gmail.com",
        "feedback_redirect_url": "https://beceptor.com/11254/feedback"
    },
    {
        "full_name": "Martha Jones",
        "email_id": "martha.jones66@gmail.com",
        "feedback_redirect_url": "https://beceptor.com/11256/feedback"
    }
]
EVAL_PARAMS = ["Algorithms", "Python", "Number Theory"]
INFORM_CANDIDATE = True
INFORM_INTERVIEWERS = True

payload = {
    "client_id": CLIENT_ID,
    "client_secret": CLIENT_SECRET,
    "title": TITLE,
    "start_datetime": START_DATETIME,
    "candidate_details": CANDIDATE_DETAILS,
    "interviewers": INTERVIEWERS,
    "eval_params": EVAL_PARAMS,
    "inform_candidate": INFORM_CANDIDATE,
    "inform_interviewers": INFORM_INTERVIEWERS
}
r = requests.post("https://api.hackerearth.com/partner/hackerearth/interviews/", data=json.dumps(payload))
print r.json()

Using cURL

curl --data '{
"client_id": "abcdefghijklm123456789nopqrstuvwxyz.api.hackerearth.com",
"client_secret": "abcdefghijklm123456789nopqrstuvwxyz",
"title": "Technical Interview",
"start_datetime": "2020-05-31T21:25:02+05:30",
"candidate_details": {
    "full_name": "Sergio Marquina",
    "email_id": "sergio.marquina@gmail.com",
    "contact_number": "919603329860"
},
"interviewers": [
    {
        "full_name": "John Smith",
        "email_id": "john.smith55@gmail.com",
        "feedback_redirect_url": "https://beceptor.com/11254/feedback"
    },
    {
        "full_name": "Martha Jones",
        "email_id": "martha.jones66@gmail.com",
        "feedback_redirect_url": "https://beceptor.com/11256/feedback"
    }
],
"eval_params": ["Algorithms", "Python", "Number Theory"],
"inform_candidate": true,
"inform_interviewers": true
}' https://api.hackerearth.com/partner/hackerearth/interviews/


Response

The response returned will be in the JSON format. A success response status code will be 201.

Sample response

{
    "mcode": ​"success"​ ,
    "message": ​"success"​ ,
    "ecode": [],
    "emessage": [],
    "interview_id": ​"49f6b922b2feee3be3ec79e88d6ff36"​ ,
    "candidate_interview_link": "https://www.hackerearth.com/interview/49f6b922b2feee3be3ec79e88d6ff36/login=43555lk5435lk35"​,
    "interviewer_interview_links": {
        "john.smith55@gmail.com": "https://www.hackerearth.com/interview/49f6b922b2feee3be3ec79e88d6ff36/login=43534lk5435lk35"​ ,
        "martha.jones66@gmail.com": "https://www.hackerearth.com/interview/49f6b922b2feee3be3ec79e88d6ff36/login=43534lk5435lk35"
    }
}

mcode

Type : String

Description: The message code abbreviated as mcode.

message

Type: String

Description: A message for user regarding the success of request.

The message and mcode attributes are related to each other according to the following table:

mcode message
SUCCESS Request successful
FAILED Request failed

ecode

Type: List

Description: The error codes are abbreviated as ecode.

emessage

Type: List

Description: It represents a message explaining the error that occurred during request processing.

The emessage and ecode attributes are related to each other according to the following table:

ecode emessage
AUTHFAILED Authentication Failed
ACCESSERROR You are not authorized to access this feature. Please contact support@hackerearth.com.
ARGMISSING Request argument missing.
BADDATA Invalid request data.
INVALIDEMAIL Invalid email(s) exist.
FACECODENOTAVAILABLE FaceCode feature is not available for your company.
BUYCREDITS You do not have sufficient credits to create interviews, please purchase more credits.
INTERVIEWERCANDIDATECONFLICT Interviewer and candidate cannot be the same.
DUPLICATEINTERVIEWER Multiple interviewers cannot have the same email ID.
MINONEINTERVIEWERREQUIRED You must add at least one interviewer.
MAXINTERVIEWERSLIMITCROSSED Maximum interviewers limit crossed.
MAXEVALPARAMSLIMITCROSSED Maximum eval params limit crossed.
RATELIMITEXCEEDED The rate at which the API requests are made has reached. Please try again after some time.

interview_id

Type: String

Description: interview_id will contain universally unique identifier (UUID) for the interview.

candidate_interview_link

Type: String

Description: candidate_interview_link will contain an auto-login interview url for the candidate.

interviewer_interview_links

Type: Dictionary (JSON)

Description: interviewer_interview_links will contain interviewers emails mapped to their auto-login interview urls.


Errors (Mishandled API responses)

If the client_id or client_secret attribute is incorrect, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "AUTHFAILED"
    ],
    "emessage": [
        "Authentication Failed"
    ],
    "mcode": "FAILED"
}

If user is not authorized to create an interview, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
        "ACCESSERROR"
    ],
    "emessage": [
        "You are not authorized to access this feature. Please contact support@hackerearth.com."
    ],
    "mcode": "FAILED"
}

If mandatory POST arguments are not provided, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
        "ARGMISSING"
    ],
    "emessage": [
        "Request argument missing: '<argument_name>'"
    ],
    "mcode": "FAILED"
}

If the provided data is invalid, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "BADDATA"
    ],
    "emessage": [
        "Invalid request data."
    ],
    "mcode": "FAILED"
}

If invalid email id provided, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "INVALIDEMAIL"
    ],
    "emessage": [
        "Invalid email(s) exist."
    ],
    "mcode": "FAILED"
}

If FaceCode feature is not enabled for your company account, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "FACECODENOTAVAILABLE"
    ],
    "emessage": [
        "FaceCode feature is not available for your company."
    ],
    "mcode": "FAILED"
}

If your company account does not have sufficient credits to create interviews, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "BUYCREDITS"
    ],
    "emessage": [
        "You do not have sufficient credits to create interviews, please purchase more credits."
    ],
    "mcode": "FAILED"
}

If the candidate's email ID is found matching with any of the interviewers email ID, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "INTERVIEWERCANDIDATECONFLICT"
    ],
    "emessage": [
        "Interviewer and candidate cannot be the same."
    ],
    "mcode": "FAILED"
}

If multiple interviewers are found having the same email ID, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "DUPLICATEINTERVIEWER"
    ],
    "emessage": [
        "Multiple interviewers cannot have the same email ID."
    ],
    "mcode": "FAILED"
}

If no interviewers details are provided, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "MINONEINTERVIEWERREQUIRED"
    ],
    "emessage": [
        "You must add at least one interviewer."
    ],
    "mcode": "FAILED"
}

If more than 5 interviewers details are provided, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "MAXINTERVIEWERSLIMITCROSSED"
    ],
    "emessage": [
        "Maximum interviewers limit crossed."
    ],
    "mcode": "FAILED"
}

If more than 10 evaluation parameters/criteria are provided, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
         "MAXEVALPARAMSLIMITCROSSED"
    ],
    "emessage": [
        "Maximum eval params limit crossed."
    ],
    "mcode": "FAILED"
}

If the rate (60 per min or 5000 per day) at which API requests are made by a specific user is reached, then the JSON response that is returned is as follows:

{
    "message": "Request failed",
    "ecode": [
        "RATELIMITEXCEEDED"
    ],
    "emessage": [
        "The rate at which the API requests are made has reached. Please try again after some time."
    ],
    "mcode": "FAILED"
}

If any other issue occurred do reach us out at api@hackerearth.com

Notifications
View All Notifications

?