# Update transaction banking account status
Update the status of a transaction banking account and the statuses of all the account's children.
This endpoint generates the following event:
- [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2).
For more information on account status and reasons, see [Manage account statuses](doc:managing-account-statuses).
Note: This endpoint requires an account token — an access token encoded with a Pismo account ID. Tokens can expire quickly, which can result in a `401 Unauthorized` message.
# 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": "Accounts",
"description": "Accounts endpoints"
}
],
"components": {
"parameters": {
"ExternalAccountIdPath": {
"name": "externalAccountId",
"in": "path",
"description": "External account ID",
"schema": {
"type": "string",
"minLength": 1,
"maxLength": 60
},
"example": "12345678901",
"required": true
}
},
"schemas": {
"AccountStatusReasonExternalID": {
"type": "string",
"minLength": 1,
"maximum": 120,
"description": "External reason ID specifying account restrictions
\n`minimum: 1`\n`maximum: 120`\n",
"example": "CREDIT_ONLY"
},
"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"
}
}
},
"Metadata2": {
"type": "object",
"description": "Key-value pair field that you can use to send any information relating to a status change. The information you send is propagated in the [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2) event.
\nNote that data entered in this field is not saved.
\nNote: If you include `external_account_id` in this field, the Pismo platform ignores it and only uses the one you sent in the path parameter.\n"
},
"NewAccountStatus": {
"type": "string",
"minLength": 1,
"maxLength": 9,
"description": "New status for the account.
\nNote: When updating the account status, make sure the status is not a final status or a status in the dormancy configuration.\n",
"pattern": "^[A-Z_]+$",
"example": "DORMANT"
},
"PatchAccountStatusv2": {
"type": "object",
"properties": {
"status": {
"$ref": "#/components/schemas/NewAccountStatus"
},
"reason_external_id": {
"$ref": "#/components/schemas/AccountStatusReasonExternalID"
},
"update_children": {
"$ref": "#/components/schemas/UpdateChildren"
},
"metadata": {
"$ref": "#/components/schemas/Metadata2"
}
}
},
"UpdateChildren": {
"type": "boolean",
"description": "Whether to update status of all account children linked through the attribute `parent_account_id` (`true`) or not (`false`).",
"example": true
}
},
"responses": {
"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/corporate-accounts/{externalAccountId}/status": {
"patch": {
"summary": "Update transaction banking account status",
"operationId": "patch-accounts-accountId-status-v2",
"description": "Update the status of a transaction banking account and the statuses of all the account's children.\n\nThis endpoint generates the following event:\n - [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2).\n\nFor more information on account status and reasons, see [Manage account statuses](https://developers.pismo.io/pismo-docs/docs/managing-account-statuses).\n\nNote: This endpoint requires an account token — an access token encoded with a Pismo account ID. Tokens can expire quickly, which can result in a `401 Unauthorized` message.\n",
"tags": [
"Accounts"
],
"parameters": [
{
"$ref": "#/components/parameters/ExternalAccountIdPath"
}
],
"requestBody": {
"description": "Status to update",
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PatchAccountStatusv2"
},
"examples": {
"Account blocked": {
"value": {
"status": "BLOCKED"
}
},
"Reverse account blocked": {
"value": {
"status": "NORMAL"
}
}
}
}
}
},
"responses": {
"204": {
"description": "OK"
},
"400": {
"description": "A Bad Request validation error.\n\nStatic Validations (mandatory field, max value, max length, etc) have the code `WCAC0005`.\n",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"Corporate account not found": {
"value": {
"code": "WCAC0012",
"message": "Corporate account not found"
}
},
"Invalid JSON payload": {
"value": {
"code": "WCAC0013",
"message": "Invalid JSON payload received: Error unmarshalling request."
}
},
"Account status is already in dormancy config": {
"value": {
"code": "WCAC0034",
"message": "status is specified in account's dormancy config"
}
},
"Account is in final status": {
"value": {
"code": "WCAC0035",
"message": "Account is currently in the final status"
}
},
"Status cannot be final": {
"value": {
"code": "WCAC0036",
"message": "status cannot be final"
}
},
"reason_external_id max length": {
"value": {
"code": "WCAC0005",
"message": "reason_external_id must be a maximum of 120 characters in length"
}
},
"status or reason_external_id must be provided": {
"value": {
"code": "WCAC0005",
"message": "status or reason_external_id must be provided"
}
},
"Status not found": {
"value": {
"code": "WCAC0020",
"message": "Status not found"
}
}
}
}
}
},
"404": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"status not found": {
"value": {
"code": "WCAC0020",
"message": "Status not found"
}
},
"reason not found": {
"value": {
"code": "WCAC0021",
"message": "Reason not found"
}
}
}
}
}
},
"422": {
"description": "Unprocessable Entity",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ErrorResponse"
},
"examples": {
"status not found": {
"value": {
"code": "WCAC0038",
"message": "Account status update blocked: operation blocked for account."
}
}
}
}
}
},
"500": {
"$ref": "#/components/responses/500InternalServer"
}
}
}
}
}
}
```