---
updatedAt: 2026-06-12T14:08:37.000Z
agentTools:
  projectIndex: https://developer.crunchtime.com/llms.txt
---

# saveHierarchyV2

Create a new hierarchy. 
 Update a hierarchy's details. 
 Delete a hierarchy.

# OpenAPI definition

```json
{
  "openapi": "3.0.0",
  "info": {
    "description": "Swagger documentation supporting mobile development of Crunchtime.",
    "version": "2.99",
    "title": "Inventory & Labor",
    "termsOfService": "http://springfox.io",
    "contact": {
      "name": "Crunchtime Development Team",
      "url": "http://www.crunchtime.com",
      "email": "apiquestions@crunchtime.com"
    },
    "license": {
      "name": "Apache License Version 2.0",
      "url": "https://github.com/springfox/springfox/blob/master/LICENSE"
    }
  },
  "tags": [
    {
      "name": "Hierarchy Service",
      "description": "The Hierarchy Service is used to group locations together for reporting purposes. For example, if the company is a national restaurant chain divided into six regions, setting up the hierarchy configuration allows each regional manager to view revenue, cost and consumption data (reports) only for the stores in his or her region. To associate a user, such as the regional manager, to a specific hierarchy, reference the Application User Service."
    }
  ],
  "paths": {
    "/hierarchy/v2/saveHierarchy": {
      "post": {
        "tags": [
          "Hierarchy Service"
        ],
        "summary": "saveHierarchyV2",
        "description": "Create a new hierarchy. \n Update a hierarchy's details. \n Delete a hierarchy.",
        "operationId": "saveHierarchyV2UsingPOST",
        "parameters": [
          {
            "name": "authenticationtoken",
            "in": "header",
            "description": "Secure token for API authentication.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "password",
            "in": "header",
            "description": "Password for the Crunchtime Application User.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sitename",
            "in": "header",
            "description": "Crunchtime site identifier. (test or production)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "userid",
            "in": "header",
            "description": "User ID for the Crunchtime Application User.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-B3-TraceId",
            "in": "header",
            "description": "Optional trace identifier for troubleshooting.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HierarchyV2DetailsList"
              }
            }
          },
          "description": "hierarchy",
          "required": true
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "*/*": {
                "schema": {
                  "type": "object"
                }
              },
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "400": {
            "description": "Validation Error",
            "content": {
              "*/*": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ObjectError"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/ObjectError"
                  }
                }
              }
            }
          },
          "401": {
            "description": "Authorization",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "500": {
            "description": "Unexpected Error",
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/HierarchyV2Details"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HierarchyV2Details"
                }
              }
            }
          },
          "503": {
            "description": "System under maintenance",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "504": {
            "description": "Timeout",
            "content": {
              "*/*": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    }
  },
  "externalDocs": {
    "description": "Crunchtime Developer Hub",
    "url": "https://developer.crunchtime.com/"
  },
  "servers": [
    {
      "url": "//webservices-test.net-chef.com"
    }
  ],
  "components": {
    "schemas": {
      "HierarchyDetailDto": {
        "type": "object",
        "required": [
          "levelDescription",
          "levelName",
          "levelNumber"
        ],
        "properties": {
          "hasChildren": {
            "type": "boolean",
            "description": "\"hasChildren\" from Hierarchy setup screen"
          },
          "levelDescription": {
            "type": "string",
            "example": "Regions",
            "description": "\"levelDescription\" from Hierarchy setup screen"
          },
          "levelName": {
            "type": "string",
            "example": "Reg",
            "description": "\"levelName\" from Hierarchy setup screen"
          },
          "levelNumber": {
            "type": "integer",
            "format": "int64",
            "example": 2,
            "description": "\"levelNumber\" from Hierarchy setup screen"
          },
          "locationCode": {
            "type": "string",
            "example": "000000",
            "description": "\"locationCode\" from Hierarchy setup screen"
          },
          "locationName": {
            "type": "string",
            "description": "\"locationName\" from Hierarchy setup screen"
          },
          "logicalName": {
            "type": "string",
            "example": "Northeast",
            "description": "\"logicalName\" from Hierarchy setup screen"
          },
          "parentLogicalName": {
            "type": "string",
            "example": "Corporate",
            "description": "\"parentLogicalName\" from Hierarchy setup screen"
          }
        },
        "title": "HierarchyDetailDto",
        "description": "Hierarchy Detail description"
      },
      "HierarchyHeaderDto": {
        "type": "object",
        "required": [
          "hierarchyType",
          "locationCode"
        ],
        "properties": {
          "deleteFlag": {
            "type": "string",
            "example": "N",
            "description": "\"deleteFlag\" from Hierarchy setup screen"
          },
          "hierarchyType": {
            "type": "string",
            "example": "HierarchyType1",
            "description": "\"hierarchyType\" from Hierarchy setup screen"
          },
          "locationCode": {
            "type": "string",
            "example": "000000",
            "description": "\"locationCode\" from Hierarchy setup screen"
          }
        },
        "title": "HierarchyHeaderDto",
        "description": "Hierarchy Header description"
      },
      "HierarchyV2Details": {
        "type": "object",
        "required": [
          "hierarchyDetailDetails",
          "hierarchyHeaderDetails"
        ],
        "properties": {
          "hierarchyDetailDetails": {
            "type": "array",
            "example": [
              {
                "levelNumber": 1,
                "levelName": "Corp",
                "levelDescription": "Corporate",
                "logicalName": "Corporate",
                "parentLogicalName": "",
                "locationCode": ""
              },
              {
                "levelNumber": 2,
                "levelName": "Reg",
                "levelDescription": "Regions",
                "logicalName": "Northeast",
                "parentLogicalName": "Corporate",
                "locationCode": ""
              },
              {
                "levelNumber": 3,
                "levelName": "Store",
                "levelDescription": "Stores",
                "logicalName": "",
                "parentLogicalName": "Northeast",
                "locationCode": "Test11"
              },
              {
                "levelNumber": 3,
                "levelName": "Store",
                "levelDescription": "Stores",
                "logicalName": "",
                "parentLogicalName": "Northeast",
                "locationCode": "Test12"
              }
            ],
            "description": "\"hierarchyDetailDetails\" from Hierarchy setup screen",
            "items": {
              "$ref": "#/components/schemas/HierarchyDetailDto"
            }
          },
          "hierarchyHeaderDetails": {
            "$ref": "#/components/schemas/HierarchyHeaderDto"
          }
        },
        "title": "HierarchyV2Details",
        "description": "HierarchyV2Details description"
      },
      "HierarchyV2DetailsList": {
        "type": "object",
        "properties": {
          "hierarchyDetails": {
            "$ref": "#/components/schemas/HierarchyV2Details"
          }
        },
        "title": "HierarchyV2DetailsList",
        "description": "HierarchyV2DetailsList description"
      },
      "ObjectError": {
        "type": "object",
        "properties": {
          "arguments": {
            "type": "array",
            "items": {
              "type": "object"
            }
          },
          "code": {
            "type": "string"
          },
          "codes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "defaultMessage": {
            "type": "string"
          },
          "objectName": {
            "type": "string"
          }
        },
        "title": "ObjectError"
      }
    }
  }
}
```