/delete_account

Deletes a bank account

This endpoint deletes bank accounts linked to end-users, decommissioning them from use in future transactions.

Requests

The account_name key is required and is used to uniquely identify the bank account to delete.

Authorization / Authentication

Apps using Access Token Authorization

Use a valid access token in an Authorization: Bearer request header.

See Authenticating with an Access Token for more details.

Apps using ECDSA Authentication

Both authsignature and usersignature headers are required for this request. The usersignature header should be generated with a keypair registered to the user (either registered from the /register endpoint or the /register_wallet endpoint).

See the section on ECDSA Authentication for more detail about ECDSA signature generation.

POST /0.2/delete_account HTTP/1.1
sandbox.silamoney.com
Content-Type: application/json
// if using OAuth2
Authorization: Bearer [GENERATED JWT TOKEN HERE]
// if using ECDSA
authsignature: [GENERATED AUTHSIGNATURE HEX STRING HERE]
usersignature: [GENERATED USERSIGNATURE HEX STRING HERE]

{
  "header": {
    "created": 1234567890, 
    "app_handle": "handle.silamoney.eth", 
    "user_handle":"user.silamoney.eth", 
    "version": "0.2", 
    "reference": "<your unique id>"
  },
  "account_name": "Custom Account Name"
}

***

HTTP/1.1 200 OK

{
  "success": true,
  "status": "SUCCESS",
  "reference": "<your unique id>",
  "message": "Bank account deleted successfully.",
  "response_time_ms": "171",
  "account_name: "Custom Account Name"
}
var response = api.DeleteAccount(userHandle, userPrivateKey, accountName);
var parsedResponse = (DeleteAccountResult)response.Data;

response.StatusCode; // 200
parsedResponse.AccountName; // accountName
parsedResponse.Message; // response message
parsedResponse.Status; // response status
parsedResponse.Success; // true
const res = await sila.deleteAccount("user handle", "account name", "user private key");

console.log(res.statusCode); // 200
console.log(res.data.reference); // Random reference number
console.log(res.data.status); // SUCCESS
console.log(res.data.success);
console.log(res.data.message);
console.log(res.data.account_name); // account name
payload = { "user_handle": user_handle, "account_name": "unlink" }

response = User.delete_account( app, payload, eth_private_key)

// Response
{
    'reference': 'ref',
    'success': True,
    'message': 'Bank account deleted successfully.',
    'account_nickname': 'unlink',
    'status': 'SUCCESS',
    'status_code': 200
}
ApiResponse response = api.deleteAccount("user handle", "account name", "user private key");

DeleteAccountResponse parsedResponse = (DeleteAccountResponse) response.getData();

response.getStatusCode();
parsedResponse.getAccountName();
parsedResponse.getReference();
parsedResponse.getMessage();
parsedResponse.getSuccess();
parsedResponse.getStatus();
//Load your information
$userHandle = 'user.silamoney.eth';
$accountName = 'account';

//Call the API
$response = $client->deleteAccount($userHandle, $accountName);

//Success 200
echo $response->getStatusCode();		//200
$account = $response->getData();
echo $account->getStatus();
echo $account->getReference();
echo $account->getMessage();	//Bank account deleted successfully.
echo $account->getAccountName(); //account.
KeyTypeDescription
headerJSON objectRequired. Requires these keys in JSON format: created, app_handle, user_handle. See the /check_handle endpoint for the complete list of fields in this object.
account_nameStringRequired. Max length 40
The account_name must match a bank account associated with the user_handle; check /get_accounts endpoint for a list of these.
Example: Custom Account Name

Responses

Status Codesuccess AttributeDescription
200trueBank account successfully deleted.
400falseCheck validation_details for more information. PRODUCT_NOT_READY indicates the account is waiting to be linked (with microdeposit verification, for instance).
401falseauthsignature or usersignature header was absent or incorrect.