APIsWebhooksRegister API Webhook

Register API Webhook

This endpoint allows you to register for webhook events to receive real-time notifications.

Endpoint

POST /api.ezyhire.com/test/registerAPIWebhook

Headers

HeaderTypeRequiredDescription
USER-KeystringYesYour API authentication key

Request Body

{
  "eventType": "TEST_COMPLETED",
  "webhookUrl": "https://your-domain.com/webhook-endpoint"
}

Request Parameters

ParameterTypeRequiredDescription
eventTypeenumYesType of event to subscribe to - TEST_COMPLETED, ID_VERIFICATION_COMPLETED, BGV_COMPLETED, BGV_NEEDINFO
webhookUrlstringYesURL where webhook notifications will be sent

Responses

Success Response

Status Code: 200 OK

{
  "statusCode": 200,
  "error": null,
  "message": "Your API Webhook has been successfully registered.",
  "data": {
    "id": "webhook-123456",
    "employerId": "emp-789012",
    "eventType": "TEST_COMPLETED",
    "webhookUrl": "https://your-domain.com/webhook-endpoint",
    "createdOn": [2024, 1, 15, 10, 30, 0, 0],
    "updatedOn": [2024, 1, 15, 10, 30, 0, 0]
  }
}

Error Responses

Unauthorized

Status Code: 401 Unauthorized

{
  "statusCode": 401,
  "error": null,
  "message": "Invalid User/API key",
  "data": "Please provide a valid User/API key"
}

Internal Server Error

Status Code: 500 Internal Server Error

{
  "statusCode": 500,
  "error": "string",
  "message": "string",
  "data": "string"
}

Enum Values

Field NamePossible Values
eventTypeTEST_COMPLETED, ID_VERIFICATION_COMPLETED, BGV_COMPLETED, BGV_NEEDINFO

Example Usage

const response = await fetch('https://api.ezyhire.com/test/registerAPIWebhook', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'USER-Key': 'your-api-key-here'
  },
  body: JSON.stringify({
    eventType: "TEST_COMPLETED",
    webhookUrl: "https://your-domain.com/webhook-endpoint"
  })
});
 
const data = await response.json();