Create a department
Makes a department. Names are unique among the departments that aren't archived: a name already in use returns
conflict. A parent_id must be one of your departments that isn't archived, and head_id someone in your
directory.
- Fires
department.created.
Scope: hr:write · Plan: Pro and Enterprise in live mode; every plan in test mode.
AuthorizationBearer <token>Send Authorization: Bearer <token> on every request. The token is one of:
| Prefix | What it is | Where it may be used |
|---|---|---|
agoo_sk_live_ | Secret key, live mode | Your servers only |
agoo_sk_test_ | Secret key, test mode | Your servers only |
agoo_pk_live_ | Publishable key, live mode | Browsers and apps: create pre-registrations and bookings, read public booking types (with their intake questions) and their free slots, read the visit types open for pre-registration with their public forms. Never lists people. |
agoo_pk_test_ | Publishable key, test mode | As above, in test mode |
Admins create keys in Console → Developers → API keys and choose each key's scopes. A key is shown once. Never put a secret key in a URL, a browser or a mobile app.
Scope: hr:write
Idempotency-Key*stringA UUID you generate for this operation. If you retry with the same key within 24 hours, Agoo returns the
original response instead of acting twice. While the first request is still running, a retry returns
conflict. Reusing a key with a different request returns idempotency_key_reused. Responses with
rate_limited, internal_error or unavailable aren't stored, so retry those with the same key.
uuidapplication/json- body
A new department.
name*string1 <= length <= 120code?stringUp to 20 letters, digits, spaces, dots, dashes, underscores or slashes, starting with a letter or digit.
length <= 20parent_id?DepartmentIdThe department it sits under: one of yours that isn't archived.
^dept_[0-7][0-9a-hjkmnp-tv-z]{25}$"dept_01kjsd2v80e5q7m3c9x4ht6wfa"head_id?PersonIdThe person who heads it.
^person_[0-7][0-9a-hjkmnp-tv-z]{25}$"person_01kjsesxm0e4zbyvkr7bcfxbfg"cost_centre?stringlength <= 60The new department.
application/json- response
One of your organisation's departments. A person's department is the name of their department.
id*DepartmentIdA department ID (TypeID with the dept prefix).
^dept_[0-7][0-9a-hjkmnp-tv-z]{25}$"dept_01kjsd2v80e5q7m3c9x4ht6wfa"object*"department""department"name*stringUnique among the departments that aren't archived.
1 <= length <= 120"Treasury"code*|Your own short code for it.
length <= 20"TRY"parent_id*|The department it sits under. null: at the top.
head_id*|The person who heads it. null: no one is named.
cost_centre*|length <= 60"CC-210"archived*booleantrue for a department that's archived: kept, with its history, but not offered for new people.
people*integerHow many active people are in it.
0 <= valuecreated_at*stringdate-timeupdated_at*stringdate-timecurl -X POST 'https://api.agoohq.com/v1/departments' \ -H 'Idempotency-Key: 3f6b2a1e-8c4d-4f7a-9b2e-5d1c0a7e9f64' \ -H 'Content-Type: application/json' \ -d '{ "name": "Treasury", "code": "TRY", "parent_id": "dept_01kjsd1qg0f2n8r5bz7ke3yc4d", "head_id": "person_01kjsesxm0e4zbyvkr7bcfxbfg", "cost_centre": "CC-210"}'{ "id": "dept_01kjsd2v80e5q7m3c9x4ht6wfa", "object": "department", "name": "Treasury", "code": "TRY", "parent_id": "dept_01kjsd1qg0f2n8r5bz7ke3yc4d", "head_id": "person_01kjsesxm0e4zbyvkr7bcfxbfg", "cost_centre": "CC-210", "archived": false, "people": 0, "created_at": "2026-10-19T09:00:00Z", "updated_at": "2026-10-19T09:00:00Z"}List departments GET
Returns your organisation's departments by name, each with the department it sits under, its head, code, cost centre and how many active people are in it. Archived departments are left out unless you ask for them with `archived=true`. A person's `department` is the name of their department. **Scope:** `people:read` · **Plan:** Pro and Enterprise in live mode; every plan in test mode.
Get a department GET
Returns one department, archived or not. **Scope:** `people:read` · **Plan:** Pro and Enterprise in live mode; every plan in test mode.