> ## Documentation Index
> Fetch the complete documentation index at: https://developer.findity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create department

> Creates a new department in the given organization. Without `parentId` the department is created directly under the organization's root department; with `parentId` it is created under that department. Returns 403 when the organization does not exist or the authenticated user is not an administrator of it. Returns 404 when `parentId` is omitted and the organization has no valid root department configured.




## OpenAPI

````yaml /openapi/findity-admin-api.json post /organizations/{organizationId}/departments
openapi: 3.1.0
info:
  title: Findity Admin API
  description: Findity Admin API
  version: 1.0.0
servers:
  - url: https://stage-api.findity.com/api/v1/admin
  - url: https://api.findity.com/api/v1/admin
security:
  - bearerAuth: []
paths:
  /organizations/{organizationId}/departments:
    post:
      tags:
        - Departments
      summary: Create department
      description: >
        Creates a new department in the given organization. Without `parentId`
        the department is created directly under the organization's root
        department; with `parentId` it is created under that department. Returns
        403 when the organization does not exist or the authenticated user is
        not an administrator of it. Returns 404 when `parentId` is omitted and
        the organization has no valid root department configured.
      operationId: adminCreateDepartment
      parameters:
        - name: organizationId
          in: path
          required: true
          description: >
            String. The organization's internal ID (32-character hex string) or
            its `externalSourceId`. When the value matches the format of an
            internal ID, the internal ID takes precedence.
          schema:
            type: string
            example: 11adfe2a080040e3892ffb89c21ec44e
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AdminApiDepartmentPostRequest'
            example:
              name: Marketing
              externalSourceId: SAP-4711
              vatType: USE_CATEGORY
      responses:
        '201':
          description: Created — returns the newly created department
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminApiDepartment'
              example:
                id: 9360d03ad7294220868d67f42a2a144d
                externalSourceId: SAP-4711
                name: Marketing
                parentId: 63b7a7802a644e8ca296c9796ffa7074
                vatType: USE_CATEGORY
                customDimensionPresetValues: []
                level: 1
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/400Error'
              examples:
                Invalid JSON body:
                  value:
                    result: error
                    code: INVALID_JSON_BODY
                    description: Could not parse JSON content.
                No known properties:
                  value:
                    result: error
                    code: NO_KNOWN_JSON_PROPERTIES
                    description: No known, or only read-only properties received
                Name missing:
                  value:
                    result: error
                    code: INVALID_JSON_PROPERTY_VALUE
                    description: name is required
                Invalid vatType:
                  value:
                    result: error
                    code: INVALID_JSON_PROPERTY_VALUE
                    description: 'Invalid vatType: STANDARD'
                Name too long:
                  value:
                    result: error
                    code: FIELD_EXCEEDS_MAX_LENGTH
                    description: name exceeds maximum length of 255 characters.
                Parent department not found:
                  value:
                    result: error
                    code: INVALID_PARENT_ID
                    description: Parent department not found.
        '403':
          description: Forbidden — organization not found or access denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/403Error'
              examples:
                Organization not found or access denied:
                  value:
                    result: error
                    description: Organization not found or access denied
        '404':
          description: >-
            Not found — `parentId` omitted and the organization has no valid
            root department configured
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/404Error'
              examples:
                Department not found:
                  value:
                    result: error
                    code: DEPARTMENT_NOT_FOUND
                    description: Department not found
components:
  schemas:
    AdminApiDepartmentPostRequest:
      type: object
      required:
        - name
      properties:
        name:
          type: string
          description: >-
            Display name of the department. Must be non-empty and not
            whitespace-only. Leading and trailing whitespace is trimmed.
          maxLength: 255
        externalSourceId:
          type: string
          description: >-
            Optional external source identifier, for example the department's ID
            in an integrated system. Leading and trailing whitespace is trimmed,
            and an empty value is stored as null.
          maxLength: 255
        parentId:
          type: string
          description: >
            Optional. The `id` of the department to create this one under. It
            must be a department in the same organization. When omitted, null or
            empty, the department is created as a top-level department directly
            under the organization's root department (`level` 1).
        vatType:
          type: string
          description: >
            Optional. VAT deduction handling for the department, case-sensitive.
            Applies to this department only, whether or not `parentId` is set:
            it is not inherited from the parent department. Defaults to
            `USE_CATEGORY` when omitted, null or empty.
          enum:
            - USE_CATEGORY
            - NON_DEDUCTABLE_VAT
            - DEDUCTABLE_VAT
    AdminApiDepartment:
      type: object
      required:
        - id
        - externalSourceId
        - name
        - parentId
        - vatType
        - customDimensionPresetValues
        - level
      properties:
        id:
          type: string
          description: Unique identifier of the department.
        externalSourceId:
          type:
            - string
            - 'null'
          description: >-
            External source identifier of the department, if set by an
            integration. Null when not set.
        name:
          type: string
          description: Display name of the department.
        parentId:
          type:
            - string
            - 'null'
          description: >
            The `id` of the parent department. Null only for the organization's
            own root unit (level 0). Every other department, including a
            top-level one directly under the root, has this set to its parent's
            id.
        vatType:
          type: string
          description: >-
            VAT deduction handling for this department. Defaults to
            `USE_CATEGORY` when not explicitly set.
          enum:
            - USE_CATEGORY
            - NON_DEDUCTABLE_VAT
            - DEDUCTABLE_VAT
        customDimensionPresetValues:
          type: array
          description: >
            Preset custom dimension values configured for this department, in
            the order they were created. The order is stable, so identical
            requests return the values in the same order. Excludes values
            belonging to deleted dimension definitions.
          items:
            $ref: '#/components/schemas/AdminApiCustomDimensionPresetValue'
        level:
          type: integer
          description: >
            Depth of the department within the organization's unit hierarchy.
            The organization's implicit root unit is level 0; a genuine
            top-level department is level 1.
    400Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
    403Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        description: Not allowed
    404Error:
      type: object
      properties:
        result:
          type: string
        code:
          type: string
        description:
          type: string
      example:
        result: error
        code: ORGANIZATION_NOT_FOUND
        description: 'Failed to get organization for id: {orgId}'
    AdminApiCustomDimensionPresetValue:
      type: object
      required:
        - id
        - dimensionDefinitionId
      properties:
        id:
          type: string
          description: Unique identifier of the preset value.
        dimensionDefinitionId:
          type: string
          description: >-
            The ID of the custom dimension definition this preset value belongs
            to.
        presetListValueId:
          type:
            - string
            - 'null'
          description: >-
            The ID of the selected list value, when the dimension uses a list of
            values. Null when a free-text preset is used instead.
        presetListValueText:
          type:
            - string
            - 'null'
          description: >-
            Display text of the selected list value. Null when a free-text
            preset is used instead.
        presetStringValue:
          type:
            - string
            - 'null'
          description: >-
            Free-text preset value, when the dimension does not use a list of
            values. Null when a list value is used instead.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````