HeadHunter API

repository·master·Indexed 20 days ago

https://github.com/hhru/api

Tools for integrating HeadHunter (hh.ru) services into third-party products, covering vacancies, candidates, and employers. The API provides functional domains for resumes, vacancies, applicants, employer/company management, negotiations, dictionaries, and salary data. It implements OAuth 2.0 for application and user authorization and supports client-side caching via Etag, Cache-Control, and Expires headers.

Tokens
20.6K
Snippets
52
Records
109
Agent score
70%

What's inside hhru-api

  1. Identify available API resource groups

    master

    The HeadHunter API is organized into several functional domains. Depending on your use case, you will interact with one or more of the following:

    • Context: Information about the currently authenticated user, application, or manager.
    • Webhook API: Managing subscriptions to notifications.
    • Resumes (Резюме): Searching for resumes, managing saved searches, and viewing resume details (primarily for employers).
    • Vacancies (Вакансии): Searching for vacancies, retrieving vacancy details, and managing the full lifecycle of vacancies (publishing, editing, archiving, etc.).
    • Applicants (Соискатели): Managing applicant-specific data like comments and authorization.
    • Employers/Companies (Работодатели/компании): Searching for companies, managing employer services, and managing employer managers.
    • Negotiations (Переписка): Managing the flow of responses and invitations between employers and applicants.
    • Dictionaries (Справочники): Accessing standardized data like regions, professional roles, languages, and skills.
    • Autosuggest (Подсказки): Autocomplete functionality for universities, companies, specializations, and more.
    • Salary Data Bank (Банк данных заработных плат): Accessing salary evaluations and related industry/region dictionaries.
  2. Manage employer managers

    master

    The Employer Managers API allows you to manage the users who have access to an employer's account.

    Authentication Requirement: To access these endpoints, you must be authorized as the employer. If the user is not authorized or is incorrectly authorized, the API will return a 403 Forbidden error.

  3. Manage employer vacancies

    master
    The HeadHunter API provides a comprehensive suite of endpoints for employers to manage the lifecycle of job vacancies. This includes checking available publication types, creating and editing vacancies, prolonging active listings, archiving, deleting, and restoring vacancies. You can also retrieve vacancy statistics and visitor data to monitor performance.
  4. Get started with the HeadHunter API

    master

    The HeadHunter API allows you to integrate HeadHunter (hh.ru) functionality into your own products.

    To begin using the API, you should:

    1. Review the General Information regarding API operation.
    2. Check the FAQ for common questions.
    3. Adhere to the requirements for logo usage and application naming.

    For methods requiring user or application authorization, you must register your application at https://dev.hh.ru and configure the authorization process. Registered applications can request permission to access a user's personal data without ever handling or storing the user's hh.ru login or password.

  5. Understand the Call History data structure

    master

    Call history information is available within the candidate's list of responses (get_negotiations) and when viewing a specific response or invitation (get_negotiation).

    The call history object contains a summary flag and an array of individual call items.

    {
        "picked_up_phone_by_opponent": true,
        "items": [
          {
            "id": 123,
            "status": "call_in_progress",
            "creation_time": "2022-03-04T19:39:58+0300",
            "last_change_time": null,
            "duration_seconds": null
          }
        ]
    }
  6. Understand the employer negotiation model (responses and invitations)

    master

    The employer negotiation API is built around two primary objects:

    1. Response (отклик): Created by a candidate applying to a vacancy. It always links one resume to one vacancy.
    2. Invitation (приглашение): Created by an employer inviting a candidate to a vacancy. It always links one resume to one vacancy.

    To build a robust integration, you must distinguish between these four concepts:

    • Collection (коллекция): A set of responses/invitations grouped by specific criteria. Use collections to display lists of items to users. Do not rely on a response staying in a specific collection as it moves through its lifecycle.
    • Candidate State (соискательское состояние): The status of the response/invitation as seen by the candidate (the state field). These values are global and found in the negotiations_state dictionary.
    • Employer State (работодательское состояние): The status of the response/invitation as seen by the employer. This is specific to the vacancy and the employer; you must fetch these via the API by providing the relevant vacancy.
    • Action (действие): An operation performed on a response/invitation. Actions may or may not change the state (check the resulting_employer_state field to see if a state change occurs).
  7. Authorize requests using OAuth 2.0

    master

    Most requests to the HeadHunter API require an access_token for authorization. The API implements the OAuth 2.0 protocol.

    There are two primary authorization levels supported:

    1. Application Authorization: For accessing application-level data.
    2. User Authorization: For requesting permission to access a specific user's personal data without handling their login or password.

    Important: You must use the hh.ru domain for authorization; the m.hh.ru domain is no longer supported.

  8. How the new resume database access model works

    master

    HeadHunter has transitioned to a model where employers with specific database access plans must explicitly reveal candidate contact information.

    Key behaviors:

    • Explicit Action Required: Contact information is not returned by default. You must use specific links provided in the actions field of the resume object to reveal contacts.
    • Contact Consumption (Deduplication): A contact is 'consumed' (deducted from your quota) only once. The deduction occurs when you either view the contacts via the provided action links OR when you invite the candidate to a vacancy. If the candidate responds to a vacancy first, no contact is deducted, and information becomes immediately visible.
    • Shared Visibility: Once any manager in a company views a resume with contacts (either via the website or API), that resume will show contacts to all other managers in the same company for the duration of the active service.
    • No Change for Legacy Users: Employers not using the new database search features (e.g., those only receiving responses/invitations to existing vacancies) are unaffected.
  9. Use Cache-Control and Expires for expiration-based caching

    master

    In addition to Etag-based validation, the API provides Cache-Control and Expires headers in responses. These headers allow clients to cache a response and use it locally until the specified expiration time without needing to contact the server.

    • Cache-Control: max-age=N: Indicates the maximum amount of time (in seconds) the response is considered fresh.
    • Expires: Provides a specific timestamp after which the response is considered stale.

    Caching support can be identified by the presence of an Etag header in the response, which is common in most dictionary endpoints.

  10. How to mark responses as read

    master

    A candidate's response is considered 'read' by the employer if any of the following occur:

  11. Understand HeadHunter API authorization badges

    master

    The HeadHunter API uses specific badges to indicate the authorization level required for a given endpoint. When consuming the API, check these badges to ensure your request includes the correct credentials:

    • Anonymous (anon): No authorization required.
    • Client (client): Requires application-level authorization (see docs/authorization_for_application.md).
    • Applicant (app): Requires user-level authorization for a job seeker (see docs/authorization_for_user.md).
    • Employer (emp): Requires user-level authorization for an employer/manager (see docs/authorization_for_user.md).