Departments

Returns the organization's list of departments — a standing reference resource that employees and schedules are tied to.

Scope

No scope is required — this endpoint is available to any valid organization key. See Scopes and permissions for details.

Query parameters

Parameter Required Description
limit no Integer 1..200, defaults to 100.
cursor no The meta.next_cursor value from the previous response — for the next page.

department_id and employee_id are not supported on this resource: passing either returns 400 validation_error (the parameter is explicitly rejected, not silently ignored — see Conventions → Filters). Departments also have no from/to — this resource has no time dimension.

Request

curl -s https://smengo.com/api/v1/departments \
  -H "Authorization: Bearer smg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

Response

{
  "data": [
    {
      "id": "9c1a2e34-5678-4abc-9def-0123456789ab",
      "name": "Кухня",
      "parent_id": null,
      "sort_order": 0,
      "color": "#f97316",
      "geo": null
    },
    {
      "id": "3f7b1c9a-2d4e-4a11-8b6f-5e0d9c2a7f31",
      "name": "Зал",
      "parent_id": null,
      "sort_order": 1,
      "color": null,
      "geo": null
    }
  ],
  "meta": { "next_cursor": null }
}

Response fields

Field Type Description
id string (uuid) The department's unique identifier.
name string The department's name.
parent_id string (uuid) | null The parent department, if departments are nested; null for a top-level department.
sort_order number The department's position in the list; the list is sorted by this field (plus id as a tiebreaker).
color string | null A hex color for the department (e.g. #f97316), used to highlight it in the schedule grid; null if no color is set.
geo string | null Free-text location/point for the department; null if not set.

Pagination

The list is sorted by sort_order, id. If there are more rows than limit, meta.next_cursor holds a cursor for the next page — pass it verbatim as cursor on the next request, without decoding it:

curl -s "https://smengo.com/api/v1/departments?limit=1&cursor=eyJrIjoxLCJpZCI6IjljMWEyZTM0LTU2NzgtNGFiYy05ZGVmLTAxMjM0NTY3ODlhYiJ9" \
  -H "Authorization: Bearer smg_live_XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"

meta.next_cursor is null once there are no more departments. Full pagination rules are in Conventions → Pagination.

What's next

  • Organization — organization data, including the timezone.
  • Employees — every employee has a department_id referencing a department from this list.
  • Conventions — response format and filters.
Was this article helpful?