Skip to main content

Build Status PyPI

hackerrank

Python library for the HackerRank for Work API.

Installation

pip install hackerrank

This is tested on Python 3.13+.

Getting Started

Generate an API token from the HackerRank for Work tokens page and pass it as api_key:

"""Example usage."""

import sys

from hackerrank.client import HackerRank

client = HackerRank(api_key="your-api-key")
for test in client.tests.list().data:
    _ = sys.stdout.write(test.name)
interview = client.interviews.create(title="My Interview")
_ = sys.stdout.write(interview.url)

Updating private notes

Use client.questions.update_internal_notes(question_id=..., internal_notes=...) to change private interviewer notes. The same operation is available on AsyncHackerRank. Each call reads the required question fields before writing the requested notes, including identical or empty notes. The operation returns the question supplied by the update response, or None for an empty response. It raises ValueError if fields required by the update request are absent.

HTTPX2 transports

HTTPX remains the default client family. To opt in to HTTPX2, construct the HTTPX2 transport explicitly and pass it to the client. The standard hackerrank installation includes both client families.

"""Configure HackerRank to use HTTPX2."""

import httpx2

from hackerrank.client import HackerRank
from hackerrank.transports import HTTPX2Transport

transport = HTTPX2Transport(timeout=httpx2.Timeout(timeout=10))
with HackerRank(api_key="your-api-key", transport=transport) as client:
    tests = client.tests.list()

Use AsyncHTTPX2Transport with AsyncHackerRank for asynchronous calls. The timeout argument accepts an HTTPX2 timeout object or a number of seconds. Existing HTTPX configurations continue to work. Pass HTTPX2 timeout objects to HTTPX2 transports. Migrating to HTTPX2 only requires selecting the new transport. HackerRank client methods and returned models are unchanged.

Question types and AI prompts

Use hackerrank.types.QuestionType for known API question types. The clients continue to accept strings, and Question.type preserves unknown response values so newer server types remain readable. QuestionType.supports_custom_system_prompt and Question.supports_custom_system_prompt report known prompt support.

Typed and generic question writes reject prompts longer than 15,000 characters and prompts supplied for known unsupported types before sending a request. Generic partial updates can omit the type. The server validates whether the field applies. Invalid requests retain the supplied prompt.

Native project configuration

Pass the version and nested settings of a native hackerrank.yml to ProjectConfiguration. Call to_yaml() to render the configuration as UTF-8 YAML bytes.

"""Render a HackerRank project configuration."""

from hackerrank.project_configuration import ProjectConfiguration

configuration = ProjectConfiguration(
    version=1.0,
    configuration={
        "has_webserver": False,
        "readonly_paths": ["tests"],
        "scoring": {"command": "grade", "files": ["report.xml"]},
        "ide_config": {
            "default_open_files": ["solution.py"],
            "project_menu": {"run": "python solution.py"},
        },
    },
).to_yaml()
assert configuration.startswith(b"version: 1.0\n")

Pass the configuration bytes and an existing project ZIP to hackerrank.project_configuration.configure_project_archive. Pass the resulting ZIP bytes to client.questions.upload_project_zip.

Full Documentation

See the full documentation.

Interviews V2 and audit logs

client.interviews.get_artifacts returns typed artifact metadata or an InterviewArtifactsPending result with the server’s retry delay. Signed download URLs expire. Request fresh metadata when needed. get_notes reads permitted interviewer notes and update_note replaces the current user’s note, preserving empty content.

Use client.audit_logs.list_cursor for large audit collections. Pass the returned next_cursor to continue. Subsequent requests send only that opaque token. Both audit methods support the documented filters, including user. The existing user_id argument sends the documented user query key. Offset pages expose the server’s window limit and exhaustion flag. All operations are also available on AsyncHackerRank.

Complete API operation catalogue

hackerrank.api.api_operations() lists every documented v3 and SCIM operation. client.api.call accepts the operation name, path parameters, query fields and complete JSON body, retaining the response status, headers and data. SCIM calls require their own scim_api_key and use the provisioning host. The same catalogue and execution interface are available asynchronously.

Offline project archives

Use hackerrank.projects.build_project_archive to build a project ZIP from explicitly chosen local files. Pass the resulting ZIP bytes to client.questions.upload_project_zip.

Metadata

Release files for hackerrank 2026.11.26.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hackerrank 2026.11.26.1
File Size Uploaded Provenance Actions
hackerrank-2026.11.26.1.tar.gz 221.1 kB With provenance Details for hackerrank-2026.11.26.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hackerrank 2026.11.26.1
File Interpreter ABI Platform Actions
hackerrank-2026.11.26.1-py3-none-any.whl Python 3 none any Details for hackerrank-2026.11.26.1-py3-none-any.whl

Total release size: 325.0 kB

Release files / hackerrank-2026.11.26.1.tar.gz

Download URL hackerrank-2026.11.26.1.tar.gz
Size 221.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a3fd33d4e4a0d79cc1e52e94f8f767b2c00bec02ea37fbc464a5c70999a902f8
BLAKE2b-256 checksum
How to use checksums
42213cdc87eb381aa8e2d7d985f5fbbf82a4da7ab8931ae5e6c2ebbf803fa63f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / hackerrank-2026.11.26.1-py3-none-any.whl

Download URL hackerrank-2026.11.26.1-py3-none-any.whl
Size 103.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32ca7d4d81c82bac6e63c872a0201931e26580e1d820a8a87e43e46bb4a4868a
BLAKE2b-256 checksum
How to use checksums
384fce8bc8c71da4d5f0b3577e5d720d9a2ff16442fd02f26818f7f26c3636e2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for hackerrank 2026.11.26.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hackerrank-2026.11.26.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page