Skip to main content

REST API for Opensource

IceHrm exposes employee details and attendance data through a REST API. For complete API documentation, see the API Docs section.

Server Configuration

Nginx Configuration

All requests to /app/api/ must redirect to /app/index.php. Add this location block to your Nginx configuration:

location /app/api/ {
try_files $uri /app/api/index.php?/$uri&$args;
}

For non-root installations (e.g., your-site.com/icehrm):

location /icehrm/app/api/ {
try_files $uri /icehrm/app/api/index.php?/$uri&$args;
}

Apache Configuration

For Apache (XAMPP, WAMPP), a .htaccess file is included in icehrm/app/api to handle API request redirection automatically. No additional configuration is required.

Enabling the REST API

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

Testing the API

To verify the REST API is working correctly:

  1. Open your browser
  2. Visit http://your-icehrm-url.com/app/api/echo
  3. You should see an echo response with a random number

If you see the echo response, the API is configured correctly.

API Usage

Base URL: http://your-icehrm-url.com/app/api

Example Request

To call the /employees/me endpoint, send a request to:

http://your-icehrm-url.com/app/api/employees/me

Using cURL

curl -X GET \
-H "Authorization: Bearer [your-token]" \
-H "Content-Type: application/json" \
"http://your-icehrm-url.com/app/api/employees/me"

API Documentation

For complete API documentation including all available endpoints, request/response formats, and authentication details, see: