# Update account balance history config v1 Update the account balance history configuration for a division code. If this endpoint is called when the current datetime is greater than `cycle_config_validity.start`, the new configuration is valid only after the two-cycle closing date. Example: - division timezone: UTC - Update account balance history configuration called at: `2023-05-01T18:00:00Z` - current cycle closing time: 22:00:00 - current cycle closing date: 2023-04-30 (from `2023-04-30T22:00:00Z` to `2023-05-01T22:00:00Z`) - cycle config validity start datetime of the new config: `2023-05-02T22:00:00Z` - current config stays valid until `2023-05-02T22:00:00Z` If this endpoint is called when the current datetime is less than or equal to `cycle_config_validity.start` of the most recent configuration, the new configuration overrides the the most recent configuration. Example: - division timezone: UTC - Update account balance history configuration called at: `2023-05-01T19:00:00Z` - Cycle config validity start datetime of the most recent configuration: `2023-05-02T22:00:00Z` - New config overrides the most recent configuration settings, keeping the same cycle config validity start date: `2023-05-01T22:00:00Z` This endpoint generates an [Account balance history configuration changed](https://developers.pismo.io/events/docs/account-balances-balance-history-config-change-1) 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": "Bank statements", "description": "Bank statements 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": { "CycleClosingTime": { "type": "string", "format": "time", "description": "Time of day the cycle closes for a division. This time follows the timezone configured in division. You can find the division timezone using the [Get division by code](https://developers.pismo.io/pismo-docs/reference/get-division-by-code-v2) endpoint.", "pattern": "^(?:([01]?\\d|2[0-3]):([0-5]?\\d):)?([0-5]?\\d)$", "example": "22:00:00", "maxLength": 8 }, "CycleEventDelay": { "type": "integer", "format": "int32", "description": "The cycle event delay specifies how many minutes after `cycle_closing_time` the account balance history event is issued for each account in the division.", "example": 15, "minimum": 5 }, "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" } } }, "UpdateAccountBalanceHistoryConfigurationRequest": { "description": "Update account balance history configuration request object", "type": "object", "properties": { "cycle_closing_time": { "$ref": "#/components/schemas/CycleClosingTime" }, "cycle_event_delay": { "$ref": "#/components/schemas/CycleEventDelay" } } } }, "responses": { "204NoContent": { "description": "No Content" }, "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": { "/bank-statements/v1/account-balances/history/config/{divisionCode}": { "patch": { "summary": "Update account balance history config v1", "description": "Update the account balance history configuration for a division code.\n\nIf this endpoint is called when the current datetime is greater than `cycle_config_validity.start`, the new configuration is valid only after the two-cycle closing date.\nExample:\n - division timezone: UTC\n - Update account balance history configuration called at: `2023-05-01T18:00:00Z`\n - current cycle closing time: 22:00:00\n - current cycle closing date: 2023-04-30 (from `2023-04-30T22:00:00Z` to `2023-05-01T22:00:00Z`)\n - cycle config validity start datetime of the new config: `2023-05-02T22:00:00Z`\n - current config stays valid until `2023-05-02T22:00:00Z`\n\nIf this endpoint is called when the current datetime is less than or equal to `cycle_config_validity.start` of the most recent configuration, the new configuration overrides the the most recent configuration.\nExample:\n - division timezone: UTC\n - Update account balance history configuration called at: `2023-05-01T19:00:00Z`\n - Cycle config validity start datetime of the most recent configuration: `2023-05-02T22:00:00Z`\n - New config overrides the most recent configuration settings, keeping the same cycle config validity start date: `2023-05-01T22:00:00Z`\n\nThis endpoint generates an [Account balance history configuration changed](https://developers.pismo.io/events/docs/account-balances-balance-history-config-change-1) event.", "operationId": "patch-account-balances-history-configuration", "tags": [ "Bank statements" ], "parameters": [ { "$ref": "#/components/parameters/DivisionCodePath" } ], "requestBody": { "description": "Request body", "required": true, "content": { "application/json": { "schema": { "$ref": "#/components/schemas/UpdateAccountBalanceHistoryConfigurationRequest" }, "examples": { "Update account balances history configuration": { "value": { "cycle_closing_time": "22:00:00", "cycle_event_delay": 15 } } } } } }, "responses": { "204": { "$ref": "#/components/responses/204NoContent" }, "400": { "description": "Bad Request", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Parameters must be provided": { "value": { "code": "WCFG0002", "message": "cycle_closing_time or cycle_event_delay params must be provided" } }, "Invalid JSON payload received": { "value": { "code": "WCFG0001", "message": "Invalid JSON payload received: Error unmarshalling request" } } } } } }, "404": { "description": "Not Found", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Division not found": { "value": { "code": "WCFG0003", "message": "Division not found" } }, "Account balance history config not found": { "value": { "code": "WCFG0005", "message": "Account balance history config not found" } } } } } }, "500": { "$ref": "#/components/responses/500InternalServer" } } } } } } ```