Discussions

Ask a Question
Back to all

Cannot seem to query department name via v2 API

Been trying to get the department information from the v2 API, without any luck.

  1. I do a GET on "https://api.personio.de/v2/persons?limit=1" for 1 user.
  2. From this result I can use the "id" to further query the employee itself via "https://api.personio.de/v2/persons/$id/employments"
  3. From the results I can get back a hashtable called "org_units" with both a "team" and "department" id inside.

Sadly thats where it stops. I have tried ...

  1. $departmentHash = $response.data.org_units | where-object {$.type -eq "department"}
    via /v2/org-units/$($p.id)?type=$($departmentHash) and get back
    Invoke-RestMethod:
    {
    "personio_trace_id": "68009adb-8975-4b18-bc70-4464b4e100a7",
    "timestamp": "2026-01-13T15:05:04Z",
    "errors": [
    {
    "title": "Not Found",
    "detail": "The endpoint with /v2/org-units/<persion_id> was not found.",
    "type": "https://developer.personio.de/v2.0/page/public-api-error-codes#apinot_found",
    "_meta": {
    "path": "/v2/org-units/<persion_id>"
    }
    }
    ]
    }

  1. via https://developer.personio.de/discuss/67d02dda07caa4000f0a4d10 and https://developer.personio.de/v1.0/reference/get_company-employees
    -> $orgg = "https://api.personio.de/v1/company/employees?email=$($person.email)"
    -> $orgg = "https://api.personio.de/v1/company/employees?limit=10"
    Both the above resulting in
    Invoke-RestMethod:
    {
    "success": false,
    "error": {
    "message": "personio.core.api.exceptions.api.forbidden.http.exception",
    "code": 0
    }
    }
    -> $orgg = "http://api.personio.de/v1/company/employees?limit=10"
    Invoke-RestMethod:
    {
    "success": false,
    "error": {
    "message": "Provided authorization is not valid",
    "code": 401
    }
    }

My API permissions are:

    employees:read
    personio:webhooks:read
    personio:org-units:read
    personio:legal-entities:read
    personio:persons:read