# Update division Updates a division. Only provided fields are updated. Other fields are left unchanged. This endpoint generates a [Corporate division updated](https://developers.pismo.io/events/docs/corporate-division-change-2) event. # 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": "Divisions", "description": "Divisions endpoints" } ], "components": { "parameters": { "DivisionCodePath": { "name": "divisionCode", "in": "path", "description": "Division code registered in the [Create division](https://developers.pismo.io/pismo-docs/reference/post-division-v2) endpoint.", "schema": { "type": "string", "maxLength": 36, "pattern": "^[a-zA-Z0-9-]+$" }, "required": true, "example": "my-division-code" } }, "schemas": { "AdministrativeDivisionID": { "type": "integer", "format": "int64", "description": "Administrative division ID. Specifying an administrative division ID in this field links your division to it. This is useful when you want to use the holidays defined in that administrative division.", "example": 13 }, "DivisionCode": { "type": "string", "maxLength": 36, "description": "Code used to identify your division within the organization. Division code should only contain letters, numbers, and hyphens.", "example": "US" }, "DivisionDescription": { "type": "string", "nullable": true, "maxLength": 80, "description": "Division description", "example": "NY - New York City" }, "DivisionName": { "type": "string", "description": "Division name", "example": "NY", "maximum": 40 }, "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" } } }, "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" }, "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" }, "ParentCode": { "type": "string", "description": "Division code that can be set as the parent of the division being created. The parent must be at a level with a lower index than the division being created. It must comply with the rule `^[a-zA-Z0-9-]+$`.", "pattern": "^[a-zA-Z0-9-]+$", "example": "my-parent-division" }, "PatchDivisionRequestV2": { "description": "Patch division request body", "type": "object", "properties": { "division_code": { "$ref": "#/components/schemas/DivisionCode" }, "hierarchy_id": { "$ref": "#/components/schemas/HierarchyID" }, "level_id": { "$ref": "#/components/schemas/LevelID" }, "administrative_division_id": { "$ref": "#/components/schemas/AdministrativeDivisionID" }, "name": { "$ref": "#/components/schemas/DivisionName" }, "parent_code": { "$ref": "#/components/schemas/ParentCode" }, "description": { "$ref": "#/components/schemas/DivisionDescription" }, "timezone": { "$ref": "#/components/schemas/Timezone" }, "program_ids": { "$ref": "#/components/schemas/ProgramIDs" }, "schema": { "$ref": "#/components/schemas/SchemaCreateTransactionBankingAccount" } } }, "ProductID": { "description": "Product ID", "type": "integer", "format": "int64", "example": 1234 }, "ProgramIDs": { "type": "array", "maximum": 100, "description": "List of allowed program IDs. The programs must belong to the organization.\nThis list is used for validation during the [Create transaction banking account](https://developers.pismo.io/pismo-docs/reference/post-account) process.\nYou can retrieve the organization programs using the [List programs](https://developers.pismo.io/pismo-docs/reference/programs-1) endpoint.\nIf no program IDs are specified, this division inherits the `program_ids` list from the parent division, if it exists.\n", "items": { "type": "integer", "format": "int32", "example": 1 }, "example": [ 1, 2, 3 ] }, "SchemaCreateTransactionBankingAccount": { "type": "object", "description": "Valid JSON schema as specified in https://json-schema.org/specification.html.\nUsed to validate the JSON of custom fields in the [Create transaction banking account](https://developers.pismo.io/pismo-docs/reference/post-account) process.\nIf this field is not set, the division inherits its schema from the parent division, if it exists.\n", "example": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", "properties": { "product_id": { "$ref": "#/components/schemas/ProductID" } }, "required": [ "product_id" ] } }, "Timezone": { "type": "string", "description": "Division timezone in timezone database format.
\nThis value is used in the calculations for holidays, weekends, and daily balances. If a timezone is not specified, the division inherits the timezone from its parent division. If the parent division also lacks a specified timezone, Pismo defaults to using UTC.\nTo clear this field, specify an empty string.\n", "example": "America/New_York" } }, "responses": { "204NoContent": { "description": "No Content" }, "401Unauthorized": { "description": "Access token is missing or invalid" }, "403Forbidden": { "description": "The request has been lost" }, "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/v2/divisions/{divisionCode}": { "patch": { "summary": "Update division", "operationId": "patch-division-v2", "description": "Updates a division. Only provided fields are updated. Other fields are left unchanged.\n\nThis endpoint generates a [Corporate division updated](https://developers.pismo.io/events/docs/corporate-division-change-2) event.\n", "parameters": [ { "$ref": "#/components/parameters/DivisionCodePath" } ], "tags": [ "Divisions" ], "requestBody": { "description": "Patch division request body", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/PatchDivisionRequestV2" }, "examples": { "Patch division": { "value": { "hierarchy_id": "9bb95e15-c0e6-4c84-b644-350c76a83358", "level_id": "7d574f66-ebd0-4b83-85a1-98ce7569e5c3", "name": "NORAM", "administrative_division_id": 13, "parent_code": "my-parent-division", "description": "North American regional division", "program_ids": [ 111, 222, 333 ], "timezone": "Pacific Standard Time", "schema": { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://example.com/product.schema.json", "title": "Product", "description": "A product from Acme's catalog", "type": "object", "properties": { "product_id": { "$ref": "#/components/schemas/ProductID" } }, "required": [ "product_id" ] } } } } } } }, "responses": { "204": { "$ref": "#/components/responses/204NoContent" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Invalid JSON payload": { "value": { "code": "WDIV0015", "message": "Invalid JSON payload received: Error unmarshalling request" } }, "hierarchy_id is a required field": { "value": { "code": "WDIV0011", "message": "hierarchy_id is a required field" } }, "level_id is a required field": { "value": { "code": "WDIV0011", "message": "level_id is a required field" } }, "name should not be spaces": { "value": { "code": "WDIV0011", "message": "name should not be spaces" } }, "name must be a maximum of 40 characters in length": { "value": { "code": "WDIV0011", "message": "name must be a maximum of 40 characters in length" } }, "description must be a maximum of 80 characters in length": { "value": { "code": "WDIV0011", "message": "description must be a maximum of 80 characters in length" } }, "timezone is invalid": { "value": { "code": "WDIV0011", "message": "timezone is invalid" } }, "schema is invalid": { "value": { "code": "WDIV0011", "message": "schema is invalid" } }, "program_ids must contain unique values": { "value": { "code": "WDIV0011", "message": "program_ids must contain unique values" } }, "program_ids must contain at maximum 100 items": { "value": { "code": "WDIV0011", "message": "program_ids must contain at maximum 100 items" } }, "division_code must be a maximum of 36 characters in length": { "value": { "code": "WDIV0011", "message": "division_code must be a maximum of 36 characters in length" } }, "division_code contains character not permitted": { "value": { "code": "WDIV0011", "message": "division_code contains character not permitted" } }, "Invalid level": { "value": { "code": "WDIV0005", "message": "Invalid level" } }, "Parent level division not found for the given hierarchy": { "value": { "code": "WDIV0007", "message": "Parent level division not found for the given hierarchy" } }, "The parent division informed is at a level lower than or equal to the level": { "value": { "code": "WDIV0006", "message": "The parent division informed is at a level lower than or equal to the level" } }, "Cannot change Hierarchy ID because division has child divisions": { "value": { "code": "WDIV0008", "message": "Cannot change Hierarchy ID because division has child divisions" } }, "Child level division not found for the given hierarchy": { "value": { "code": "WDIV0009", "message": "Child level division not found for the given hierarchy" } }, "The level informed is at a level lower than or equal to the child divisions": { "value": { "code": "WDIV0010", "message": "The level informed is at a level lower than or equal to the child divisions" } }, "Program with program_id {programId} not found": { "value": { "code": "WDIV0012", "message": "Program with program_id {programId} not found" } }, "The administrative division is invalid": { "value": { "code": "WDIV0011", "message": "Administrative division is invalid" } }, "Invalid hierarchy": { "value": { "code": "WDIV0018", "message": "Invalid hierarchy" } }, "Administrative division is misconfigured": { "value": { "code": "WDIV0019", "message": "Administrative division is misconfigured" } } } } } }, "401": { "$ref": "#/components/responses/401Unauthorized" }, "403": { "$ref": "#/components/responses/403Forbidden" }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Division not found": { "value": { "code": "WDIV0002", "message": "Division not found" } }, "Parent division not found": { "value": { "code": "WDIV0017", "message": "Parent division not found" } } } } } }, "500": { "$ref": "#/components/responses/500InternalServer" } } } } } } ```