# Roll back transaction banking account status
Roll back an account from its final status.
Note: You can only change the account status from its final status to one that is both not final and not in a dormant state.
This endpoint generates an [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2) event.
For more information on account statuses, refer to [Manage account statuses](doc:managing-account-statuses).
**NOTE**: This endpoint requires an account token - an access token encoded with an external 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": {
"AccountStatusReasonDescription": {
"type": "string",
"minLength": 1,
"maxLength": 500,
"description": "Account status reason description
\n`minLength: 1`\n`maxLength: 500`\n",
"example": "CREDIT_ONLY"
},
"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"
}
}
},
"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"
},
"PatchAccountStatusRollbackv2": {
"type": "object",
"properties": {
"status": {
"$ref": "#/components/schemas/NewAccountStatus"
},
"reason_external_id": {
"$ref": "#/components/schemas/AccountStatusReasonExternalID"
},
"description": {
"$ref": "#/components/schemas/AccountStatusReasonDescription"
}
}
}
},
"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/rollback": {
"patch": {
"summary": "Roll back transaction banking account status",
"operationId": "patch-accounts-accountId-status-rollback-v2",
"description": "Roll back an account from its final status.\nNote: You can only change the account status from its final status to one that is both not final and not in a dormant state.\n\nThis endpoint generates an [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2) event.\n\nFor more information on account statuses, refer to [Manage account statuses](https://developers.pismo.io/pismo-docs/docs/managing-account-statuses).\n\n**NOTE**: This endpoint requires an account token - an access token encoded with an external 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/PatchAccountStatusRollbackv2"
},
"examples": {
"Reverse account cancelled": {
"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."
}
},
"status required": {
"value": {
"code": "WCAC0005",
"message": "status is a required field"
}
},
"Account status is already in dormancy config": {
"value": {
"code": "WCAC0034",
"message": "status is specified in account's dormancy config"
}
},
"Account is not in final status": {
"value": {
"code": "WCAC0037",
"message": "account is not 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 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"
}
}
}
}
}
}
```