Get Company Departments

Departments and Units Endpoint Usage

Endpoint:
GET https://api-sandbox.seamlesshr.app/v1/companies/departments

This endpoint can be used to retrieve company departments, units, or both departments and units in a single request. The data returned depends on the query parameters supplied.

Required Parameter

  • company (Required): Specifies the company whose departments or units you want to retrieve. This parameter must be included in every request.

Optional Query Parameters

  • tag: Specifies the type of data to retrieve. It accepts department or unit.
  • department_code: Used to retrieve a specific unit by its department code, in combination with the company and appropriate tag.

Usage Examples

1. Get all departments

Retrieve departments belonging to a company by setting the tag to department.

GET /v1/companies/departments?company=Integration Company&tag=department

2. Get all units

Retrieve units belonging to a company by setting the tag to unit.

GET /v1/companies/departments?company=Integration Company&tag=unit

3. Get a unit by department code

Retrieve a unit using its department code by providing the department_code parameter along with the company and tag=unit.

GET /v1/companies/departments?company=Integration Company&tag=unit&department_code=PepUnit

4. Get departments and units in the same request

The endpoint supports retrieving both departments and units in a single request by passing multiple tag values as indexed query parameters.

For example:

GET /v1/companies/departments?company=Integration Company&tag[0]=unit&tag[1]=department

In this example:

  • tag[0]=unit requests units.
  • tag[1]=department requests departments.

This allows both types of data to be retrieved in one API call instead of making separate requests.

Important Notes

  • The company parameter is mandatory for all requests.
  • The tag parameter determines whether departments, units, or both are retrieved.
  • Use department_code when you need to filter for a specific unit by its code.
  • When retrieving both departments and units, use indexed tag parameters, such as tag[0] and tag[1].
  • Ensure query parameter values containing spaces, such as Integration Company, are URL-encoded when making requests. For example, use Integration%20Company.
Query Params
string
required
Defaults to SeamlessHR
string
Defaults to departments

tag : string/[array] - Optional
To get with multiple tags use in indexing [], e.g tag[0], tag[1]

string
Defaults to department

to get more than one tag

string
Defaults to unit
string
Responses

Language
Credentials
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json