# Close transaction banking account Close a transaction banking account and all of its children. Book balance and earmark balance must be zero. This endpoint generates an [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2) event. **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": { "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" } } } }, "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/v1/corporate-accounts/{externalAccountId}/close": { "post": { "summary": "Close transaction banking account", "operationId": "post-accounts-accountId-close", "description": "Close a transaction banking account and all of its children.\n\nBook balance and earmark balance must be zero.\n\nThis endpoint generates an [Account status changed](https://developers.pismo.io/events/docs/account-status-change-2) event.\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" } ], "responses": { "204": { "$ref": "#/components/responses/204NoContent" }, "400": { "description": "A Bad Request validation error.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/ErrorResponse" }, "examples": { "Account not found": { "value": { "code": "WCAC0012", "message": "Account not found" } }, "Scheduled transactions": { "value": { "code": "WCAC0018", "message": "Account still has active scheduled payments" } }, "Remaining balance": { "value": { "code": "WCAC0019", "message": "Make sure that the account has a zero balance before closing it" } }, "Earmark balance": { "value": { "code": "WCAC0028", "message": "Account has active earmark" } }, "Account closed error": { "value": { "code": "WCAC0029", "message": "Action not permitted on a closed account" } }, "Account is in final status": { "value": { "code": "WCAC0035", "message": "Account is currently in the final status" } }, "Account balances pending creation": { "value": { "code": "WCAC0040", "message": "Account balance is still being created. Please try again in a few minutes" } } } } } }, "401": { "$ref": "#/components/responses/401Unauthorized" }, "403": { "$ref": "#/components/responses/403Forbidden" }, "500": { "$ref": "#/components/responses/500InternalServer" } } } } } } ```