# Retrieves an Org Unit. - Returns the requested Org Unit. - Supports enriching the response by providing options via query params, e.g. include_ancestors. # OpenAPI definition ```json { "openapi": "3.0.3", "info": { "title": "Organization Management", "description": "Collection of endpoints to manage Org Units.", "version": "2.0.0" }, "servers": [ { "url": "https://api.personio.de" } ], "security": [ { "BearerAuth": [] } ], "paths": { "/v2/org-units/{id}": { "get": { "summary": "Retrieves an Org Unit.", "description": "- Returns the requested Org Unit.\n- Supports enriching the response by providing options via query params, e.g. include_ancestors.", "operationId": "getOrgUnit", "tags": [ "Org Units" ], "parameters": [ { "in": "path", "name": "id", "required": true, "description": "The ID of the Org Unit to be retrieved, e.g. the Org Unit ID associated with an Employment OR the Parent ID of another Org Unit.", "schema": { "type": "integer", "format": "int64" } }, { "$ref": "#/components/parameters/type" }, { "$ref": "#/components/parameters/include_parent_chain" } ], "x-path-examples": { "200 Success - Retrieve Org Unit by ID": { "value": "/public/organization/papi/v2/org-units/231", "query": "type=department" }, "200 Success - Retrieve Org Unit by ID with Parent Chain": { "value": "/public/organization/papi/v2/org-units/231", "query": "type=department&include_parent_chain=true" } }, "responses": { "200": { "description": "Successful response.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/OrgUnit" }, "examples": { "200 Success - Retrieve Org Unit by ID": { "$ref": "#/components/examples/GetOrgUnitResponse" }, "200 Success - Retrieve Org Unit by ID with Parent Chain": { "$ref": "#/components/examples/GetOrgUnitWithParentChainResponse" } } } } }, "404": { "description": "The Org Unit with the provided id could not be found.", "content": { "application/problem+json": { "schema": { "$ref": "#/paths/~1v2~1org-units/get/responses/400/content/application~1problem%2Bjson/schema" } } } }, "412": { "description": "The Org Unit feature is disabled.", "content": { "application/problem+json": { "schema": { "$ref": "#/paths/~1v2~1org-units/get/responses/400/content/application~1problem%2Bjson/schema" } } } } } } } }, "components": { "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } }, "parameters": { "type": { "in": "query", "name": "type", "required": true, "description": "The type of the Org Unit to be retrieved, e.g. team or department.", "schema": { "type": "string" } }, "include_parent_chain": { "in": "query", "name": "include_parent_chain", "required": false, "description": "- Whether or not to include the Parent Org Unit Chain of the requested Org Unit in the response.\n- When used on the single-resource endpoint, each Org Unit in the chain includes full details (e.g. name, description, abbreviation). When used on the list endpoint, only the Org Unit IDs are returned.\n- Starts from the requested Org Unit's parent to the last chained Org Unit.\n- The `parent_id` property can be used to assert the link between Org Units.", "schema": { "type": "boolean", "default": false } } }, "schemas": { "OrgUnit": { "type": "object", "description": "Defines a Org Unit.", "required": [ "id", "type", "name", "create_time" ], "properties": { "id": { "$ref": "#/components/schemas/OrgUnitId" }, "type": { "$ref": "#/components/schemas/OrgUnitType" }, "name": { "$ref": "#/components/schemas/OrgUnitName" }, "resource_uri": { "$ref": "#/components/schemas/OrgUnitResourceUri" }, "abbreviation": { "$ref": "#/components/schemas/OrgUnitAbbreviation" }, "description": { "$ref": "#/components/schemas/OrgUnitDescription" }, "parent_id": { "$ref": "#/components/schemas/OrgUnitParentId" }, "create_time": { "$ref": "#/components/schemas/OrgUnitCreateTime" }, "parent_chain": { "$ref": "#/components/schemas/OrgUnitParentChain" }, "_meta": { "description": "This object represents the metadata information for an object. It's a set of arbitrary key/value attributes such as `links`.", "type": "object", "readOnly": true, "properties": { "links": { "type": "object", "additionalProperties": { "description": "This objects represents a hyperlink.", "type": "object", "readOnly": true, "properties": { "href": { "type": "string", "format": "uri" } }, "additionalProperties": true }, "example": { "links": { "self": { "href": "https://api.personio.de/v2/person?cursor=" } } } } } } } }, "OrgUnitId": { "type": "string", "description": "The Internal ID of this OrgUnit.", "example": "1" }, "OrgUnitType": { "type": "string", "description": "The type of this OrgUnit. Currently supporting team and department.", "example": "team" }, "OrgUnitName": { "type": "string", "description": "The name of this OrgUnit.", "example": "My Team" }, "OrgUnitResourceUri": { "type": "string", "description": "The resource link of this OrgUnit.", "example": "https://example.com/mynewteam" }, "OrgUnitAbbreviation": { "type": "string", "description": "The abbreviation of this OrgUnit.", "example": "DM" }, "OrgUnitDescription": { "type": "string", "description": "The description of this OrgUnit.", "example": "The new best team." }, "OrgUnitParentId": { "type": "string", "description": "The ID of the parent of this org unit.", "example": "2" }, "OrgUnitCreateTime": { "type": "string", "format": "date-time", "description": "The creation time of this org unit." }, "OrgUnitParentChain": { "description": "The ordered Org Unit (all-details) chain starting from the requested Org Unit's parent.", "type": "array", "items": { "$ref": "#/components/schemas/ParentOrgUnit" } }, "ParentOrgUnit": { "type": "object", "description": "Defines a Parent Org Unit.", "required": [ "id", "type", "name", "create_time" ], "properties": { "id": { "$ref": "#/components/schemas/OrgUnitId" }, "type": { "$ref": "#/components/schemas/OrgUnitType" }, "name": { "$ref": "#/components/schemas/OrgUnitName" }, "resource_uri": { "$ref": "#/components/schemas/OrgUnitResourceUri" }, "abbreviation": { "$ref": "#/components/schemas/OrgUnitAbbreviation" }, "description": { "$ref": "#/components/schemas/OrgUnitDescription" }, "parent_id": { "type": "string", "example": null }, "create_time": { "$ref": "#/components/schemas/OrgUnitCreateTime" }, "_meta": { "$ref": "#/components/schemas/OrgUnit/properties/_meta" } } } }, "examples": { "GetOrgUnitResponse": { "value": { "id": "231", "name": "My Department", "type": "department", "abbreviation": "MDX", "description": "My Department described", "resource_uri": "https://www.personio.de/mdx", "create_time": "2024-03-27T08:22:04Z", "_meta": { "links": { "self": { "href": "https://api.personio.de/v2/org-units/231?type=department" } } } } }, "GetOrgUnitWithParentChainResponse": { "value": { "id": "231", "name": "My Department", "type": "department", "abbreviation": "MDX", "description": "My Department described", "resource_uri": "https://www.personio.de/mdx", "create_time": "2024-03-27T08:22:04Z", "parent_id": "123", "parent_chain": [ { "id": "123", "name": "My Parent Department", "type": "department", "abbreviation": "1stMDX", "description": "My Parent described", "resource_uri": "https://www.personio.de/1stmdx", "create_time": "2024-03-27T08:22:04Z", "parent_id": null, "_meta": { "links": { "self": { "href": "https://api.personio.de/v2/org-units/123?type=department" } } } } ], "_meta": { "links": { "self": { "href": "https://api.personio.de/v2/org-units/231?type=department&include_parent_chain=true" }, "parent": { "href": "https://api.personio.de/v2/org-units/123?type=department&include_parent_chain=true" } } } } } } } } ```