Permissions: Basic and above, who can manage all organization's API Credentials

Product tier: Available to all subscription tiers

 

Sometimes, possibly due to a hiring freeze or reallocation of budget, you may need to close a position or requisition in your HRIS without making a hire. There are two ways to manage this:

 

Option 1: manually close the job in Greenhouse after sending out communications to active candidates.

Option 2: build an integration to automate closing the job in Greenhouse after the corresponding requisition or position is closed in your HRIS.

 

This article outlines the API requests needed for Option 2. 

 

1. GET: List Jobs

 

Use the GET: List Jobs Harvest API endpoint to retrieve the Greenhouse job ID value needed in step 2. This list can be filtered for a specific job by using the requisition_id parameter.

Example Request:

 

curl -X GET \

'https://harvest.greenhouse.io/v1/jobs?requisition_id=abc123\

-H 'Authorization: Basic *******' \

 

Example Response:

 

Example JSON:

 

{

  "id": 6404, 

  "name": "Archaeologist",

  "requisition_id": "abc123",

  "notes": "<p>Resistance to electro-magnetic radiation a plus!</p>",

  "confidential": false,

  "status": "closed",

  "created_at": "2013-12-10T14:42:58Z",

  "opened_at": "2013-12-11T14:42:58Z",

  "closed_at": "2013-12-12T14:42:58Z",

  "updated_at": "2013-12-12T14:42:58Z",

  "is_template": false,

  "copied_from_id": 2345,

  "departments": [

   {

    "id": 25907,

    "name": "Second-Level department",

    "parent_id": 25908,

    "child_ids": [14510],

    "external_id": "12345"

   }

 ],

……

 

2. GET List Job Openings

 

GET: List Job Openings using the Greenhouse job ID from step 1 to retrieve all of the Job Openings for the given job that you would like to close. 

 

Note: if all openings on a job in Greenhouse are “closed”, the Greenhouse job’s status will also be considered “closed.”

 

Example Request:

 

curl -X GET \

'https://harvest.greenhouse.io/v1/jobs/6404/openings

-H 'Authorization: Basic *******' \

 

Example Response:

 

Example JSON:

 

[

    {

        "id": 4530863002,

        "opening_id": null,

        "status": "closed",

        "opened_at": "2019-05-07T16:25:25.661Z",

        "closed_at": "2019-05-14T17:47:35.107Z",

        "application_id": null,

        "close_reason": {

            "id": 4012092002,

            "name": "On Hold"

        },

        "custom_fields": {

            "test_field_name": null

        },

        "keyed_custom_fields": {

            "test_field_name": null

        }

    },

    {

        "id": 4542441002,

        "opening_id": null,

        "status": "open",

        "opened_at": "2019-05-14T17:49:25.590Z",

        "closed_at": null,

        "application_id": null,

        "custom_fields": {

            "test_field_name": null

        },

        "keyed_custom_fields": {

            "test_field_name": null

        }

    }

]

3. PATCH: Edit Openings

Use PATCH: Edit openings to close all “open” openings in Greenhouse. After the last opening on a job is closed, Greenhouse will automatically close the job. This API request requires both the Greenhouse job ID and the Greenhouse opening ID(s). 

 

Note: There is an option to include close_reason_id when closing the opening (see GET: List Close Reasons)

 

Example Request:

 

curl -X GET \

'https://harvest.greenhouse.io/v1/jobs/6404/openings/4542441002

-H 'Authorization: Basic *******' \

-H 'on-behalf-of: 1049756' \

-d ‘{

    "opening_id": "4542441002",

    "status": "closed",

    "close_reason_id": 1234,

}’