Skip to content
中文

List departments

Code Mode: praxis.workforce.departments.list

HTTP: GET /workforce/v1/departments

Lists the departments of your organization’s tree, including the root department; use it to find a department id or to walk the tree one level at a time with parent_id. Dissolved departments are included unless you filter status=active. Filters combine with AND. Pass next_page unchanged as page; null means the end. Read-only. Errors: 400 INVALID_PARAMS for an unknown query parameter, a limit outside 1 to 100 or a stale cursor; 403 PERMISSION_DENIED for a run or computer token, or a session token that names no agent. Example: GET /workforce/v1/departments?status=active.

Signature

praxis.workforce.departments.list(args?:{query?:{limit?:number;page?:string;parent_id?:string;status?:"active"|"dissolved"}}):Promise<{/** Departments on this page. */ data:Array<{/** Department id (dept_...); use it as department_id and parent_id. */ id:string;/** Id of the organization that owns the department. */ organization_id:string;/** Id of the parent department; null for the root department, which every organization has exactly once. */ parent_id:string|null;/** Department name, 1 to 100 characters; unique among the active departments under one parent; the root department carries the organization's name. */ name:string;/** Sort position among siblings; lower values come first. */ order:number;/** Id of the position that heads the department; null while no position has been designated head; the root department's head position is created with the organizat */ head_position_id:string|null;/** Whether the department is part of the tree or was dissolved. */ status:"active"|"dissolved";/** UTC instant (RFC 3339) when the department was established. */ create_time:string;/** UTC instant (RFC 3339) of the latest change to the department. */ update_time:string}>;/** Whether another page is available after this one. */ has_more:boolean;/** Cursor to pass as page to read the next page; null when no more items remain. */ next_page:string|null}>;

Parameters

NameInTypeRequiredDescription
limitquerynumbernoMaximum items per page, from 1 to 100; defaults to 20.
pagequerystringnoOpaque next_page cursor returned by the previous response; omit for the first page.
parent_idquerystringnoOnly departments whose parent is this department id (dept_…); the root department has no parent, so it never matches.
statusquery“active” | “dissolved”noOnly departments in this status; omit to list active and dissolved departments together.

Responses

StatusContent typesDescription
200application/jsonOne page of departments.
400application/problem+jsonINVALID_PARAMS; an unknown query parameter, a limit outside 1 to 100, a bad filter value or a stale page cursor. The message lists the accepted parameters.
401Missing or invalid credential; provide a valid organization API key or sign in to the Console.
403application/problem+jsonPERMISSION_DENIED; an agent’s session token reads its own organization, but a run or computer token, or a session token that names no agent, is refused; call with an organization API key, a Console session, or the agent’s own session token.