# List hierarchies Lists hierarchies and their levels. # OpenAPI definition ```json { "openapi": "3.0.0", "info": { "title": "Banking - Transaction banking", "version": "0.9.0", "description": "Transaction banking API", "contact": { "name": "API Support", "url": "https://developers.pismo.io/support/" }, "license": { "name": "Copyright Pismo" } }, "servers": [ { "url": "https://sandbox.pismolabs.io", "description": "Sandbox API server for testing" } ], "security": [ { "BearerAuth": [] } ], "tags": [ { "name": "Hierarchies", "description": "Hierarchy-related endpoints" } ], "components": { "parameters": { "CursorQuery": { "name": "cursor", "in": "query", "description": "Cursor to the next page of results. If no value is specified, it fetches the first page.", "schema": { "type": "string" }, "example": "1234" }, "LimitQuery4": { "name": "limit", "in": "query", "description": "Maximum number of items per page. Defaults to `10`", "schema": { "type": "integer", "format": "int32", "default": 10 }, "example": 20 } }, "schemas": { "Cursor": { "type": "string", "description": "Cursor pointing to the next page of results", "example": "eyJJRCI6IjBjOGVhMTA4LWNhZTYtNDA2Mi1iMmQzLTFhMTZkNmJiNGIyOCIsIk9yZ0lEIjoiMDllYThhMDQtNWY5My0xMWVkLTliNmEtMDI0MmFjMTIwMDAyIn0=" }, "ErrorCode": { "description": "Error code\n`minLength: 1`\n`maxLength: 12`\n", "type": "string", "minLength": 1, "maxLength": 12, "example": "WPMT0017" }, "ErrorMessage": { "description": "Error message\n`minLength: 1`\n`maxLength: 1000`\n", "type": "string", "minLength": 1, "maxLength": 1000, "example": "Invalid JSON payload received: Error unmarshalling request" }, "ErrorResponse": { "type": "object", "properties": { "code": { "$ref": "#/components/schemas/ErrorCode" }, "message": { "$ref": "#/components/schemas/ErrorMessage" } } }, "GetHierarchiesResponse": { "title": "GetHierarchiesResponse", "type": "object", "properties": { "hierarchies": { "type": "array", "description": "List of hierarchies data", "items": { "type": "object", "required": [ "id" ], "properties": { "id": { "$ref": "#/components/schemas/HierarchyID" }, "name": { "$ref": "#/components/schemas/HierarchyName" }, "level": { "$ref": "#/components/schemas/Level" } } } }, "pagination": { "$ref": "#/components/schemas/Pagination" } }, "required": [ "hierarchies", "pagination" ] }, "HierarchyID": { "type": "string", "description": "Hierarchy ID generated by the [Create hierarchy](https://developers.pismo.io/pismo-docs/reference/post-hierarchies) endpoint.", "format": "uuid", "maxLength": 36, "example": "9bb95e15-c0e6-4c84-b644-350c76a83358" }, "HierarchyLevelDescription": { "type": "string", "description": "Hierarchy level description", "maxLength": 80 }, "HierarchyLevelIndex": { "type": "integer", "format": "int32", "description": "Hierarchy level index", "minimum": 0, "maximum": 9, "example": 2 }, "HierarchyLevelName": { "type": "string", "description": "Hierarchy level name", "maxLength": 40 }, "HierarchyName": { "type": "string", "description": "Hierarchy name", "maxLength": 40 }, "Level": { "type": "object", "required": [ "id", "index", "name", "description" ], "description": "Hierarchy level information", "properties": { "id": { "$ref": "#/components/schemas/LevelID" }, "index": { "$ref": "#/components/schemas/HierarchyLevelIndex" }, "name": { "$ref": "#/components/schemas/HierarchyLevelName" }, "description": { "$ref": "#/components/schemas/HierarchyLevelDescription" } } }, "LevelID": { "type": "string", "description": "Level ID generated by the [Create hierarchy](https://developers.pismo.io/pismo-docs/reference/post-hierarchies) endpoint.", "format": "uuid", "maximum": 36, "example": "9bb95e15-c0e6-4c84-b644-350c76a83358" }, "MaxItemsPerPage": { "type": "integer", "format": "int32", "description": "Maximum number of items per page", "example": 10 }, "Pagination": { "type": "object", "description": "Data related to list pagination using a cursor.", "properties": { "limit": { "$ref": "#/components/schemas/MaxItemsPerPage" }, "cursor": { "$ref": "#/components/schemas/Cursor" } } } }, "responses": { "401Unauthorized": { "description": "Access token is missing or invalid" }, "403Forbidden": { "description": "The request has been lost" }, "404NotFound": { "description": "The specified resource was not found" }, "500InternalServer": { "description": "Internal Server Error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Generic internal error": { "value": { "code": "ECMN9999", "message": "Internal error" } } } } } } }, "securitySchemes": { "BearerAuth": { "type": "http", "scheme": "bearer", "bearerFormat": "JWT" } } }, "paths": { "/corporate/v1/hierarchies": { "get": { "summary": "List hierarchies", "description": "Lists hierarchies and their levels.\n", "operationId": "get-hierarchies", "tags": [ "Hierarchies" ], "parameters": [ { "$ref": "#/components/parameters/CursorQuery" }, { "$ref": "#/components/parameters/LimitQuery4" } ], "responses": { "200": { "description": "OK", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/GetHierarchiesResponse" }, "examples": { "Example hierarchies list": { "value": { "hierarchies": [ { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "Hierarchy One", "levels": [ { "id": "df48f983-c906-4bb3-83c7-ac2e18babb59", "name": "Central", "index": 0, "description": "Root level" }, { "id": "e7685dd9-e2c8-4a05-baf7-c7dd72c0969f", "name": "Region", "index": 1, "description": "Regional level" }, { "id": "0b05d677-602f-4874-92ea-a23471573c67", "name": "Country", "index": 2, "description": "Country level" }, { "id": "3cf5d1cf-e440-4813-ab14-7de22d2418e3", "name": "City", "index": 3, "description": "Main cities level" }, { "id": "22f4f976-11f2-451c-b62c-d4e2e174d90b", "name": "Branch", "index": 4, "description": "Branch level" } ] }, { "id": "01c0230c-67fb-472f-bd89-50c291c9ce50", "name": "Hierarchy Two", "levels": [ { "id": "8b3e3577-3d9d-4c9f-b2a5-56b462c6e20a", "name": "Central", "index": 0, "description": "Root level" }, { "id": "ebb8200e-a89c-45ae-8dd0-edaaba842926", "name": "Region", "index": 1, "description": "Regional level" }, { "id": "8d8d3e78-194f-48e8-af1c-6a388cbf3587", "name": "Country", "index": 2, "description": "Country level" }, { "id": "4927554c-f346-4b7d-842f-84cd9c1c4170", "name": "City", "index": 3, "description": "Main cities level" }, { "id": "a345a382-f52a-46e6-85b6-b32120919eba", "name": "Branch", "index": 4, "description": "Branch level" } ] } ], "pagination": { "limit": 10, "cursor": "eyJJRCI6IjBjOGVhMTA4LWNhZTYtNDA2Mi1iMmQzLTFhMTZkNmJiNGIyOCIsIk9yZ0lEIjoiMDllYThhMDQtNWY5My0xMWVkLTliNmEtMDI0MmFjMTIwMDAyIn0=" } } } } } } }, "400": { "description": "A Bad Request validation error", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "invalid cursor": { "value": { "code": "WCMN0004", "message": "Invalid cursor" } }, "limit exceeded maximum value": { "value": { "code": "WCMN0006", "message": "Limit must be less than or equal to 100" } } } } } }, "401": { "$ref": "#/components/responses/401Unauthorized" }, "403": { "$ref": "#/components/responses/403Forbidden" }, "404": { "$ref": "#/components/responses/404NotFound" }, "500": { "$ref": "#/components/responses/500InternalServer" } } } } } } ```