Org chart
Who reports to whom: each company and, in it, each person's manager (the legal structure), and the departments across the companies with their heads (the operational one). Everyone sees it; no private details.
| Operation | Summary | Scope | Idempotency-Key |
|---|---|---|---|
GET /v1/departments |
List departments | read |
|
GET /v1/org-chart |
The org chart | read |
GET /v1/departments
List departments
The departments of the organization, by name: the one each is within, its head and how many people work in it.
| Required scope | read (admin implies every scope) |
| Operation id | list_departments_v1_departments_get |
Example request
curl "$ERP_URL/v1/departments" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | array of DepartmentOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
[
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"parent": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string"
},
"head": {
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"company": "string",
"number": "string",
"name": "string"
},
"head_left": true,
"people": 1
}
]
GET /v1/org-chart
The org chart
Both structures of the organization at once. The legal one: each company and, in it, whom
each person reports to (manager). The operational one: the departments across the
companies, each within another or not, with its head, and each person's department and
department head. Everyone who works there now or starts later; no private details.
| Required scope | read (admin implies every scope) |
| Operation id | org_chart_v1_org_chart_get |
Example request
curl "$ERP_URL/v1/org-chart" \
-H "Authorization: Bearer $ERP_KEY"
Responses
| Status | Meaning | Body |
|---|---|---|
| 200 | OK | OrgChartOut |
| 401 | Missing or invalid API key (unauthorized). |
ErrorEnvelope |
| 403 | The caller lacks the required scope (missing_right, with scope), the key belongs to no person where a person is needed (forbidden), or the approval policy denies the action (policy_denied, with action and rule_id). |
ErrorEnvelope |
| 422 | Validation failed: the error envelope (validation_failed). For a malformed body or parameter its message is in sentences ("Line 2: the quantity must be above zero") and fields lists each error with pydantic's loc, type and msg beside its sentence (message) and its parts, to word it in another language: items (name and number from 1: line 2), field (its name as sent) and the rule it breaks with its limit, count and choices (none for a validator's own sentence); FastAPI's own detail list stays beside the envelope. |
HTTPValidationError |
Example response (shape)
{
"companies": [
{
"code": "string",
"name": "string",
"country": "string"
}
],
"departments": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"name": "string",
"parent": null,
"head": null,
"head_left": true,
"people": 1
}
],
"people": [
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"entity": "string",
"company": "string",
"number": "string",
"name": "string",
"job_title": "string",
"status": "active",
"start_date": "2026-09-21",
"end_date": "2026-09-21",
"work_percent": "string",
"manager": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"department": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"department_head": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
]
}
Schemas
OrgChartOut
| Field | Type | Required | Description |
|---|---|---|---|
companies |
array of OrgCompanyOut |
yes | The companies, by code. |
departments |
array of DepartmentOut |
yes | The departments, by name. |
people |
array of OrgPersonOut |
yes | Everyone who works there now or starts later (not who left), by last name. |
OrgCompanyOut
| Field | Type | Required | Description |
|---|---|---|---|
code |
string | yes | The company's code. |
name |
string | yes | Its name. |
country |
string | yes | Its country, CH. |
OrgPersonOut
| Field | Type | Required | Description |
|---|---|---|---|
id |
string (uuid) | yes | Their employee id. |
entity |
string | yes | The code of their company. |
company |
string | yes | The name of their company. |
number |
string | yes | Their employee number in that company, E-00001. |
name |
string | yes | Their first and last name. |
job_title |
string | yes | Their job title. |
status |
"active" | "leaving" | "left" | "starting" |
yes | starting or active; leaving only for whoever opens People (to everyone else a leaver is active until they have left). |
start_date |
string (date) | yes | Their first day of work. |
end_date |
string (date) or null | yes | Their last day, for whoever opens People; else null. |
work_percent |
string or null | yes | How much of a full-time week they work, 0 to 100, for whoever opens People; else null. (pattern ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$) |
manager |
string (uuid) or null | yes | The employee id of who they report to in their company; null: nobody. |
department |
string (uuid) or null | yes | The id of their department; null: none. |
department_head |
string (uuid) or null | yes | The employee id of their department head (for a head, the one above); null: nobody. |