---
title: "Upsert hierarchy"
method: POST
path: "/api/hierarchy/upsert"
tags: ["Hierarchy"]
---

# Upsert hierarchy

`POST /api/hierarchy/upsert`

The upsert method is used to insert hierarchy records.  The hierarchy records are often categories or departments. There is a limit of 125 hierarchy objects that can be sent in a request.  This method can be called multiple times to accommodate more than 125.  After all hierarchy objects have been sent, the hierarchy/rebuild method can be used.

## Headers

- `X-HawkSearch-ApiKey` string, required

## Request body

- CreateHierarchyParams — Create hierarchy params
  - `IndexName` string — Index used for operation
  - `Hierarchies` HierarchyModel[] — Array of categories
    - `HierarchyId` string — Id of a category
    - `Name` string — Category Name
    - `ParentHierarchyId` string — Id of parent category
    - `IsActive` boolean — Is Active ?
    - `SortOrder` integer — Sort order of a category
    - `Url` string — Url of hierarchy
    - `ImageUrl` string — Image Url
    - `Custom` string — Custom field

## Response `200`

OK

- object

---

[API](https://skmtc.net/hawksearch/apis/hawksearch-elasticsearch-indexingapi.md) · [All operations](https://skmtc.net/hawksearch/apis/hawksearch-elasticsearch-indexingapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hawksearch/hawksearch-elasticsearch-indexingapi/revisions/24cba7bf3468/schema)
