Departments
Overview
Section titled “Overview”The Departments resource provides fake department data with names, descriptions, managers, and organizational hierarchy.
Endpoints
Section titled “Endpoints”| Method | Endpoint | Description |
|---|---|---|
| GET | /v1/departments | List all departments |
| GET | /v1/departments/:id | Get a specific department |
| GET | /v1/departments/:id/employees | Get department's employees |
Department Object
Section titled “Department Object”{ "id": 1, "organizationId": 1, "name": "Engineering", "slug": "engineering", "description": "Software engineering department", "managerId": 5, "createdAt": "2026-01-15T10:30:00.000Z", "updatedAt": "2026-01-15T10:30:00.000Z"}| Field | Type | Description |
|---|---|---|
id |
number |
Unique identifier |
organizationId |
number |
ID of the parent organization |
name |
string |
Department name |
slug |
string |
URL-friendly unique slug |
description |
string |
Department description |
managerId |
number |
ID of the department manager |
createdAt |
string |
ISO 8601 timestamp |
updatedAt |
string |
ISO 8601 timestamp |
List Departments
Section titled “List Departments”curl https://api.phantomjson.app/v1/departmentsQuery Parameters
Section titled “Query Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
page |
number |
1 |
Page number |
limit |
number |
20 |
Items per page (max: 100) |
sort |
string |
— | Sort field and direction |
q |
string |
— | Search query |
fields |
string |
— | Fields to return |
organizationId |
number |
— | Filter by organization ID |
Response
Section titled “Response”{ "data": [ { "id": 1, "organizationId": 1, "name": "Engineering", "slug": "engineering", "description": "Software engineering department" } ], "meta": { "total": 25, "page": 1, "limit": 20, "totalPages": 2 }}Get Department by ID
Section titled “Get Department by ID”curl https://api.phantomjson.app/v1/departments/1Response
Section titled “Response”{ "data": { "id": 1, "organizationId": 1, "name": "Engineering", "slug": "engineering", "description": "Software engineering department", "managerId": 5 }}Get Department’s Employees
Section titled “Get Department’s Employees”curl https://api.phantomjson.app/v1/departments/1/employeesResponse
Section titled “Response”{ "data": [ { "id": 1, "organizationId": 1, "departmentId": 1, "firstName": "Alice", "lastName": "Johnson", "email": "alice@example.com", "jobTitle": "Software Engineer" } ], "meta": { "total": 15, "page": 1, "limit": 20, "totalPages": 1 }}Examples
Section titled “Examples”Search Departments
Section titled “Search Departments”curl "https://api.phantomjson.app/v1/departments?q=engineering"Filter by Organization
Section titled “Filter by Organization”curl "https://api.phantomjson.app/v1/departments?organizationId=1"Field Selection
Section titled “Field Selection”curl "https://api.phantomjson.app/v1/departments?fields=id,name,organizationId"Combined Query
Section titled “Combined Query”# Departments in organization 1, sorted by namecurl "https://api.phantomjson.app/v1/departments?organizationId=1&sort=name:asc&fields=id,name,description"Relations
Section titled “Relations”- Organization — Each department belongs to an organization (
organizationId) - Employees — Each department has many employees (access via
/v1/departments/:id/employees) - Manager — Each department may have a manager (
managerId)
