Hirebridge Logo

API v1 Documentation (Partial)

Introduction

This document provides examples for interacting with the Hirebridge REST API (v1).

Base URL: https://api.hirebridge.com/v1

Authentication

The Hirebridge API uses an API Key for authentication. You must include your API key in the HBAPIKEY header for all requests.

HBAPIKEY: {YOUR_API_KEY}

Remember to replace {YOUR_API_KEY} with your actual Hirebridge API key in all examples.

Sandbox Testing

To test in our sandbox environment, be sure to use your sandbox API key and add a header variable named X-Environment with a value of sandbox

X-Environment: sandbox

GET /jobs/{jobId}

Retrieves details for a specific job opening.

Parameters

jobId (Path Parameter)
Required. The unique identifier for the job.

Code Examples

Replace {jobId} with an actual job ID and {YOUR_API_KEY} with your key.

cURL

curl -X GET "https://api.hirebridge.com/v1/jobs/{jobId}" \
     -H "Accept: application/json" \
     -H "HBAPIKEY: {YOUR_API_KEY}"

C# (using HttpClient)

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

public class HirebridgeApiClient
{
    private static readonly HttpClient client = new HttpClient();
    private const string BaseUrl = "https://api.hirebridge.com/v1/";
    private const string ApiKey = "{YOUR_API_KEY}"; // Replace with your API key

    public static async Task<string> GetJobDetailsAsync(string jobId)
    {
        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        client.DefaultRequestHeaders.Add("HBAPIKEY", ApiKey);

        string requestUri = $"{BaseUrl}jobs/{Uri.EscapeDataString(jobId)}";

        try
        {
            HttpResponseMessage response = await client.GetAsync(requestUri);
            response.EnsureSuccessStatusCode(); // Throw exception for non-2xx status codes
            string responseBody = await response.Content.ReadAsStringAsync();
            return responseBody;
        }
        catch (HttpRequestException e)
        {
            Console.WriteLine($"Request error: {e.Message}");
            // Handle error appropriately
            return null;
        }
    }
}

// Usage:
// string jobId = "12345";
// string jobDetailsJson = await HirebridgeApiClient.GetJobDetailsAsync(jobId);
// if (jobDetailsJson != null) { Console.WriteLine(jobDetailsJson); }

JavaScript (using Fetch API)

const getJobDetails = async (jobId, apiKey) => {
  const url = `https://api.hirebridge.com/v1/jobs/${encodeURIComponent(jobId)}`;
  const headers = {
    'Accept': 'application/json',
    'HBAPIKEY': apiKey
  };

  try {
    const response = await fetch(url, {
      method: 'GET',
      headers: headers
    });

    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }

    const data = await response.json();
    console.log(data);
    return data;
  } catch (error) {
    console.error('Error fetching job details:', error);
    // Handle error appropriately
    return null;
  }
};

// Usage:
// const jobId = '12345';
// const apiKey = '{YOUR_API_KEY}'; // Replace with your API key
// getJobDetails(jobId, apiKey);

Python (using requests)

import requests
import json

def get_job_details(job_id, api_key):
    """Retrieves details for a specific job opening."""
    base_url = "https://api.hirebridge.com/v1"
    url = f"{base_url}/jobs/{job_id}"
    headers = {
        'Accept': 'application/json',
        'HBAPIKEY': api_key
    }

    try:
        response = requests.get(url, headers=headers)
        response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Request failed: {e}")
        if response is not None:
            print(f"Response Text: {response.text}")
        # Handle error appropriately
        return None

# Usage:
# job_id = "12345"
# api_key = "{YOUR_API_KEY}" # Replace with your API key
# job_details = get_job_details(job_id, api_key)
# if job_details:
#     print(json.dumps(job_details, indent=2))

POST /candidates

Creates a new candidate record.

Request Body

The request body should be a JSON object containing the candidate's details. The exact structure required should be verified against the official Hirebridge API documentation. An example structure is shown below:

{
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane.doe@example.com",
  "phoneNumber": "555-123-4567"
  // ... other required or optional candidate fields
}

Code Examples

Replace {YOUR_API_KEY} with your key and modify the example data in the request body as needed.

cURL

curl -X POST "https://api.hirebridge.com/v1/candidates" \
     -H "Content-Type: application/json" \
     -H "Accept: application/json" \
     -H "HBAPIKEY: {YOUR_API_KEY}" \
     -d '{
           "firstName": "Jane",
           "lastName": "Doe",
           "email": "jane.doe@example.com",
           "phoneNumber": "555-123-4567"
           # ... other candidate fields as specified in the API docs
         }'

C# (using HttpClient)

using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json; // Or Newtonsoft.Json
using System.Threading.Tasks;

public class HirebridgeApiClient
{
    private static readonly HttpClient client = new HttpClient();
    private const string BaseUrl = "https://api.hirebridge.com/v1/";
    private const string ApiKey = "{YOUR_API_KEY}"; // Replace with your API key

    // Define a class matching the expected JSON structure
    public class CandidateData
    {
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string Email { get; set; }
        public string PhoneNumber { get; set; }
        // Add other fields as needed
    }

    public static async Task<string> CreateCandidateAsync(CandidateData candidate)
    {
        client.DefaultRequestHeaders.Clear();
        client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
        client.DefaultRequestHeaders.Add("HBAPIKEY", ApiKey);

        string requestUri = $"{BaseUrl}candidates";
        string jsonPayload = JsonSerializer.Serialize(candidate); // Using System.Text.Json
        var content = new StringContent(jsonPayload, Encoding.UTF8, "application/json");

        try
        {
            HttpResponseMessage response = await client.PostAsync(requestUri, content);
            response.EnsureSuccessStatusCode();
            string responseBody = await response.Content.ReadAsStringAsync();
            return responseBody;
        }
        catch (HttpRequestException e)
        {
            Console.WriteLine($"Request error: {e.Message}");
             // Handle error appropriately
            return null;
        }
    }
}

// Usage:
// var newCandidate = new HirebridgeApiClient.CandidateData {
//     FirstName = "John",
//     LastName = "Smith",
//     Email = "john.smith@example.com",
//     PhoneNumber = "555-987-6543"
// };
// string creationResponse = await HirebridgeApiClient.CreateCandidateAsync(newCandidate);
// if (creationResponse != null) { Console.WriteLine(creationResponse); }

JavaScript (using Fetch API)

const createCandidate = async (candidateData, apiKey) => {
  const url = 'https://api.hirebridge.com/v1/candidates';
  const headers = {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'HBAPIKEY': apiKey
  };

  try {
    const response = await fetch(url, {
      method: 'POST',
      headers: headers,
      body: JSON.stringify(candidateData)
    });

    if (!response.ok) {
      // Try to get error details from response body if possible
      let errorBody = '';
      try {
          errorBody = await response.text();
      } catch(e) { /* ignore */ }
      throw new Error(`HTTP error! Status: ${response.status}, Body: ${errorBody}`);
    }

    const data = await response.json();
    console.log('Candidate created:', data);
    return data;
  } catch (error) {
    console.error('Error creating candidate:', error);
     // Handle error appropriately
    return null;
  }
};

// Usage:
// const candidateData = {
//   firstName: "Alice",
//   lastName: "Brown",
//   email: "alice.brown@example.com",
//   phoneNumber: "555-111-2222"
//   // ... other fields
// };
// const apiKey = '{YOUR_API_KEY}'; // Replace with your API key
// createCandidate(candidateData, apiKey);

Python (using requests)

import requests
import json

def create_candidate(candidate_data, api_key):
    """Creates a new candidate record."""
    base_url = "https://api.hirebridge.com/v1"
    url = f"{base_url}/candidates"
    headers = {
        'Content-Type': 'application/json',
        'Accept': 'application/json',
        'HBAPIKEY': api_key
    }

    try:
        response = requests.post(url, headers=headers, json=candidate_data)
        response.raise_for_status() # Raise an exception for bad status codes (4xx or 5xx)
        return response.json()
    except requests.exceptions.RequestException as e:
        print(f"Request failed: {e}")
        if response is not None:
             # It's helpful to see the response text on failure
            print(f"Status Code: {response.status_code}")
            print(f"Response Text: {response.text}")
        # Handle error appropriately
        return None

# Usage:
# api_key = "{YOUR_API_KEY}" # Replace with your API key
# new_candidate_payload = {
#     "firstName": "Bob",
#     "lastName": "Green",
#     "email": "bob.green@example.com",
#     "phoneNumber": "555-333-4444"
#     # ... other candidate fields as specified in the API docs
# }
# creation_result = create_candidate(new_candidate_payload, api_key)
# if creation_result:
#     print("Candidate created successfully:")
#     print(json.dumps(creation_result, indent=2))