API Reference

HackerRank for Work API client.

class hackerrank.client.InterviewsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for interview operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None, created_at: str | None = None, updated_at: str | None = None, ended_at: str | None = None, user: int | None = None, interviewers: int | None = None, access: str | None = None, current_status: int | None = None, order_by: str | None = None, order_dir: str | None = None) → Page[Interview]

List interviews.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • created_at – from..to filter for creation time.

  • updated_at – from..to filter for update time.

  • ended_at – from..to filter for ending time.

  • user – Filter by creator user ID.

  • interviewers – Filter by interviewer user ID.

  • access – Access filter (owned or shared).

  • current_status – Status filter (0 new, 1 active, 2 ended, 3 paused).

  • order_by – Sort key (title, id, created_at, ended_at, current_status, or user).

  • order_dir – Sort direction (asc or desc).

Returns:

A page of interviews.

create(*, title: str, from_: str | None = None, to: str | None = None, notes: str | None = None, resume_url: str | None = None, interviewers: list[str | Mapping[str, str]] | None = None, result_url: str | None = None, candidate: Mapping[str, JSONValue] | None = None, send_email: bool | None = None, metadata: Mapping[str, JSONValue] | None = None, interview_template_id: int | None = None, ai_assistant_available: bool | None = None) → Interview

Create an interview.

Not safe to retry: a lost response may still have created the interview, so a second attempt can leave a duplicate.

Parameters:
  • title – Title of the interview.

  • from – Scheduled start time.

  • to – Scheduled end time.

  • notes – Private notes.

  • resume_url – URL to the candidate resume.

  • interviewers – Interviewer emails or email/name objects.

  • result_url – URL invoked when the interview ends.

  • candidate – Candidate details.

  • send_email – Whether to send an email invite.

  • metadata – Arbitrary metadata.

  • interview_template_id – Template to apply.

  • ai_assistant_available – Whether the AI assistant is available for this interview.

Returns:

The created interview.

get(*, interview_id: str) → Interview

Retrieve an interview.

Parameters:

interview_id – The id of the interview.

Returns:

The interview.

update(*, interview_id: str, title: str, from_: str, to: str, notes: str, resume_url: str, result_url: str, candidate: Mapping[str, JSONValue], send_email: bool, metadata: Mapping[str, JSONValue], interview_template_id: int, interviewers: list[str] | list[Mapping[str, JSONValue]] | None = None, replace_interviewers: bool | None = None, ai_assistant_available: bool | None = None) → Interview

Update an interview.

Safe to retry: the request replaces the interview’s fields, so sending it twice has the same effect as sending it once.

Parameters:
  • interview_id – The id of the interview.

  • title – New title.

  • from – New start time.

  • to – New end time.

  • notes – New private notes.

  • resume_url – New resume URL.

  • interviewers – Interviewer emails, or objects with email / name. Used with replace_interviewers.

  • result_url – New result URL.

  • candidate – New candidate details.

  • send_email – Whether to send an email.

  • replace_interviewers – When True, replace the existing interviewer list with interviewers.

  • metadata – New metadata.

  • interview_template_id – New template id.

  • ai_assistant_available – Whether the AI assistant is available for this interview.

Returns:

The updated interview.

delete(*, interview_id: str) → None

Delete an interview.

Safe to retry: the interview is gone either way, though a repeat may report that it was not found.

Parameters:

interview_id – The id of the interview.

get_transcript(*, interview_id: str) → InterviewTranscript

Retrieve the transcript of an interview.

Parameters:

interview_id – The id of the interview.

Returns:

The transcript.

class hackerrank.client.ExplicitSharingRolesNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for interview-template explicit-sharing operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

update_access(*, template_id: int | str, explicit_roles: Sequence[Mapping[str, JSONValue]]) → None

Grant or change access to a template.

Safe to retry: the request replaces the given roles rather than adding to them.

Parameters:
  • template_id – The id of the template.

  • explicit_roles – The accesses to grant. Each item is a mapping with rollable_type ("user", "team" or "company"), role_name ("viewer" or "editor") and, unless the type is "company", rollable_id keys.

remove_access(*, template_id: int | str, explicit_roles: Sequence[Mapping[str, JSONValue]]) → None

Revoke access to a template.

Safe to retry: the roles are gone either way.

Parameters:
  • template_id – The id of the template.

  • explicit_roles – The accesses to revoke. Each item is a mapping with rollable_type ("user", "team" or "company") and, unless the type is "company", rollable_id keys.

class hackerrank.client.InterviewTemplatesNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for interview-template operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None, filter: str | None = None) → Page[InterviewTemplate]

List interview templates.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • filter – Ownership filter (owned or shared).

Returns:

A page of interview templates.

create(*, name: str, role_id: str | None = None, question_ids: Sequence[int] | None = None) → InterviewTemplate

Create an interview template.

Not safe to retry: a lost response may still have created the template, so a second attempt can leave a duplicate.

Parameters:
  • name – The template name.

  • role_id – Role unique id for the template.

  • question_ids – Question ids to add to the template.

Returns:

The created interview template.

get(*, template_id: int | str) → InterviewTemplate

Retrieve an interview template.

Parameters:

template_id – The id of the template.

Returns:

The template.

update(*, template_id: int | str, name: str | None = None, role_id: str | None = None, scorecard_id: int | None = None) → InterviewTemplate

Update an interview template.

Safe to retry: the request replaces the template’s fields.

Parameters:
  • template_id – The id of the template.

  • name – New name.

  • role_id – New role unique id.

  • scorecard_id – New scorecard id.

Returns:

The updated interview template.

delete(*, template_id: int | str) → None

Delete an interview template.

Safe to retry: the template is gone either way, though a repeat may report that it was not found.

Parameters:

template_id – The id of the template.

add_questions(*, template_id: int | str, question_ids: Sequence[int]) → InterviewTemplate

Add questions to an interview template.

Safe to retry: a question already on the template is not added twice.

Parameters:
  • template_id – The id of the template.

  • question_ids – The ids of the questions to add. Each must be accessible to the current user.

Returns:

The updated interview template.

remove_question(*, template_id: int | str, question_id: int) → InterviewTemplate

Remove a question from an interview template.

Safe to retry: the question is gone from the template either way.

Parameters:
  • template_id – The id of the template.

  • question_id – The id of the question to remove.

Returns:

The updated interview template.

class hackerrank.client.EnvironmentsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for project-question environment operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list() → list[Environment]

List project-question environments.

Returns:

The available environments.

get(*, environment_id: int) → Environment

Retrieve a project-question environment.

Parameters:

environment_id – The id of the environment.

Returns:

The environment.

class hackerrank.client.QuestionsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for question operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None, status: str | None = None, access: list[str] | None = None, difficulty: list[str] | None = None, type: list[str] | None = None, owner: list[str] | None = None, tags: list[str] | None = None, skills: list[str] | None = None, languages: list[str] | None = None) → Page[Question]

List questions.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • status – Question status (active or archived).

  • access – Access filter values (library, owned, and/or shared).

  • difficulty – Difficulty values (comma-separated).

  • type – Question types (comma-separated).

  • owner – Owning user IDs (comma-separated).

  • tags – Tags (comma-separated).

  • skills – Skills (comma-separated).

  • languages – Languages (comma-separated).

Returns:

A page of questions.

create(*, name: str, type: str, problem_statement: str, recommended_duration: int, internal_notes: str | None = None, languages: list[str] | None = None, tags: list[str] | None = None, options: list[str] | None = None, answer: int | list[int] | None = None, score: float | None = None, environment_id: int | None = None, role_type: str | None = None, scoring_command: str | None = None, scoring_files: list[str] | None = None, readonly_paths: list[str] | None = None, default_files: list[str] | None = None, configuration: Mapping[str, JSONValue] | None = None, testcases: list[Mapping[str, JSONValue]] | None = None) → Question

Create a question.

Not safe to retry: a lost response may still have created the question, and this API cannot delete questions, so a duplicate has to be removed by hand in the web interface.

Parameters:
  • name – Question name.

  • type – Question type (code, mcq, …).

  • internal_notes – Private notes.

  • languages – Supported languages.

  • problem_statement – Problem statement.

  • recommended_duration – Recommended duration.

  • tags – Tags.

  • options – MCQ options.

  • answer – Correct MCQ answer.

  • score – Maximum score for project questions.

  • environment_id – Environment id for a fullstack question.

  • role_type – Role type for a fullstack question.

  • scoring_command – Command used to score the submission.

  • scoring_files – Files that hold scoring tests.

  • readonly_paths – Paths the candidate cannot edit.

  • default_files – File paths opened by default.

  • configuration – Project configuration.

  • testcases – Project scoring test cases.

Returns:

The created question.

get(*, question_id: str) → Question

Retrieve a question.

Parameters:

question_id – The id of the question.

Returns:

The question.

update(*, question_id: str, name: str, type: str, internal_notes: str, languages: list[str], problem_statement: str, recommended_duration: int, tags: list[str], options: list[str], answer: int | list[int], score: float | None = None, environment_id: int | None = None, role_type: str | None = None, scoring_command: str | None = None, scoring_files: list[str] | None = None, readonly_paths: list[str] | None = None, default_files: list[str] | None = None, configuration: Mapping[str, JSONValue] | None = None, testcases: list[Mapping[str, JSONValue]] | None = None) → Question | None

Update a question.

Safe to retry: the request replaces the question’s fields.

Parameters:
  • question_id – The id of the question.

  • name – New name.

  • type – New question type.

  • internal_notes – New internal notes.

  • languages – New supported languages.

  • problem_statement – New problem statement.

  • recommended_duration – New recommended duration.

  • tags – New tags.

  • options – New MCQ options.

  • answer – New MCQ answer.

  • score – New maximum score.

  • environment_id – New environment id.

  • role_type – New role type.

  • scoring_command – New scoring command.

  • scoring_files – New scoring files.

  • readonly_paths – New read-only paths.

  • default_files – New default file paths.

  • configuration – Project configuration to merge.

  • testcases – New project scoring test cases.

Returns:

The updated question when returned by the API, otherwise None.

upload_project_directory(*, question_id: str, directory: Path) → dict[str, JSONValue]

Upload a prepared project directory for a fullstack question.

Safe to retry: uploading again replaces the project archive.

Parameters:
  • question_id – The id of the question.

  • directory – Directory containing the files to upload. All files, including hidden files, are included with relative paths. Prepare a staging directory to filter or transform files.

Returns:

The raw API response, including file_url and file_path.

Raises:
upload_project_zip(*, question_id: str, file: bytes | BinaryIO, filename: str = 'project.zip', content_type: str = 'application/zip') → dict[str, JSONValue]

Upload a project zip for a fullstack question.

Safe to retry: uploading again replaces the project archive.

Parameters:
  • question_id – The id of the question.

  • file – The zip file content or a binary file object.

  • filename – The multipart filename.

  • content_type – The multipart content type.

Returns:

The raw API response, including file_url and file_path.

update_codestubs(*, question_id: str, codestubs: Mapping[str, JSONValue]) → None

Update custom code-stubs for a question.

Safe to retry: the request replaces the custom code stubs.

Parameters:
  • question_id – The id of the question.

  • codestubs – A mapping describing the code-stubs.

generate_codestubs(*, question_id: str, body: Mapping[str, JSONValue]) → dict[str, JSONValue]

Generate code-stubs for a question.

Safe to retry: the request replaces the generated code stubs.

Parameters:
  • question_id – The id of the question.

  • body – The generation request body.

Returns:

The raw API response.

add_testcase(*, question_id: str, body: Mapping[str, JSONValue]) → dict[str, JSONValue]

Add a test case to a question.

Not safe to retry: each call appends another test case.

Parameters:
  • question_id – The id of the question.

  • body – The test-case payload.

Returns:

The raw API response.

update_testcase(*, question_id: str, testcase_id: str, body: Mapping[str, JSONValue]) → None

Update an existing test case.

Safe to retry: the request replaces the test case.

Parameters:
  • question_id – The id of the question.

  • testcase_id – The id of the test case.

  • body – The test-case payload.

delete_testcase(*, question_id: str, testcase_id: str) → None

Delete a single test case.

Safe to retry: the test case is gone either way, though a repeat may report that it was not found.

Parameters:
  • question_id – The id of the question.

  • testcase_id – The id of the test case.

delete_all_testcases(*, question_id: str) → None

Delete every test case on a question.

Safe to retry: the test cases are gone either way.

Parameters:

question_id – The id of the question.

class hackerrank.client.TestCandidatesNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for the candidates of a test.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, test_id: str, limit: int | None = None, offset: int | None = None) → Page[TestCandidate]

List candidates for a test.

Parameters:
  • test_id – The id of the test.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidates.

search(*, test_id: str, search: str, limit: int | None = None, offset: int | None = None) → Page[TestCandidate]

Search candidates within a test.

Parameters:
  • test_id – The id of the test.

  • search – Search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidates.

invite(*, test_id: str, email: str, full_name: str | None = None, ats_state: int | None = None, send_email: bool | None = None, evaluator_email: str | None = None, test_result_url: str | None = None, test_finish_url: str | None = None, tags: list[str] | None = None, invite_valid_from: str | None = None, invite_valid_to: str | None = None, force: bool | None = None, force_reattempt: bool | None = None, accommodations: Mapping[str, JSONValue] | None = None, invite_metadata: Mapping[str, JSONValue] | None = None, webhook_authentication: Mapping[str, JSONValue] | None = None, accept_result_updates: bool | None = None, subject: str | None = None, message: str | None = None, template: str | None = None) → CandidateInvite

Invite a candidate to a test.

Not safe to retry: each call invites the candidate again, which sends them another email.

Parameters:
  • test_id – The id of the test.

  • email – Candidate email address.

  • full_name – Candidate full name.

  • ats_state – Initial ATS application state (0 to 22).

  • send_email – Whether to send the invitation email.

  • evaluator_email – Evaluator email.

  • test_result_url – URL to which results are posted.

  • test_finish_url – URL the candidate sees on finish.

  • tags – Tags to set on the candidate.

  • invite_valid_from – Invitation start time.

  • invite_valid_to – Invitation end time.

  • force – Force inviting even if previously invited.

  • force_reattempt – Allow re-attempt.

  • accommodations – Accommodation settings.

  • invite_metadata – Arbitrary metadata.

  • webhook_authentication – Webhook auth config.

  • accept_result_updates – Accept result updates flag.

  • subject – Custom email subject.

  • message – Custom email message.

  • template – Email template id.

Returns:

The invitation result, including test_link.

get(*, test_id: str, candidate_id: str, additional_fields: str | None = None) → TestCandidate

Retrieve a single candidate.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • additional_fields – Comma-separated extra fields.

Returns:

The candidate.

update(*, test_id: str, candidate_id: str, full_name: str, ats_state: int, invite_valid_from: str, invite_valid_to: str, invite_metadata: Mapping[str, JSONValue], evaluator_email: str, test_finish_url: str, test_result_url: str, webhook_authentication: Mapping[str, JSONValue], accept_result_updates: bool, tags: list[str], accommodations: Mapping[str, JSONValue]) → TestCandidate

Update a candidate.

Safe to retry: the request replaces the candidate’s fields.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • full_name – New full name.

  • ats_state – New ATS state.

  • invite_valid_from – New invitation start time.

  • invite_valid_to – New invitation end time.

  • invite_metadata – New invite metadata.

  • evaluator_email – New evaluator email.

  • test_finish_url – New finish URL.

  • test_result_url – New result URL.

  • webhook_authentication – New webhook auth.

  • accept_result_updates – New flag value.

  • tags – New tags.

  • accommodations – New accommodations.

Returns:

The updated candidate.

cancel_invite(*, test_id: str, candidate_id: str) → None

Cancel a candidate’s invitation.

Safe to retry: the invite is gone either way.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

delete_report(*, test_id: str, candidate_id: str) → None

Delete the report for a candidate.

Safe to retry: the report is gone either way.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

get_report_pdf(*, test_id: str, candidate_id: str, format_: str = 'url') → dict[str, JSONValue]

Retrieve the PDF report for a candidate.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • format – Format of the PDF (e.g. "url").

Returns:

The raw API response. When format_ is "url" the response typically contains a URL for downloading the PDF.

class hackerrank.client.TestsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for test operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None) → Page[Test]

List tests.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of tests.

create(*, name: str, duration: int, role_ids: list[str], experience: list[str], starttime: str | None = None, endtime: str | None = None, instructions: str | None = None, locked: bool | None = None, draft: bool | None = None, languages: list[str] | None = None, candidate_details: list[str | Mapping[str, JSONValue]] | None = None, custom_acknowledge_text: str | None = None, cutoff_score: int | None = None, master_password: str | None = None, hide_compile_test: bool | None = None, tags: list[str] | None = None, questions: list[str] | None = None, mcq_incorrect_score: int | None = None, mcq_correct_score: int | None = None, shuffle_questions: bool | None = None, test_admins: list[str] | None = None, hide_template: bool | None = None, enable_acknowledgement: bool | None = None, enable_proctoring: bool | None = None, enable_advanced_proctoring: bool | None = None, enable_secure_assessment_mode: bool | None = None, enable_ml_plagiarism_analysis: bool | None = None, enable_photo_identification: bool | None = None, ide_config: str | None = None) → Test

Create a test.

Not safe to retry: a lost response may still have created the test, so a second attempt can leave a duplicate.

Parameters:
  • name – The name of the test.

  • starttime – Test start time.

  • endtime – Test end time.

  • duration – Test duration in minutes.

  • instructions – Test instructions.

  • locked – Whether the test is locked.

  • draft – Whether the test is a draft.

  • languages – Allowed programming languages.

  • candidate_details – Candidate detail field descriptors.

  • custom_acknowledge_text – Custom acknowledge text.

  • cutoff_score – The cut-off score.

  • master_password – Master password for the test.

  • hide_compile_test – Hide compile-test option.

  • tags – Tags applied to the test.

  • role_ids – Role ids associated with the test.

  • experience – Experience-level metadata.

  • questions – Question ids to include.

  • mcq_incorrect_score – Score for incorrect MCQ.

  • mcq_correct_score – Score for correct MCQ.

  • shuffle_questions – Whether to shuffle.

  • test_admins – Test admin user ids.

  • hide_template – Hide the template flag.

  • enable_acknowledgement – Enable acknowledgement.

  • enable_proctoring – Enable proctoring.

  • enable_advanced_proctoring – Advanced proctoring.

  • enable_secure_assessment_mode – Secure mode flag.

  • enable_ml_plagiarism_analysis – ML plagiarism.

  • enable_photo_identification – Photo ID flag.

  • ide_config – IDE configuration.

Returns:

The created test.

get(*, test_id: str, additional_fields: str | None = None) → Test

Retrieve a test.

Parameters:
  • test_id – The id of the test.

  • additional_fields – Comma-separated extra fields.

Returns:

The test.

update(*, test_id: str, body: TestsUpdate) → None

Update a test.

Safe to retry: the request replaces the test’s fields.

Parameters:
  • test_id – The id of the test.

  • body – The required update fields for a test.

delete(*, test_id: str) → None

Delete a test.

Safe to retry: the test is gone either way, though a repeat may report that it was not found.

Parameters:

test_id – The id of the test.

archive(*, test_id: str) → None

Archive a test.

Safe to retry: an archived test stays archived.

Parameters:

test_id – The id of the test.

list_inviters(*, test_id: str, limit: int | None = None, offset: int | None = None) → Page[Inviter]

List inviters for a test.

Parameters:
  • test_id – The id of the test.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of inviters.

class hackerrank.client.TemplatesNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for invite-email templates.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None, access: str | None = None) → Page[Template]

List invite templates.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • access – Access filter (owned or shared).

Returns:

A page of templates.

get(*, template_id: str) → Template

Retrieve an invite template.

Parameters:

template_id – The id of the template.

Returns:

The template.

class hackerrank.client.CandidatesNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for global candidate operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

search(*, query: str, limit: int | None = None, offset: int | None = None) → Page[CandidateSearchResult]

Search candidates across accessible tests.

Parameters:
  • query – Candidate name or email search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidate search results.

class hackerrank.client.UsersNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for user operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None) → Page[User]

List users.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of users.

search(*, search: str, limit: int | None = None, offset: int | None = None) → Page[User]

Search users.

Parameters:
  • search – Search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of users.

create(*, email: str, firstname: str, role: str, teams: list[str], lastname: str | None = None, country: str | None = None, send_email: bool | None = None, phone: str | None = None, questions_permission: int | None = None, tests_permission: int | None = None, interviews_permission: int | None = None, candidates_permission: int | None = None, shared_questions_permission: int | None = None, shared_tests_permission: int | None = None, shared_interviews_permission: int | None = None, shared_candidates_permission: int | None = None, company_admin: bool | None = None, team_admin: bool | None = None) → User

Create a user.

Not safe to retry: a lost response may still have created the user, so a second attempt can leave a duplicate.

Parameters:
  • email – Email address.

  • firstname – First name.

  • lastname – Last name.

  • country – Country.

  • role – Role.

  • send_email – Send invite email flag.

  • phone – Phone number.

  • questions_permission – Permission level.

  • tests_permission – Permission level.

  • interviews_permission – Permission level.

  • candidates_permission – Permission level.

  • shared_questions_permission – Permission level.

  • shared_tests_permission – Permission level.

  • shared_interviews_permission – Permission level.

  • shared_candidates_permission – Permission level.

  • company_admin – Company admin flag.

  • team_admin – Team admin flag.

  • teams – Team ids the user belongs to.

Returns:

The created user.

get(*, user_id: str) → User

Retrieve a user.

Parameters:

user_id – The id of the user.

Returns:

The user.

update(*, user_id: str, body: UserUpdate) → None

Update a user.

Safe to retry: the request replaces the user’s fields.

Parameters:
  • user_id – The id of the user.

  • body – The required update fields for a user.

delete(*, user_id: str) → None

Lock (deactivate) a user.

Safe to retry: the user is gone either way, though a repeat may report that it was not found.

Parameters:

user_id – The id of the user.

class hackerrank.client.TeamMembershipsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for user-team membership operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, team_id: str, limit: int | None = None, offset: int | None = None) → Page[UserTeamMembership]

List memberships for a team.

Parameters:
  • team_id – The id of the team.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of memberships.

get(*, team_id: str, user_id: str) → UserTeamMembership

Retrieve a single membership.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

Returns:

The membership.

create(*, team_id: str, user_id: str, license: str | None = None) → UserTeamMembership

Add a user to a team.

Not safe to retry: the API creates the membership rather than setting it, so a repeat may be rejected instead of being accepted as a no-op.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

  • license – License kind to assign.

Returns:

The created membership.

delete(*, team_id: str, user_id: str) → None

Remove a user from a team.

Safe to retry: the membership is gone either way.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

class hackerrank.client.TeamsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for team operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None) → Page[Team]

List teams.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of teams.

create(*, name: str, recruiter_cap: int | None = None, developer_cap: int | None = None, invite_as: str | None = None, locations: list[str] | None = None, departments: list[str] | None = None) → Team

Create a team.

Not safe to retry: a lost response may still have created the team, so a second attempt can leave a duplicate.

Parameters:
  • name – Team name.

  • recruiter_cap – Recruiter seat cap.

  • developer_cap – Developer seat cap.

  • invite_as – Default role for invites.

  • locations – Allowed locations.

  • departments – Allowed departments.

Returns:

The created team.

get(*, team_id: str) → Team

Retrieve a team.

Parameters:

team_id – The id of the team.

Returns:

The team.

update(*, team_id: str, name: str, recruiter_cap: int, developer_cap: int, invite_as: str, locations: list[str], departments: list[str]) → None

Update a team.

Safe to retry: the request replaces the team’s fields.

Parameters:
  • team_id – The id of the team.

  • name – New team name.

  • recruiter_cap – New recruiter seat cap.

  • developer_cap – New developer seat cap.

  • invite_as – New default invite role.

  • locations – New allowed locations.

  • departments – New allowed departments.

delete(*, team_id: str) → None

Delete a team.

Safe to retry: the team is gone either way, though a repeat may report that it was not found.

Parameters:

team_id – The id of the team.

class hackerrank.client.AuditLogsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for audit-log operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None, user_id: str | None = None) → Page[AuditLog]

List audit logs.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • user_id – Filter to a specific user.

Returns:

A page of audit logs.

class hackerrank.client.ATSCodePairNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for ATS Codepair operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

invite(*, title: str, requisition_id: str, candidate_id: str, candidate: Mapping[str, JSONValue] | None = None, send_email: bool | None = None, interview_metadata: Mapping[str, JSONValue] | None = None) → Interview

Invite a candidate to an ATS Codepair interview.

Not safe to retry: each call sends another interview invite.

Parameters:
  • title – The interview title.

  • requisition_id – The ATS requisition id.

  • candidate_id – The ATS candidate id.

  • candidate – Candidate information.

  • send_email – Whether to send an email.

  • interview_metadata – Arbitrary metadata.

Returns:

The created interview.

class hackerrank.client.ATSCodeScreenNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for ATS CodeScreen operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

invite(*, test_id: str, email: str, requisition_id: str, candidate_id: str, send_email: bool | None = None, test_result_url: str | None = None, webhook_authentication: Mapping[str, JSONValue] | None = None, accept_result_updates: bool | None = None, force: bool | None = None, force_reattempt_after: int | None = None, accommodations: Mapping[str, JSONValue] | None = None) → CandidateInvite

Invite a candidate to a CodeScreen test.

Not safe to retry: each call sends another test invite.

Parameters:
  • test_id – The test id.

  • email – Candidate email.

  • requisition_id – ATS requisition id.

  • candidate_id – ATS candidate id.

  • send_email – Whether to send an email.

  • test_result_url – URL for posting results.

  • webhook_authentication – Webhook auth config.

  • accept_result_updates – Accept-updates flag.

  • force – Force inviting flag.

  • force_reattempt_after – Seconds before re-attempt.

  • accommodations – Accommodation settings.

Returns:

The invitation result, including test_link.

class hackerrank.client.ATSNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for ATS operations.

Create the ATS namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

class hackerrank.client.SCIMUsersNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for SCIM v2 user operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None) → SCIMPage[SCIMUser]

List SCIM users.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of SCIM users.

create(*, body: Mapping[str, JSONValue]) → SCIMUser

Create a SCIM user.

Not safe to retry: a lost response may still have created the user, so a second attempt can leave a duplicate.

Parameters:

body – The SCIM user payload.

Returns:

The created SCIM user.

get(*, scim_user_id: str) → SCIMUser

Retrieve a SCIM user.

Parameters:

scim_user_id – The id of the SCIM user.

Returns:

The SCIM user.

replace(*, scim_user_id: str, body: Mapping[str, JSONValue]) → SCIMUser

Replace a SCIM user (PUT).

Safe to retry: the request replaces the whole user.

Parameters:
  • scim_user_id – The id of the SCIM user.

  • body – The full SCIM user payload.

Returns:

The updated SCIM user.

patch(*, scim_user_id: str, operations: Sequence[Mapping[str, JSONValue]]) → SCIMMessage

Patch a SCIM user.

Not safe to retry: an operation such as add on a multi-valued attribute applies again on a second attempt.

Parameters:
  • scim_user_id – The id of the SCIM user.

  • operations – The SCIM patch operations.

Returns:

The SCIM patch acknowledgement message.

delete(*, scim_user_id: str) → None

Lock a SCIM user.

Safe to retry: the user is gone either way, though a repeat may report that it was not found.

Parameters:

scim_user_id – The id of the SCIM user.

class hackerrank.client.SCIMGroupsNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for SCIM v2 group (team) operations.

Create a new namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

list(*, limit: int | None = None, offset: int | None = None) → SCIMPage[SCIMTeam]

List SCIM groups.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of SCIM teams.

create(*, body: Mapping[str, JSONValue]) → SCIMTeam

Create a SCIM group.

Not safe to retry: a lost response may still have created the group, so a second attempt can leave a duplicate.

Parameters:

body – The SCIM group payload.

Returns:

The created SCIM team.

get(*, scim_group_id: str) → SCIMTeam

Retrieve a SCIM group.

Parameters:

scim_group_id – The id of the SCIM group.

Returns:

The SCIM team.

patch(*, scim_group_id: str, operations: Sequence[Mapping[str, JSONValue]]) → SCIMMessage

Patch a SCIM group.

Not safe to retry: an operation such as add on a multi-valued attribute applies again on a second attempt.

Parameters:
  • scim_group_id – The id of the SCIM group.

  • operations – The SCIM patch operations.

Returns:

The SCIM patch acknowledgement message.

delete(*, scim_group_id: str) → None

Deprovision a SCIM group.

Safe to retry: the group is gone either way, though a repeat may report that it was not found.

Parameters:

scim_group_id – The id of the SCIM group.

class hackerrank.client.SCIMNamespace(*, transport: Transport, base_url: str, headers: dict[str, str], retries: int)

Namespace for SCIM v2 operations.

Create the SCIM namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

class hackerrank.client.HackerRank(*, api_key: str, base_url: str = 'https://www.hackerrank.com', scim_base_url: str = 'https://services.hackerrank.com/scim/v2', transport: Transport | None = None, retries: int = 0)

A client for the HackerRank for Work API.

Create a new HackerRank client.

Parameters:
  • api_key – The API key for authentication.

  • base_url – The base URL for the v3 API.

  • scim_base_url – The base URL for the SCIM v2 API. This is a different host from base_url; the two APIs cannot share a base URL.

  • transport – The HTTP transport. Defaults to HTTPXTransport().

  • retries – The number of times to retry a request which is safe to repeat, after a transport error or a 429, 500, 502, 503 or 504 response. Defaults to 0, which never retries. GET, PUT and DELETE requests are safe to repeat, as are the POST endpoints which replace state rather than create it. Endpoints which create a record are never repeated, because a lost response does not mean that the record was not created. Each method’s own docstring says whether it is safe to retry. Each retry is logged as a warning on the hackerrank logger.

base_url: str
scim_base_url: str
close() → None

Close the underlying transport if it supports closing.

Async HackerRank for Work API client.

class hackerrank.async_client.AsyncInterviewsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for interview operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None, created_at: str | None = None, updated_at: str | None = None, ended_at: str | None = None, user: int | None = None, interviewers: int | None = None, access: str | None = None, current_status: int | None = None, order_by: str | None = None, order_dir: str | None = None) → Page[Interview]

List interviews.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • created_at – from..to filter for creation time.

  • updated_at – from..to filter for update time.

  • ended_at – from..to filter for ending time.

  • user – Filter by creator user ID.

  • interviewers – Filter by interviewer user ID.

  • access – Access filter (owned or shared).

  • current_status – Status filter (0 new, 1 active, 2 ended, 3 paused).

  • order_by – Sort key (title, id, created_at, ended_at, current_status, or user).

  • order_dir – Sort direction (asc or desc).

Returns:

A page of interviews.

async create(*, title: str, from_: str | None = None, to: str | None = None, notes: str | None = None, resume_url: str | None = None, interviewers: list[str | Mapping[str, str]] | None = None, result_url: str | None = None, candidate: Mapping[str, JSONValue] | None = None, send_email: bool | None = None, metadata: Mapping[str, JSONValue] | None = None, interview_template_id: int | None = None, ai_assistant_available: bool | None = None) → Interview

Create an interview.

Not safe to retry: a lost response may still have created the interview, so a second attempt can leave a duplicate.

Parameters:
  • title – Title of the interview.

  • from – Scheduled start time.

  • to – Scheduled end time.

  • notes – Private notes.

  • resume_url – URL to the candidate resume.

  • interviewers – Interviewer emails or email/name objects.

  • result_url – URL invoked when the interview ends.

  • candidate – Candidate details.

  • send_email – Whether to send an email invite.

  • metadata – Arbitrary metadata.

  • interview_template_id – Template to apply.

  • ai_assistant_available – Whether the AI assistant is available for this interview.

Returns:

The created interview.

async get(*, interview_id: str) → Interview

Retrieve an interview.

Parameters:

interview_id – The id of the interview.

Returns:

The interview.

async update(*, interview_id: str, title: str, from_: str, to: str, notes: str, resume_url: str, result_url: str, candidate: Mapping[str, JSONValue], send_email: bool, metadata: Mapping[str, JSONValue], interview_template_id: int, interviewers: list[str] | list[Mapping[str, JSONValue]] | None = None, replace_interviewers: bool | None = None, ai_assistant_available: bool | None = None) → Interview

Update an interview.

Safe to retry: the request replaces the interview’s fields, so sending it twice has the same effect as sending it once.

Parameters:
  • interview_id – The id of the interview.

  • title – New title.

  • from – New start time.

  • to – New end time.

  • notes – New private notes.

  • resume_url – New resume URL.

  • interviewers – Interviewer emails, or objects with email / name. Used with replace_interviewers.

  • result_url – New result URL.

  • candidate – New candidate details.

  • send_email – Whether to send an email.

  • replace_interviewers – When True, replace the existing interviewer list with interviewers.

  • metadata – New metadata.

  • interview_template_id – New template id.

  • ai_assistant_available – Whether the AI assistant is available for this interview.

Returns:

The updated interview.

async delete(*, interview_id: str) → None

Delete an interview.

Safe to retry: the interview is gone either way, though a repeat may report that it was not found.

Parameters:

interview_id – The id of the interview.

async get_transcript(*, interview_id: str) → InterviewTranscript

Retrieve the transcript of an interview.

Parameters:

interview_id – The id of the interview.

Returns:

The transcript.

class hackerrank.async_client.AsyncExplicitSharingRolesNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for interview-template explicit sharing.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async update_access(*, template_id: int | str, explicit_roles: Sequence[Mapping[str, JSONValue]]) → None

Grant or change access to a template.

Safe to retry: the request replaces the given roles rather than adding to them.

Parameters:
  • template_id – The id of the template.

  • explicit_roles – The accesses to grant. Each item is a mapping with rollable_type ("user", "team" or "company"), role_name ("viewer" or "editor") and, unless the type is "company", rollable_id keys.

async remove_access(*, template_id: int | str, explicit_roles: Sequence[Mapping[str, JSONValue]]) → None

Revoke access to a template.

Safe to retry: the roles are gone either way.

Parameters:
  • template_id – The id of the template.

  • explicit_roles – The accesses to revoke. Each item is a mapping with rollable_type ("user", "team" or "company") and, unless the type is "company", rollable_id keys.

class hackerrank.async_client.AsyncInterviewTemplatesNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for interview-template operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None, filter: str | None = None) → Page[InterviewTemplate]

List interview templates.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • filter – Ownership filter (owned or shared).

Returns:

A page of interview templates.

async create(*, name: str, role_id: str | None = None, question_ids: Sequence[int] | None = None) → InterviewTemplate

Create an interview template.

Not safe to retry: a lost response may still have created the template, so a second attempt can leave a duplicate.

Parameters:
  • name – The template name.

  • role_id – Role unique id for the template.

  • question_ids – Question ids to add to the template.

Returns:

The created interview template.

async get(*, template_id: int | str) → InterviewTemplate

Retrieve an interview template.

Parameters:

template_id – The id of the template.

Returns:

The template.

async update(*, template_id: int | str, name: str | None = None, role_id: str | None = None, scorecard_id: int | None = None) → InterviewTemplate

Update an interview template.

Safe to retry: the request replaces the template’s fields.

Parameters:
  • template_id – The id of the template.

  • name – New name.

  • role_id – New role unique id.

  • scorecard_id – New scorecard id.

Returns:

The updated interview template.

async delete(*, template_id: int | str) → None

Delete an interview template.

Safe to retry: the template is gone either way, though a repeat may report that it was not found.

Parameters:

template_id – The id of the template.

async add_questions(*, template_id: int | str, question_ids: Sequence[int]) → InterviewTemplate

Add questions to an interview template.

Safe to retry: a question already on the template is not added twice.

Parameters:
  • template_id – The id of the template.

  • question_ids – The ids of the questions to add. Each must be accessible to the current user.

Returns:

The updated interview template.

async remove_question(*, template_id: int | str, question_id: int) → InterviewTemplate

Remove a question from an interview template.

Safe to retry: the question is gone from the template either way.

Parameters:
  • template_id – The id of the template.

  • question_id – The id of the question to remove.

Returns:

The updated interview template.

class hackerrank.async_client.AsyncEnvironmentsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for project-question environment operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list() → list[Environment]

List project-question environments.

Returns:

The available environments.

async get(*, environment_id: int) → Environment

Retrieve a project-question environment.

Parameters:

environment_id – The id of the environment.

Returns:

The environment.

class hackerrank.async_client.AsyncQuestionsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for question operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None, status: str | None = None, access: list[str] | None = None, difficulty: list[str] | None = None, type: list[str] | None = None, owner: list[str] | None = None, tags: list[str] | None = None, skills: list[str] | None = None, languages: list[str] | None = None) → Page[Question]

List questions.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • status – Question status (active or archived).

  • access – Access filter values (library, owned, and/or shared).

  • difficulty – Difficulty values (comma-separated).

  • type – Question types (comma-separated).

  • owner – Owning user IDs (comma-separated).

  • tags – Tags (comma-separated).

  • skills – Skills (comma-separated).

  • languages – Languages (comma-separated).

Returns:

A page of questions.

async get(*, question_id: str) → Question

Retrieve a question.

Parameters:

question_id – The id of the question.

Returns:

The question.

async create(*, name: str, type: str, problem_statement: str, recommended_duration: int, internal_notes: str | None = None, languages: list[str] | None = None, tags: list[str] | None = None, options: list[str] | None = None, answer: int | list[int] | None = None, score: float | None = None, environment_id: int | None = None, role_type: str | None = None, scoring_command: str | None = None, scoring_files: list[str] | None = None, readonly_paths: list[str] | None = None, default_files: list[str] | None = None, configuration: Mapping[str, JSONValue] | None = None, testcases: list[Mapping[str, JSONValue]] | None = None) → Question

Create a question.

Not safe to retry: a lost response may still have created the question, and this API cannot delete questions, so a duplicate has to be removed by hand in the web interface.

Parameters:
  • name – Question name.

  • type – Question type (code, mcq, …).

  • internal_notes – Private notes.

  • languages – Supported languages.

  • problem_statement – Problem statement.

  • recommended_duration – Recommended duration.

  • tags – Tags.

  • options – MCQ options.

  • answer – Correct MCQ answer.

  • score – Maximum score for project questions.

  • environment_id – Environment id for a fullstack question.

  • role_type – Role type for a fullstack question.

  • scoring_command – Command used to score the submission.

  • scoring_files – Files that hold scoring tests.

  • readonly_paths – Paths the candidate cannot edit.

  • default_files – File paths opened by default.

  • configuration – Project configuration.

  • testcases – Project scoring test cases.

Returns:

The created question.

async update(*, question_id: str, name: str, type: str, internal_notes: str, languages: list[str], problem_statement: str, recommended_duration: int, tags: list[str], options: list[str], answer: int | list[int], score: float | None = None, environment_id: int | None = None, role_type: str | None = None, scoring_command: str | None = None, scoring_files: list[str] | None = None, readonly_paths: list[str] | None = None, default_files: list[str] | None = None, configuration: Mapping[str, JSONValue] | None = None, testcases: list[Mapping[str, JSONValue]] | None = None) → Question | None

Update a question.

Safe to retry: the request replaces the question’s fields.

Parameters:
  • question_id – The id of the question.

  • name – New name.

  • type – New question type.

  • internal_notes – New internal notes.

  • languages – New supported languages.

  • problem_statement – New problem statement.

  • recommended_duration – New recommended duration.

  • tags – New tags.

  • options – New MCQ options.

  • answer – New MCQ answer.

  • score – New maximum score.

  • environment_id – New environment id.

  • role_type – New role type.

  • scoring_command – New scoring command.

  • scoring_files – New scoring files.

  • readonly_paths – New read-only paths.

  • default_files – New default file paths.

  • configuration – Project configuration to merge.

  • testcases – New project scoring test cases.

Returns:

The updated question when returned by the API, otherwise None.

async upload_project_directory(*, question_id: str, directory: Path) → dict[str, JSONValue]

Upload a prepared project directory for a fullstack question.

File operations and compression run in a worker thread.

Safe to retry: uploading again replaces the project archive.

Parameters:
  • question_id – The id of the question.

  • directory – Directory containing the files to upload. All files, including hidden files, are included with relative paths. Prepare a staging directory to filter or transform files.

Returns:

The raw API response, including file_url and file_path.

Raises:
async upload_project_zip(*, question_id: str, file: bytes | BinaryIO, filename: str = 'project.zip', content_type: str = 'application/zip') → dict[str, JSONValue]

Upload a project zip for a fullstack question.

Safe to retry: uploading again replaces the project archive.

Parameters:
  • question_id – The id of the question.

  • file – The zip file content or a binary file object.

  • filename – The multipart filename.

  • content_type – The multipart content type.

Returns:

The raw API response, including file_url and file_path.

async update_codestubs(*, question_id: str, codestubs: Mapping[str, JSONValue]) → None

Update custom code-stubs for a question.

Safe to retry: the request replaces the custom code stubs.

Parameters:
  • question_id – The id of the question.

  • codestubs – A mapping describing the code-stubs.

async generate_codestubs(*, question_id: str, body: Mapping[str, JSONValue]) → dict[str, JSONValue]

Generate code-stubs for a question.

Safe to retry: the request replaces the generated code stubs.

Parameters:
  • question_id – The id of the question.

  • body – The generation request body.

Returns:

The raw API response.

async add_testcase(*, question_id: str, body: Mapping[str, JSONValue]) → dict[str, JSONValue]

Add a test case to a question.

Not safe to retry: each call appends another test case.

Parameters:
  • question_id – The id of the question.

  • body – The test-case payload.

Returns:

The raw API response.

async update_testcase(*, question_id: str, testcase_id: str, body: Mapping[str, JSONValue]) → None

Update an existing test case.

Safe to retry: the request replaces the test case.

Parameters:
  • question_id – The id of the question.

  • testcase_id – The id of the test case.

  • body – The test-case payload.

async delete_testcase(*, question_id: str, testcase_id: str) → None

Delete a single test case.

Safe to retry: the test case is gone either way, though a repeat may report that it was not found.

Parameters:
  • question_id – The id of the question.

  • testcase_id – The id of the test case.

async delete_all_testcases(*, question_id: str) → None

Delete every test case on a question.

Safe to retry: the test cases are gone either way.

Parameters:

question_id – The id of the question.

class hackerrank.async_client.AsyncTestCandidatesNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for candidates of a test.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, test_id: str, limit: int | None = None, offset: int | None = None) → Page[TestCandidate]

List candidates for a test.

Parameters:
  • test_id – The id of the test.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidates.

async search(*, test_id: str, search: str, limit: int | None = None, offset: int | None = None) → Page[TestCandidate]

Search candidates within a test.

Parameters:
  • test_id – The id of the test.

  • search – Search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidates.

async invite(*, test_id: str, email: str, full_name: str | None = None, ats_state: int | None = None, send_email: bool | None = None, evaluator_email: str | None = None, test_result_url: str | None = None, test_finish_url: str | None = None, tags: list[str] | None = None, invite_valid_from: str | None = None, invite_valid_to: str | None = None, force: bool | None = None, force_reattempt: bool | None = None, accommodations: Mapping[str, JSONValue] | None = None, invite_metadata: Mapping[str, JSONValue] | None = None, webhook_authentication: Mapping[str, JSONValue] | None = None, accept_result_updates: bool | None = None, subject: str | None = None, message: str | None = None, template: str | None = None) → CandidateInvite

Invite a candidate to a test.

Not safe to retry: each call invites the candidate again, which sends them another email.

Parameters:
  • test_id – The id of the test.

  • email – Candidate email address.

  • full_name – Candidate full name.

  • ats_state – Initial ATS application state (0 to 22).

  • send_email – Whether to send the invitation email.

  • evaluator_email – Evaluator email.

  • test_result_url – URL to which results are posted.

  • test_finish_url – URL the candidate sees on finish.

  • tags – Tags to set on the candidate.

  • invite_valid_from – Invitation start time.

  • invite_valid_to – Invitation end time.

  • force – Force inviting even if previously invited.

  • force_reattempt – Allow re-attempt.

  • accommodations – Accommodation settings.

  • invite_metadata – Arbitrary metadata.

  • webhook_authentication – Webhook auth config.

  • accept_result_updates – Accept result updates flag.

  • subject – Custom email subject.

  • message – Custom email message.

  • template – Email template id.

Returns:

The invitation result, including test_link.

async get(*, test_id: str, candidate_id: str, additional_fields: str | None = None) → TestCandidate

Retrieve a single candidate.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • additional_fields – Comma-separated extra fields.

Returns:

The candidate.

async update(*, test_id: str, candidate_id: str, full_name: str, ats_state: int, invite_valid_from: str, invite_valid_to: str, invite_metadata: Mapping[str, JSONValue], evaluator_email: str, test_finish_url: str, test_result_url: str, webhook_authentication: Mapping[str, JSONValue], accept_result_updates: bool, tags: list[str], accommodations: Mapping[str, JSONValue]) → TestCandidate

Update a candidate.

Safe to retry: the request replaces the candidate’s fields.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • full_name – New full name.

  • ats_state – New ATS state.

  • invite_valid_from – New invitation start time.

  • invite_valid_to – New invitation end time.

  • invite_metadata – New invite metadata.

  • evaluator_email – New evaluator email.

  • test_finish_url – New finish URL.

  • test_result_url – New result URL.

  • webhook_authentication – New webhook auth.

  • accept_result_updates – New flag value.

  • tags – New tags.

  • accommodations – New accommodations.

Returns:

The updated candidate.

async cancel_invite(*, test_id: str, candidate_id: str) → None

Cancel a candidate’s invitation.

Safe to retry: the invite is gone either way.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

async delete_report(*, test_id: str, candidate_id: str) → None

Delete the report for a candidate.

Safe to retry: the report is gone either way.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

async get_report_pdf(*, test_id: str, candidate_id: str, format_: str = 'url') → dict[str, JSONValue]

Retrieve the PDF report for a candidate.

Parameters:
  • test_id – The id of the test.

  • candidate_id – The id of the candidate.

  • format – Format of the PDF (e.g. "url").

Returns:

The raw API response. When format_ is "url" the response typically contains a URL for downloading the PDF.

class hackerrank.async_client.AsyncTestsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for test operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None) → Page[Test]

List tests.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of tests.

async create(*, name: str, duration: int, role_ids: list[str], experience: list[str], starttime: str | None = None, endtime: str | None = None, instructions: str | None = None, locked: bool | None = None, draft: bool | None = None, languages: list[str] | None = None, candidate_details: list[str | Mapping[str, JSONValue]] | None = None, custom_acknowledge_text: str | None = None, cutoff_score: int | None = None, master_password: str | None = None, hide_compile_test: bool | None = None, tags: list[str] | None = None, questions: list[str] | None = None, mcq_incorrect_score: int | None = None, mcq_correct_score: int | None = None, shuffle_questions: bool | None = None, test_admins: list[str] | None = None, hide_template: bool | None = None, enable_acknowledgement: bool | None = None, enable_proctoring: bool | None = None, enable_advanced_proctoring: bool | None = None, enable_secure_assessment_mode: bool | None = None, enable_ml_plagiarism_analysis: bool | None = None, enable_photo_identification: bool | None = None, ide_config: str | None = None) → Test

Create a test.

Not safe to retry: a lost response may still have created the test, so a second attempt can leave a duplicate.

Parameters:
  • name – The name of the test.

  • starttime – Test start time.

  • endtime – Test end time.

  • duration – Test duration in minutes.

  • instructions – Test instructions.

  • locked – Whether the test is locked.

  • draft – Whether the test is a draft.

  • languages – Allowed programming languages.

  • candidate_details – Candidate detail field descriptors.

  • custom_acknowledge_text – Custom acknowledge text.

  • cutoff_score – The cut-off score.

  • master_password – Master password for the test.

  • hide_compile_test – Hide compile-test option.

  • tags – Tags applied to the test.

  • role_ids – Role ids associated with the test.

  • experience – Experience-level metadata.

  • questions – Question ids to include.

  • mcq_incorrect_score – Score for incorrect MCQ.

  • mcq_correct_score – Score for correct MCQ.

  • shuffle_questions – Whether to shuffle.

  • test_admins – Test admin user ids.

  • hide_template – Hide the template flag.

  • enable_acknowledgement – Enable acknowledgement.

  • enable_proctoring – Enable proctoring.

  • enable_advanced_proctoring – Advanced proctoring.

  • enable_secure_assessment_mode – Secure mode flag.

  • enable_ml_plagiarism_analysis – ML plagiarism.

  • enable_photo_identification – Photo ID flag.

  • ide_config – IDE configuration.

Returns:

The created test.

async get(*, test_id: str, additional_fields: str | None = None) → Test

Retrieve a test.

Parameters:
  • test_id – The id of the test.

  • additional_fields – Comma-separated extra fields.

Returns:

The test.

async update(*, test_id: str, body: TestsUpdate) → None

Update a test.

Safe to retry: the request replaces the test’s fields.

Parameters:
  • test_id – The id of the test.

  • body – The required update fields for a test.

async delete(*, test_id: str) → None

Delete a test.

Safe to retry: the test is gone either way, though a repeat may report that it was not found.

Parameters:

test_id – The id of the test.

async archive(*, test_id: str) → None

Archive a test.

Safe to retry: an archived test stays archived.

Parameters:

test_id – The id of the test.

async list_inviters(*, test_id: str, limit: int | None = None, offset: int | None = None) → Page[Inviter]

List inviters for a test.

Parameters:
  • test_id – The id of the test.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of inviters.

class hackerrank.async_client.AsyncTemplatesNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for invite-email templates.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None, access: str | None = None) → Page[Template]

List invite templates.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • access – Access filter (owned or shared).

Returns:

A page of templates.

async get(*, template_id: str) → Template

Retrieve an invite template.

Parameters:

template_id – The id of the template.

Returns:

The template.

class hackerrank.async_client.AsyncCandidatesNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for global candidate operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async search(*, query: str, limit: int | None = None, offset: int | None = None) → Page[CandidateSearchResult]

Search candidates across accessible tests.

Parameters:
  • query – Candidate name or email search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of candidate search results.

class hackerrank.async_client.AsyncUsersNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for user operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None) → Page[User]

List users.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of users.

async search(*, search: str, limit: int | None = None, offset: int | None = None) → Page[User]

Search users.

Parameters:
  • search – Search query.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of users.

async create(*, email: str, firstname: str, role: str, teams: list[str], lastname: str | None = None, country: str | None = None, send_email: bool | None = None, phone: str | None = None, questions_permission: int | None = None, tests_permission: int | None = None, interviews_permission: int | None = None, candidates_permission: int | None = None, shared_questions_permission: int | None = None, shared_tests_permission: int | None = None, shared_interviews_permission: int | None = None, shared_candidates_permission: int | None = None, company_admin: bool | None = None, team_admin: bool | None = None) → User

Create a user.

Not safe to retry: a lost response may still have created the user, so a second attempt can leave a duplicate.

Parameters:
  • email – Email address.

  • firstname – First name.

  • lastname – Last name.

  • country – Country.

  • role – Role.

  • send_email – Send invite email flag.

  • phone – Phone number.

  • questions_permission – Permission level.

  • tests_permission – Permission level.

  • interviews_permission – Permission level.

  • candidates_permission – Permission level.

  • shared_questions_permission – Permission level.

  • shared_tests_permission – Permission level.

  • shared_interviews_permission – Permission level.

  • shared_candidates_permission – Permission level.

  • company_admin – Company admin flag.

  • team_admin – Team admin flag.

  • teams – Team ids the user belongs to.

Returns:

The created user.

async get(*, user_id: str) → User

Retrieve a user.

Parameters:

user_id – The id of the user.

Returns:

The user.

async update(*, user_id: str, body: UserUpdate) → None

Update a user.

Safe to retry: the request replaces the user’s fields.

Parameters:
  • user_id – The id of the user.

  • body – The required update fields for a user.

async delete(*, user_id: str) → None

Lock (deactivate) a user.

Safe to retry: the user is gone either way, though a repeat may report that it was not found.

Parameters:

user_id – The id of the user.

class hackerrank.async_client.AsyncTeamMembershipsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for user-team membership operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, team_id: str, limit: int | None = None, offset: int | None = None) → Page[UserTeamMembership]

List memberships for a team.

Parameters:
  • team_id – The id of the team.

  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of memberships.

async get(*, team_id: str, user_id: str) → UserTeamMembership

Retrieve a single membership.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

Returns:

The membership.

async create(*, team_id: str, user_id: str, license: str | None = None) → UserTeamMembership

Add a user to a team.

Not safe to retry: the API creates the membership rather than setting it, so a repeat may be rejected instead of being accepted as a no-op.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

  • license – License kind to assign.

Returns:

The created membership.

async delete(*, team_id: str, user_id: str) → None

Remove a user from a team.

Safe to retry: the membership is gone either way.

Parameters:
  • team_id – The id of the team.

  • user_id – The id of the user.

class hackerrank.async_client.AsyncTeamsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for team operations.

Create the namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None) → Page[Team]

List teams.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of teams.

async create(*, name: str, recruiter_cap: int | None = None, developer_cap: int | None = None, invite_as: str | None = None, locations: list[str] | None = None, departments: list[str] | None = None) → Team

Create a team.

Not safe to retry: a lost response may still have created the team, so a second attempt can leave a duplicate.

Parameters:
  • name – Team name.

  • recruiter_cap – Recruiter seat cap.

  • developer_cap – Developer seat cap.

  • invite_as – Default role for invites.

  • locations – Allowed locations.

  • departments – Allowed departments.

Returns:

The created team.

async get(*, team_id: str) → Team

Retrieve a team.

Parameters:

team_id – The id of the team.

Returns:

The team.

async update(*, team_id: str, name: str, recruiter_cap: int, developer_cap: int, invite_as: str, locations: list[str], departments: list[str]) → None

Update a team.

Safe to retry: the request replaces the team’s fields.

Parameters:
  • team_id – The id of the team.

  • name – New team name.

  • recruiter_cap – New recruiter seat cap.

  • developer_cap – New developer seat cap.

  • invite_as – New default invite role.

  • locations – New allowed locations.

  • departments – New allowed departments.

async delete(*, team_id: str) → None

Delete a team.

Safe to retry: the team is gone either way, though a repeat may report that it was not found.

Parameters:

team_id – The id of the team.

class hackerrank.async_client.AsyncAuditLogsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for audit-log operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None, user_id: str | None = None) → Page[AuditLog]

List audit logs.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

  • user_id – Filter to a specific user.

Returns:

A page of audit logs.

class hackerrank.async_client.AsyncATSCodePairNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for ATS Codepair operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async invite(*, title: str, requisition_id: str, candidate_id: str, candidate: Mapping[str, JSONValue] | None = None, send_email: bool | None = None, interview_metadata: Mapping[str, JSONValue] | None = None) → Interview

Invite a candidate to an ATS Codepair interview.

Not safe to retry: each call sends another interview invite.

Parameters:
  • title – The interview title.

  • requisition_id – The ATS requisition id.

  • candidate_id – The ATS candidate id.

  • candidate – Candidate information.

  • send_email – Whether to send an email.

  • interview_metadata – Arbitrary metadata.

Returns:

The created interview.

class hackerrank.async_client.AsyncATSCodeScreenNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for ATS CodeScreen operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async invite(*, test_id: str, email: str, requisition_id: str, candidate_id: str, send_email: bool | None = None, test_result_url: str | None = None, webhook_authentication: Mapping[str, JSONValue] | None = None, accept_result_updates: bool | None = None, force: bool | None = None, force_reattempt_after: int | None = None, accommodations: Mapping[str, JSONValue] | None = None) → CandidateInvite

Invite a candidate to a CodeScreen test.

Not safe to retry: each call sends another test invite.

Parameters:
  • test_id – The test id.

  • email – Candidate email.

  • requisition_id – ATS requisition id.

  • candidate_id – ATS candidate id.

  • send_email – Whether to send an email.

  • test_result_url – URL for posting results.

  • webhook_authentication – Webhook auth config.

  • accept_result_updates – Accept-updates flag.

  • force – Force inviting flag.

  • force_reattempt_after – Seconds before re-attempt.

  • accommodations – Accommodation settings.

Returns:

The invitation result, including test_link.

class hackerrank.async_client.AsyncATSNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for ATS operations.

Create the ATS namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

class hackerrank.async_client.AsyncSCIMUsersNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for SCIM v2 user operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None) → SCIMPage[SCIMUser]

List SCIM users.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of SCIM users.

async create(*, body: Mapping[str, JSONValue]) → SCIMUser

Create a SCIM user.

Not safe to retry: a lost response may still have created the user, so a second attempt can leave a duplicate.

Parameters:

body – The SCIM user payload.

Returns:

The created SCIM user.

async get(*, scim_user_id: str) → SCIMUser

Retrieve a SCIM user.

Parameters:

scim_user_id – The id of the SCIM user.

Returns:

The SCIM user.

async replace(*, scim_user_id: str, body: Mapping[str, JSONValue]) → SCIMUser

Replace a SCIM user (PUT).

Safe to retry: the request replaces the whole user.

Parameters:
  • scim_user_id – The id of the SCIM user.

  • body – The full SCIM user payload.

Returns:

The updated SCIM user.

async patch(*, scim_user_id: str, operations: Sequence[Mapping[str, JSONValue]]) → SCIMMessage

Patch a SCIM user.

Not safe to retry: an operation such as add on a multi-valued attribute applies again on a second attempt.

Parameters:
  • scim_user_id – The id of the SCIM user.

  • operations – The SCIM patch operations.

Returns:

The SCIM patch acknowledgement message.

async delete(*, scim_user_id: str) → None

Lock a SCIM user.

Safe to retry: the user is gone either way, though a repeat may report that it was not found.

Parameters:

scim_user_id – The id of the SCIM user.

class hackerrank.async_client.AsyncSCIMGroupsNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for SCIM v2 group (team) operations.

Create a new async namespace.

Parameters:
  • transport – The async HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

async list(*, limit: int | None = None, offset: int | None = None) → SCIMPage[SCIMTeam]

List SCIM groups.

Parameters:
  • limit – Number of records to fetch.

  • offset – Offset of records.

Returns:

A page of SCIM teams.

async create(*, body: Mapping[str, JSONValue]) → SCIMTeam

Create a SCIM group.

Not safe to retry: a lost response may still have created the group, so a second attempt can leave a duplicate.

Parameters:

body – The SCIM group payload.

Returns:

The created SCIM team.

async get(*, scim_group_id: str) → SCIMTeam

Retrieve a SCIM group.

Parameters:

scim_group_id – The id of the SCIM group.

Returns:

The SCIM team.

async patch(*, scim_group_id: str, operations: Sequence[Mapping[str, JSONValue]]) → SCIMMessage

Patch a SCIM group.

Not safe to retry: an operation such as add on a multi-valued attribute applies again on a second attempt.

Parameters:
  • scim_group_id – The id of the SCIM group.

  • operations – The SCIM patch operations.

Returns:

The SCIM patch acknowledgement message.

async delete(*, scim_group_id: str) → None

Deprovision a SCIM group.

Safe to retry: the group is gone either way, though a repeat may report that it was not found.

Parameters:

scim_group_id – The id of the SCIM group.

class hackerrank.async_client.AsyncSCIMNamespace(*, transport: AsyncTransport, base_url: str, headers: dict[str, str], retries: int)

Async namespace for SCIM v2 operations.

Create the SCIM namespace.

Parameters:
  • transport – The HTTP transport.

  • base_url – The base URL for the API.

  • headers – Headers to send with every request.

  • retries – The number of times to retry a request which is safe to repeat.

class hackerrank.async_client.AsyncHackerRank(*, api_key: str, base_url: str = 'https://www.hackerrank.com', scim_base_url: str = 'https://services.hackerrank.com/scim/v2', transport: AsyncTransport | None = None, retries: int = 0)

An async client for the HackerRank for Work API.

Create a new async HackerRank client.

Parameters:
  • api_key – The API key for authentication.

  • base_url – The base URL for the v3 API.

  • scim_base_url – The base URL for the SCIM v2 API. This is a different host from base_url; the two APIs cannot share a base URL.

  • transport – The HTTP transport. Defaults to AsyncHTTPXTransport().

  • retries – The number of times to retry a request which is safe to repeat, after a transport error or a 429, 500, 502, 503 or 504 response. Defaults to 0, which never retries. GET, PUT and DELETE requests are safe to repeat, as are the POST endpoints which replace state rather than create it. Endpoints which create a record are never repeated, because a lost response does not mean that the record was not created. Each method’s own docstring says whether it is safe to retry. Each retry is logged as a warning on the hackerrank logger.

base_url: str
scim_base_url: str
async aclose() → None

Close the underlying transport if it supports closing.

Transport abstractions for the HackerRank for Work API.

hackerrank.transports.DEFAULT_TIMEOUT_SECONDS = 60.0

The default timeout, in seconds, for the built-in transports.

The HTTP client libraries default to 5 seconds, which is too short for endpoints which carry large payloads, such as project zip uploads.

exception hackerrank.transports.HTTPStatusError(*, status_code: int, content: bytes)

Raised when an HTTP response has an error status code.

Create a new HTTP status error.

Parameters:
  • status_code – The HTTP status code.

  • content – The response body.

class hackerrank.transports.TransportResponse(*, status_code: int, headers: dict[str, str], content: bytes)

A response from a transport.

status_code: int
headers: dict[str, str]
content: bytes
json() → object

Parse the response body as JSON.

Returns:

The parsed JSON data.

raise_for_status() → None

Raise an error if the response has an error status.

Raises:

HTTPStatusError – If the status code is 300 or above.

class hackerrank.transports.Transport(*args, **kwargs)

Protocol for HTTP transports.

A transport is a callable that makes an HTTP request and returns a TransportResponse.

class hackerrank.transports.HTTPXTransport(*, timeout: Timeout | float = 60.0)

HTTP transport using the httpx library.

This is the default transport. It uses a shared httpx.Client for connection pooling.

Create a new HTTPX transport.

Parameters:

timeout – The timeout to use for every request, either a number of seconds or an httpx.Timeout. Defaults to DEFAULT_TIMEOUT_SECONDS seconds.

close() → None

Close the underlying HTTP client.

class hackerrank.transports.HTTPX2Transport(*, timeout: Timeout | float = 60.0)

HTTP transport using the httpx2 library.

This opt-in transport uses a shared httpx2.Client for connection pooling. Configuration objects must come from httpx2, not httpx.

Create a new HTTPX2 transport.

Parameters:

timeout – The timeout to use for every request, either a number of seconds or an httpx2.Timeout. Defaults to DEFAULT_TIMEOUT_SECONDS seconds.

close() → None

Close the underlying HTTP client.

class hackerrank.transports.AsyncTransport(*args, **kwargs)

Protocol for async HTTP transports.

class hackerrank.transports.AsyncHTTPXTransport(*, timeout: Timeout | float = 60.0)

Async HTTP transport using the httpx library.

Create a new async HTTPX transport.

Parameters:

timeout – The timeout to use for every request, either a number of seconds or an httpx.Timeout. Defaults to DEFAULT_TIMEOUT_SECONDS seconds.

async aclose() → None

Close the underlying async HTTP client.

class hackerrank.transports.AsyncHTTPX2Transport(*, timeout: Timeout | float = 60.0)

Async HTTP transport using the httpx2 library.

Create a new async HTTPX2 transport.

Parameters:

timeout – The timeout to use for every request, either a number of seconds or an httpx2.Timeout. Defaults to DEFAULT_TIMEOUT_SECONDS seconds.

async aclose() → None

Close the underlying async HTTP client.

Types for the HackerRank for Work API.

type hackerrank.types.JSONValue = JSONValue

A JSON-compatible value.

Used for free-form fields such as metadata, candidate, accommodations and webhook_authentication — anything where the HackerRank API accepts or returns an opaque blob constrained only to be JSON-serialisable.

Sequence / Mapping (rather than list / dict) make the alias accept narrower concrete types such as dict[str, str] without invariance issues.

class hackerrank.types.Page(iterable: Iterable = (), /, *, page_total: int, offset: int, previous: str, next_: str, first: str, last: str, total: int)

A page of results with HackerRank’s pagination metadata.

Create a new page.

Parameters:
  • iterable – The items for the list.

  • page_total – Count of items in the current page.

  • offset – The offset of the current page.

  • previous – URL of the previous page.

  • next – URL of the next page.

  • first – URL of the first page.

  • last – URL of the last page.

  • total – Total number of items across all pages.

property data: list[T]

Return the items as a plain list.

Returns:

A copy of the items in this page.

class hackerrank.types.SCIMPage(iterable: Iterable = (), /, *, schemas: list[str], start_index: int, items_per_page: int, total_results: int)

A SCIM v2 paginated response.

SCIM uses a different envelope from the v3 API.

Create a new SCIM page.

Parameters:
  • iterable – The items for the list.

  • schemas – The SCIM schemas for the response.

  • start_index – Index of the first item in the page.

  • items_per_page – Number of items per page.

  • total_results – Total number of items.

class hackerrank.types.CandidateDetail(*, field_name: str, title: str, value: str)

A custom candidate detail field.

field_name: str
title: str
value: str
classmethod from_dict(data: CandidateDetailDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.CandidateSearchAttemptResult(*, attempt_id: str, test_id: str, report_url: str, score: float | None = None, percentage_score: float | None = None, attempt_starttime: str | None = None, attempt_endtime: str | None = None)

A test attempt returned by global candidate search.

attempt_id: str
test_id: str
report_url: str
score: float | None = None
percentage_score: float | None = None
attempt_starttime: str | None = None
attempt_endtime: str | None = None
classmethod from_dict(data: CandidateSearchAttemptResultDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.CandidateSearchResult(*, uuid: str, name: str, email: str, created_at: str, updated_at: str, attempts: list[CandidateSearchAttemptResult])

A candidate match from global candidate search.

uuid: str
name: str
email: str
created_at: str
updated_at: str
attempts: list[CandidateSearchAttemptResult]
classmethod from_dict(data: CandidateSearchResultDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Interviewer(*, email: str, name: str | None = None)

An interviewer identified by email and optional name.

email: str
name: str | None = None
classmethod from_dict(data: InterviewerDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Interview(*, id: str, status: str, url: str, title: str | None = None, feedback: str | None = None, thumbs_up: int | None = None, notes: str | None = None, resume_url: str | None = None, interviewers: list[str | Interviewer] | None = None, result_url: str | None = None, candidate: dict[str, JSONValue] | None = None, metadata: dict[str, JSONValue] | None = None, report_url: str | None = None, ended_at: str | None = None, interview_template_id: int | None = None, created_at: str | None = None, updated_at: str | None = None, user: int | None = None, send_email: bool | None = None, from_: str | None = None, to: str | None = None, started_at: str | None = None, ai_assistant_available: bool | None = None)

A HackerRank interview.

id: str
status: str
url: str
title: str | None = None
feedback: str | None = None
thumbs_up: int | None = None
notes: str | None = None
resume_url: str | None = None
interviewers: list[str | Interviewer] | None = None
result_url: str | None = None
candidate: dict[str, JSONValue] | None = None
metadata: dict[str, JSONValue] | None = None
report_url: str | None = None
ended_at: str | None = None
interview_template_id: int | None = None
created_at: str | None = None
updated_at: str | None = None
user: int | None = None
send_email: bool | None = None
from_: str | None = None
to: str | None = None
started_at: str | None = None
ai_assistant_available: bool | None = None
classmethod from_dict(data: InterviewDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.InterviewTranscriptMessage(*, author: str, timestamp: int, text: str, candidate: bool, message_id: str, email: str | None = None)

A single message in an interview transcript.

author: str
timestamp: int
text: str
candidate: bool
message_id: str
email: str | None = None
classmethod from_dict(data: InterviewTranscriptMessageDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.InterviewTranscript(*, messages: list[InterviewTranscriptMessage])

The transcript for an interview.

messages: list[InterviewTranscriptMessage]
classmethod from_dict(data: InterviewTranscriptDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.InterviewTemplate(*, id: str, name: str, created_at: str | None = None, status: int | None = None, user: int | None = None, roles: list[str] | None = None, team_share: int | None = None, questions: list[int] | None = None, scorecard: int | None = None, import_template: bool | None = None, editor_access: bool | None = None)

A HackerRank interview template.

id: str
name: str
created_at: str | None = None
status: int | None = None
user: int | None = None
roles: list[str] | None = None
team_share: int | None = None
questions: list[int] | None = None
scorecard: int | None = None
import_template: bool | None = None
editor_access: bool | None = None
classmethod from_dict(data: InterviewTemplateDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.EnvironmentRuntime(*, name: str, version: str)

A runtime component for a project-question environment.

name: str
version: str
classmethod from_dict(data: EnvironmentRuntimeDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Environment(*, id: int, name: str, tags: list[str], runtime: list[EnvironmentRuntime], active: bool | None = None, sample_project_url: str | None = None)

A project-question environment.

id: int
name: str
tags: list[str]
runtime: list[EnvironmentRuntime]
active: bool | None = None
sample_project_url: str | None = None
classmethod from_dict(data: EnvironmentDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Question(*, id: str, type: str, name: str, unique_id: str | None = None, owner: str | None = None, created_at: str | None = None, status: str | None = None, internal_notes: str | None = None, languages: list[str] | None = None, problem_statement: str | None = None, recommended_duration: int | None = None, tags: list[str] | None = None, max_score: float | None = None, options: list[str] | None = None, answer: int | list[int] | None = None, test_case_count: int | None = None, role_type: str | None = None, environment_id: int | None = None, file_url: str | None = None, file_path: str | None = None, has_valid_stacks: bool | None = None, fullstack_project_details: dict[str, JSONValue] | None = None)

A HackerRank question.

id: str
type: str
name: str
unique_id: str | None = None
owner: str | None = None
created_at: str | None = None
status: str | None = None
internal_notes: str | None = None
languages: list[str] | None = None
problem_statement: str | None = None
recommended_duration: int | None = None
tags: list[str] | None = None
max_score: float | None = None
options: list[str] | None = None
answer: int | list[int] | None = None
test_case_count: int | None = None
role_type: str | None = None
environment_id: int | None = None
file_url: str | None = None
file_path: str | None = None
has_valid_stacks: bool | None = None
fullstack_project_details: dict[str, JSONValue] | None = None
classmethod from_dict(data: QuestionDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.TestCandidateDetailField(*, predefined_label: str | None = None, required: bool | None = None, title: str | None = None, type: str | None = None, options: list[str] | None = None)

A candidate-detail field descriptor configured on a test.

predefined_label: str | None = None
required: bool | None = None
title: str | None = None
type: str | None = None
options: list[str] | None = None
classmethod from_dict(data: TestCandidateDetailFieldDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Test(*, id: str, name: str, unique_id: str | None = None, starttime: str | None = None, endtime: str | None = None, duration: int | None = None, owner: str | None = None, instructions: str | None = None, starred: bool | None = None, created_at: str | None = None, state: str | None = None, locked: bool | None = None, draft: bool | None = None, languages: list[str] | None = None, candidate_details: list[str | TestCandidateDetailField] | None = None, custom_acknowledge_text: str | None = None, cutoff_score: int | None = None, master_password: str | None = None, hide_compile_test: bool | None = None, tags: list[str] | None = None, role_ids: list[str] | None = None, experience: list[str] | None = None, questions: list[str] | None = None, sections: dict[str, JSONValue] | None = None, mcq_incorrect_score: int | None = None, mcq_correct_score: int | None = None, locked_by: str | None = None, short_login_url: str | None = None, public_login_url: str | None = None, shuffle_questions: bool | None = None, test_admins: list[str] | None = None, hide_template: bool | None = None, enable_acknowledgement: bool | None = None, enable_proctoring: bool | None = None, enable_advanced_proctoring: bool | None = None, enable_secure_assessment_mode: bool | None = None, enable_ml_plagiarism_analysis: bool | None = None, enable_photo_identification: bool | None = None, ide_config: str | None = None)

A HackerRank test.

id: str
name: str
unique_id: str | None = None
starttime: str | None = None
endtime: str | None = None
duration: int | None = None
owner: str | None = None
instructions: str | None = None
starred: bool | None = None
created_at: str | None = None
state: str | None = None
locked: bool | None = None
draft: bool | None = None
languages: list[str] | None = None
candidate_details: list[str | TestCandidateDetailField] | None = None
custom_acknowledge_text: str | None = None
cutoff_score: int | None = None
master_password: str | None = None
hide_compile_test: bool | None = None
tags: list[str] | None = None
role_ids: list[str] | None = None
experience: list[str] | None = None
questions: list[str] | None = None
sections: dict[str, JSONValue] | None = None
mcq_incorrect_score: int | None = None
mcq_correct_score: int | None = None
locked_by: str | None = None
short_login_url: str | None = None
public_login_url: str | None = None
shuffle_questions: bool | None = None
test_admins: list[str] | None = None
hide_template: bool | None = None
enable_acknowledgement: bool | None = None
enable_proctoring: bool | None = None
enable_advanced_proctoring: bool | None = None
enable_secure_assessment_mode: bool | None = None
enable_ml_plagiarism_analysis: bool | None = None
enable_photo_identification: bool | None = None
ide_config: str | None = None
classmethod from_dict(data: TestDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.TestCandidate(*, id: str, email: str, full_name: str | None = None, score: float | None = None, test: str | None = None, user: str | None = None, attempt_starttime: str | None = None, attempt_endtime: str | None = None, attempt_events: list[str] | None = None, status: int | None = None, ats_state: int | None = None, integrity_status: str | None = None, integrity_summary: str | None = None, invite_email_done: bool | None = None, invite_valid: bool | None = None, invited_on: str | None = None, invite_valid_from: str | None = None, invite_valid_to: str | None = None, invite_link: str | None = None, invite_metadata: dict[str, JSONValue] | None = None, evaluator_email: str | None = None, test_finish_url: str | None = None, test_result_url: str | None = None, accept_result_updates: bool | None = None, tags: list[str] | None = None, report_url: str | None = None, authenticated_report_url: str | None = None, pdf_url: str | None = None, scores_tags_split: dict[str, JSONValue] | None = None, scores_skills_split: dict[str, JSONValue] | None = None, added_time: str | int | None = None, unclaimed_added_time: int | None = None, comments: dict[str, JSONValue] | None = None, performance_summary: str | None = None, ip_address: str | None = None, questions: dict[str, JSONValue] | None = None, plagiarism: dict[str, JSONValue] | None = None, plagiarism_status: bool | None = None, max_code_similarity: dict[str, JSONValue] | None = None, feedback: str | None = None, percentage_score: float | None = None, candidate_details: list[CandidateDetail] | None = None, out_of_window_events: int | None = None, out_of_window_duration: float | None = None, editor_paste_count: int | None = None, proctor_images: list[str] | None = None)

A candidate associated with a test.

id: str
email: str
full_name: str | None = None
score: float | None = None
test: str | None = None
user: str | None = None
attempt_starttime: str | None = None
attempt_endtime: str | None = None
attempt_events: list[str] | None = None
status: int | None = None
ats_state: int | None = None
integrity_status: str | None = None
integrity_summary: str | None = None
invite_email_done: bool | None = None
invite_valid: bool | None = None
invited_on: str | None = None
invite_valid_from: str | None = None
invite_valid_to: str | None = None
invite_metadata: dict[str, JSONValue] | None = None
evaluator_email: str | None = None
test_finish_url: str | None = None
test_result_url: str | None = None
accept_result_updates: bool | None = None
tags: list[str] | None = None
report_url: str | None = None
authenticated_report_url: str | None = None
pdf_url: str | None = None
scores_tags_split: dict[str, JSONValue] | None = None
scores_skills_split: dict[str, JSONValue] | None = None
added_time: str | int | None = None
unclaimed_added_time: int | None = None
comments: dict[str, JSONValue] | None = None
performance_summary: str | None = None
ip_address: str | None = None
questions: dict[str, JSONValue] | None = None
plagiarism: dict[str, JSONValue] | None = None
plagiarism_status: bool | None = None
max_code_similarity: dict[str, JSONValue] | None = None
feedback: str | None = None
percentage_score: float | None = None
candidate_details: list[CandidateDetail] | None = None
out_of_window_events: int | None = None
out_of_window_duration: float | None = None
editor_paste_count: int | None = None
proctor_images: list[str] | None = None
classmethod from_dict(data: TestCandidateDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Inviter(*, id: str, email: str, firstname: str | None = None, lastname: str | None = None, role: str | None = None, status: str | None = None, phone: str | None = None, timezone: str | None = None, questions_permission: int | None = None, tests_permission: int | None = None, interviews_permission: int | None = None, candidates_permission: int | None = None, teams: list[str] | None = None, candidates_invited: int | None = None, activated: bool | None = None)

A user permitted to invite candidates to a test.

id: str
email: str
firstname: str | None = None
lastname: str | None = None
role: str | None = None
status: str | None = None
phone: str | None = None
timezone: str | None = None
questions_permission: int | None = None
tests_permission: int | None = None
interviews_permission: int | None = None
candidates_permission: int | None = None
teams: list[str] | None = None
candidates_invited: int | None = None
activated: bool | None = None
classmethod from_dict(data: InviterDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.User(*, id: str, email: str, firstname: str | None = None, lastname: str | None = None, country: str | None = None, role: str | None = None, status: str | None = None, phone: str | None = None, timezone: str | None = None, questions_permission: int | None = None, tests_permission: int | None = None, interviews_permission: int | None = None, candidates_permission: int | None = None, shared_questions_permission: int | None = None, shared_tests_permission: int | None = None, shared_interviews_permission: int | None = None, shared_candidates_permission: int | None = None, company_admin: bool | None = None, team_admin: bool | None = None, teams: list[str] | None = None, activated: bool | None = None, last_activity_time: str | None = None)

A HackerRank user.

id: str
email: str
firstname: str | None = None
lastname: str | None = None
country: str | None = None
role: str | None = None
status: str | None = None
phone: str | None = None
timezone: str | None = None
questions_permission: int | None = None
tests_permission: int | None = None
interviews_permission: int | None = None
candidates_permission: int | None = None
shared_questions_permission: int | None = None
shared_tests_permission: int | None = None
shared_interviews_permission: int | None = None
shared_candidates_permission: int | None = None
company_admin: bool | None = None
team_admin: bool | None = None
teams: list[str] | None = None
activated: bool | None = None
last_activity_time: str | None = None
classmethod from_dict(data: UserDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Team(*, id: str, name: str, owner: str | None = None, created_at: str | None = None, recruiter_count: int | None = None, developer_count: int | None = None, recruiter_cap: int | None = None, developer_cap: int | None = None, invite_as: str | None = None, locations: list[str] | None = None, departments: list[str] | None = None)

A HackerRank team.

id: str
name: str
owner: str | None = None
created_at: str | None = None
recruiter_count: int | None = None
developer_count: int | None = None
recruiter_cap: int | None = None
developer_cap: int | None = None
invite_as: str | None = None
locations: list[str] | None = None
departments: list[str] | None = None
classmethod from_dict(data: TeamDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.UserTeamMembership(*, team: str, user: str)

A membership of a user in a team.

team: str
user: str
classmethod from_dict(data: UserTeamMembershipDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.Template(*, id: str, name: str, subject: str | None = None, content: str | None = None, default: bool | None = None, created_at: str | None = None, updated_at: str | None = None, user: str | None = None)

An invite-email template.

id: str
name: str
subject: str | None = None
content: str | None = None
default: bool | None = None
created_at: str | None = None
updated_at: str | None = None
user: str | None = None
classmethod from_dict(data: TemplateDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.AuditLog(*, source_id: int, source_type: str, action: str, user: str | None = None, modified_fields: list[str] | None = None, modified_values: dict[str, JSONValue] | None = None, ip_address: str | None = None, created_at: str | None = None)

An audit log entry.

source_id: int
source_type: str
action: str
user: str | None = None
modified_fields: list[str] | None = None
modified_values: dict[str, JSONValue] | None = None
ip_address: str | None = None
created_at: str | None = None
classmethod from_dict(data: AuditLogDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.CandidateInvite(*, test_link: str, email: str, id: int | str)

Success payload for inviting a candidate to a test.

email: str
id: int | str
classmethod from_dict(data: CandidateInviteDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.ATSCodePair(*, title: str | None = None, requisition_id: str | None = None, candidate_id: str | None = None, candidate: dict[str, JSONValue] | None = None, send_email: bool | None = None, interview_metadata: dict[str, JSONValue] | None = None)

Request-shaped payload for an ATS Codepair invite.

title: str | None = None
requisition_id: str | None = None
candidate_id: str | None = None
candidate: dict[str, JSONValue] | None = None
send_email: bool | None = None
interview_metadata: dict[str, JSONValue] | None = None
classmethod from_dict(data: ATSCodePairDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.ATSCodeScreen(*, test_id: str | None = None, requisition_id: str | None = None, candidate_id: str | None = None, email: str | None = None, test_result_url: str | None = None, accept_result_updates: bool | None = None)

Request-shaped payload for an ATS CodeScreen invite.

test_id: str | None = None
requisition_id: str | None = None
candidate_id: str | None = None
email: str | None = None
test_result_url: str | None = None
accept_result_updates: bool | None = None
classmethod from_dict(data: ATSCodeScreenDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.SCIMUser(*, id: str, user_name: str, name: dict[str, JSONValue] | None = None, active: bool | None = None, role: str | None = None, team_admin: bool | None = None, company_admin: bool | None = None, emails: list[dict[str, JSONValue]] | None = None, schemas: list[str] | None = None)

A SCIM v2 user.

id: str
user_name: str
name: dict[str, JSONValue] | None = None
active: bool | None = None
role: str | None = None
team_admin: bool | None = None
company_admin: bool | None = None
emails: list[dict[str, JSONValue]] | None = None
schemas: list[str] | None = None
classmethod from_dict(data: SCIMUserDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.SCIMTeam(*, id: str, display_name: str | None = None, schemas: list[str] | None = None)

A SCIM v2 team.

id: str
display_name: str | None = None
schemas: list[str] | None = None
classmethod from_dict(data: SCIMTeamDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

class hackerrank.types.UserUpdate(*, firstname: str, lastname: str, country: str, role: str, phone: str, questions_permission: int, tests_permission: int, interviews_permission: int, candidates_permission: int, shared_questions_permission: int, shared_tests_permission: int, shared_interviews_permission: int, shared_candidates_permission: int, company_admin: bool, team_admin: bool)

Required body for PUT /x/api/v3/users/{id}.

firstname: str
lastname: str
country: str
role: str
phone: str
questions_permission: int
tests_permission: int
interviews_permission: int
candidates_permission: int
shared_questions_permission: int
shared_tests_permission: int
shared_interviews_permission: int
shared_candidates_permission: int
company_admin: bool
team_admin: bool
to_dict() → dict[str, JSONValue]

Serialize to a JSON-compatible mapping.

Returns:

The update body as a dictionary.

class hackerrank.types.TestsUpdate(*, name: str, starttime: str, endtime: str, duration: int, instructions: str, locked: bool, draft: bool, languages: list[str], candidate_details: list[str], custom_acknowledge_text: str, cutoff_score: int, master_password: str, hide_compile_test: bool, tags: list[str], role_ids: list[str], experience: list[str], questions: list[str], mcq_incorrect_score: int, mcq_correct_score: int, shuffle_questions: bool, test_admins: list[str], hide_template: bool, enable_acknowledgement: bool, enable_proctoring: bool, enable_advanced_proctoring: bool, enable_secure_assessment_mode: bool, enable_ml_plagiarism_analysis: bool, enable_photo_identification: bool, ide_config: str)

Required body for PUT /x/api/v3/tests/{id}.

name: str
starttime: str
endtime: str
duration: int
instructions: str
locked: bool
draft: bool
languages: list[str]
candidate_details: list[str]
custom_acknowledge_text: str
cutoff_score: int
master_password: str
hide_compile_test: bool
tags: list[str]
role_ids: list[str]
experience: list[str]
questions: list[str]
mcq_incorrect_score: int
mcq_correct_score: int
shuffle_questions: bool
test_admins: list[str]
hide_template: bool
enable_acknowledgement: bool
enable_proctoring: bool
enable_advanced_proctoring: bool
enable_secure_assessment_mode: bool
enable_ml_plagiarism_analysis: bool
enable_photo_identification: bool
ide_config: str
to_dict() → dict[str, JSONValue]

Serialize to a JSON-compatible mapping.

Returns:

The update body as a dictionary.

class hackerrank.types.SCIMMessage(*, message: str, schemas: list[str] | None = None)

A SCIM patch acknowledgement response.

message: str
schemas: list[str] | None = None
classmethod from_dict(data: SCIMMessageDict) → Self

Create from an API response dictionary.

Parameters:

data – The dictionary to convert.

Returns:

A new instance.

Custom exception hierarchy for the HackerRank API.

exception hackerrank.exceptions.HackerRankError(*, response: TransportResponse)

Base exception for all HackerRank API errors.

response

The full transport response for debugging.

status_code

The HTTP status code.

content

The response body.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

classmethod from_response(*, response: TransportResponse) → HackerRankError

Create the appropriate exception for a response.

Uses the registry to find a specific exception class for the response’s status code, falling back to HackerRankError. Redirect (3xx) responses map to RedirectError.

Parameters:

response – The transport response.

Returns:

The appropriate exception instance.

exception hackerrank.exceptions.RedirectError(*, response: TransportResponse)

Raised for unexpected HTTP 3xx redirect responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.BadRequestError(*, response: TransportResponse)

Raised for 400 Bad Request responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.AuthenticationError(*, response: TransportResponse)

Raised for 401 Unauthorized responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.ForbiddenError(*, response: TransportResponse)

Raised for 403 Forbidden responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.NotFoundError(*, response: TransportResponse)

Raised for 404 Not Found responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.ConflictError(*, response: TransportResponse)

Raised for 409 Conflict responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.UnprocessableEntityError(*, response: TransportResponse)

Raised for 422 Unprocessable Entity responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.RateLimitError(*, response: TransportResponse)

Raised for 429 Too Many Requests responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.

exception hackerrank.exceptions.ServerError(*, response: TransportResponse)

Raised for 500 Internal Server Error responses.

Create a new HackerRank error.

Parameters:

response – The transport response that caused the error.