# Retrieve content item hierarchy

Fetches the tree structure of a content item, its parents, or its children. Use this endpoint when you know the identifier of the root item, for example, if you want to fetch the structure of a treelist field with a defined content item source.

Endpoint: GET /api/v1/content-items/{contentItemId}/hierarchy
Version: v1
Security: Bearer

## Security:

  - `Bearer` (unknown)
    http Bearer

## Path parameters:

  - `contentItemId` (string, required)
    The identifier of the content item root item.

## Query parameters:

  - `ChildrenModelIds` (array)
    Identifiers of the child content types (base templates). Only child content items of the content types specified by these ids will be returned.

  - `Language` (string)
    The language of the content items

  - `environmentId` (string)
    The environment identifier. Defaults to "main". Currently only "main" is supported.

## Response 200:

  - `200` (unknown)
    Successful operation

## Response 200 fields (application/json):

  - `hasChildren` (boolean)
    Whether the content item has any child pages.
    Example: true

  - `hasPresentation` (boolean)
    Whether the content item has presentation. An item with presentation is an item with a layout assigned.
    Example: true

  - `children` (array)
    Child content items, represented as "HierarchyItem" objects. Each object has the same structure as the root content item in the response.
    Example: [{"hasChildren":false,"hasPresentation":false,"children":null,"ancestors":null,"insertOptions":null,"baseContentModels":null,"id":"059a5e63-6fca-44ea-be8b-e0b7919895f6","name":"My item","displayName":…

  - `children.hasChildren` (boolean)
    Whether the content item has any child pages.
    Example: true

  - `children.hasPresentation` (boolean)
    Whether the content item has presentation. An item with presentation is an item with a layout assigned.
    Example: true

  - `children.children` (array)
    Child content items, represented as "HierarchyItem" objects. Each object has the same structure as the root content item in the response.
    Example: [{"hasChildren":false,"hasPresentation":false,"children":null,"ancestors":null,"insertOptions":null,"baseContentModels":null,"id":"059a5e63-6fca-44ea-be8b-e0b7919895f6","name":"My item","displayName":…

  - `children.ancestors` (array)
    Ancestor content items, represented as "HierarchyItem" objects. Each object has the same structure as the root content item in the response.
    Example: [{"hasChildren":true,"hasPresentation":false,"children":null,"ancestors":null,"baseContentModels":["1930bbeb7805471aa3be4858ac7cf696"],"id":"3875AC96-8ECF-44AE-8E25-851068B373CE","insertOptions":null,…

  - `children.insertOptions` (array)
    Insert options of the content item. Insert options control which types of new items can be created beneath a specific item in the content tree.

  - `children.insertOptions.id` (string)
    The content type identifier
    Example: d4e5f6a7-b8c9-0123-4567-89abcdef0123

  - `children.insertOptions.name` (string)
    The content type name.
    Example: Promo

  - `children.insertOptions.created` (string)
    The content type creation date.
    Example: 2024-01-01T12:00:00Z

  - `children.insertOptions.createdBy` (string)
    The content type author.
    Example: sitecore\admin

  - `children.insertOptions.updated` (string)
    The content type last update date.
    Example: 2024-01-02T12:00:00Z

  - `children.insertOptions.updatedBy` (string)
    The author of the last update to the content type.
    Example: sitecore\admin

  - `children.baseContentModels` (array)
    Base content type IDs of the content item.

  - `children.id` (string)
    The content item identifier.
    Example: 37265ed7-85cf-4876-9c09-b6590fc6cf3a

  - `children.name` (string)
    The content item name.
    Example: My content item

  - `children.displayName` (string)
    The content item display name.
    Example: My content item display name

  - `children.language` (string)
    The content item language.
    Example: en

  - `children.version` (integer)
    The content item version.
    Example: 1

  - `children.templateId` (string)
    The template identifier.
    Example: 97265ed7-85cf-4876-9c09-b6590fc6cf3a

  - `children.path` (string)
    The content item path
    Example: /sitecore/content/Home

  - `children.permissions` (object)
    The access rights of the current user to the site.

  - `children.permissions.canAdmin` (boolean)
    Whether the current user has admin rights
    Example: true

  - `children.permissions.canWrite` (boolean)
    Whether the current user has permissions to edit values
    Example: true

  - `children.permissions.canCreate` (boolean)
    Whether the current user has permissions to create entities
    Example: true

  - `children.permissions.canDelete` (boolean)
    Whether the current user has permissions to delete entities
    Example: true

  - `children.permissions.canRename` (boolean)
    Whether the current user has permissions to rename  entities
    Example: true

  - `children.permissions.canRead` (boolean)
    Whether the current user has permissions to see  entities
    Example: true

  - `children.permissions.canPublish` (boolean)
    Whether the current user has permissions to publish sites in this environment
    Example: true

  - `children.permissions.canDuplicate` (boolean)
    Whether the current user has permissions to duplicate entities
    Example: true

  - `children.permissions.canWriteLanguage` (boolean)
    Whether the current user has permissions to write item language entities
    Example: true

  - `children.system` (object)

  - `children.system.created` (string)
    The creation time.
    Example: 2024-01-15T10:30:00Z

  - `children.system.createdBy` (string)
    The creator.
    Example: sitecore admin

  - `children.system.updated` (string)
    The last updating time.
    Example: 2024-01-15T10:30:00Z

  - `children.system.updatedBy` (string)
    The last updater.
    Example: sitecore admin

  - `ancestors` (array)
    Ancestor content items, represented as "HierarchyItem" objects. Each object has the same structure as the root content item in the response.
    Example: [{"hasChildren":true,"hasPresentation":false,"children":null,"ancestors":null,"baseContentModels":["1930bbeb7805471aa3be4858ac7cf696"],"id":"3875AC96-8ECF-44AE-8E25-851068B373CE","insertOptions":null,…

  - `insertOptions` (array)
    Insert options of the content item. Insert options control which types of new items can be created beneath a specific item in the content tree.

  - `baseContentModels` (array)
    Base content type IDs of the content item.

  - `id` (string)
    The content item identifier.
    Example: 37265ed7-85cf-4876-9c09-b6590fc6cf3a

  - `name` (string)
    The content item name.
    Example: My content item

  - `displayName` (string)
    The content item display name.
    Example: My content item display name

  - `language` (string)
    The content item language.
    Example: en

  - `version` (integer)
    The content item version.
    Example: 1

  - `templateId` (string)
    The template identifier.
    Example: 97265ed7-85cf-4876-9c09-b6590fc6cf3a

  - `path` (string)
    The content item path
    Example: /sitecore/content/Home

## Response 400:

  - `400` (unknown)
    Invalid input format

## Response 400 fields (application/json):

  - `type` (string)
    The type of the error response entity.

  - `title` (string)
    The title of the error response entity.

  - `status` (integer)
    The response status code.

  - `detail` (string)
    A detailed explanation, specific to this occurrence of the problem.

  - `instance` (string)
    If available, a URI reference that identifies the specific occurrence of the problem.

## Response 404:

  - `404` (unknown)
    Invalid content item ID

## Response 404 fields (application/json):

  - `type` (string)
    The type of the error response entity.

  - `title` (string)
    The title of the error response entity.

  - `status` (integer)
    The response status code.

  - `detail` (string)
    A detailed explanation, specific to this occurrence of the problem.

  - `instance` (string)
    If available, a URI reference that identifies the specific occurrence of the problem.

