Skip to main content

REST API for Cloud Installations

This guide covers using the IceHrm REST API with cloud installations.

Authentication

IceHrm uses OAuth 2.0 bearer authentication. Each API request must include the bearer token in the Authorization header.

Obtaining Your API Token

  1. Log in to your IceHrm Cloud instance
  2. Navigate to Basic Information -> Personal Information
  3. Click the Api Access tab
  4. Copy your API token

Using the Bearer Token

Include the token in the Authorization header of all API requests:

Authorization: Bearer [your-token]

Enabling the REST API

  1. Log in as an administrator
  2. Navigate to Settings -> Other
  3. Find Enable REST API and set it to Yes
  4. Save the settings

Cloud API URL Structure

For a cloud instance named test1 (accessible at https://test1.icehrm.com), the API base URL is:

https://icehrm.com/api/test1

Example Requests

Retrieve Current User Data

curl -i https://icehrm.com/api/test1/employees/me \
-H "Authorization: Bearer [TOKEN]"

Create New Employee

curl -X POST \
-H "Authorization: Bearer [TOKEN]" \
-H "Content-Type: application/json" \
-d '{
"employee_id": "EMP003",
"first_name": "John",
"last_name": "Doe",
"nationality": "35",
"birthday": "1990-05-15",
"gender": "Male",
"employment_status": "1",
"job_title": "8",
"department": "2",
"supervisor": "1"
}' \
"https://icehrm.com/api/test1/employees"

Key Fields for Employee Creation

When creating employees, common fields include:

  • employee_id: Unique employee identifier
  • first_name: Employee's first name
  • last_name: Employee's last name
  • nationality: Nationality ID
  • birthday: Date of birth (YYYY-MM-DD)
  • gender: Male/Female
  • employment_status: Employment status ID
  • job_title: Job title ID
  • department: Department ID
  • supervisor: Supervisor employee ID
  • work_email: Work email address
  • mobile_phone: Mobile phone number

API Documentation

For complete API documentation including all available endpoints, see the API Docs section.