/update_account
Updates account name and status (frozen/unfrozen) of a bank account.
This endpoint allows updating of bank account names and status(frozen/unfrozen). The bank account being updated is indicated by passing the existing account name and using the usersignature
header.
Bank account name must be (case-insensitive) unique among a user's accounts. For example, two different users can have bank accounts name "default", but one user cannot have two bank accounts named "default" and "DEFAULT".
Bank account active must be boolean. For example, bank accounts active is"true" or "false".
Requests
The account_name
key is required. Its string value of the existing bank account name.
The new_account_name
key is optional. Its string value must be unique (case-insensitive) among a user's bank accounts name.
The active
key is optional. It's a boolean.
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/update_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",
"crypto": "ETH",
"reference": "<your unique id>"
},
"account_name": "Old Account Name",
"new_account_name": "New Account Name",
"active": true
}
***
HTTP/1.1 200 OK
{
"message": "Account updated.",
"success": true,
"status": "SUCCESS",
"response_time_ms": "171",
"account": {
"account_number": "*1234",
"routing_number": "123456789",
"account_name": "New Account Name",
"account_type": "CHECKING",
"account_status": "active",
"active": true,
"account_link_status": "microdeposit_automatically_verified"
"web_debit_verified":true
},
"changes": [
{
"attribute": "account_name",
"old_value": "Old Account Name",
"new_value": "New Account Name"
},
{
"attribute": "active",
"old_value": false,
"new_value": true
}
]
}
const res = await Sila.updateAccount({
account_name: 'old account name',
new_account_name: 'new account name',
active:true,
}, userHandle, walletPrivateKey);
// Success Response Object
{
"request": {
"handle": "user_handle_947e7e56-e6b3-4cee-9942-514010e6fceb",
"account": {
"account_name": "sila_bank",
"new_account_name": "This is a automation testing dummy text."
}
},
"response": {
"statusCode": 200,
"headers": {
"server": "nginx/1.14.0 (Ubuntu)",
"date": "Tue, 19 Apr 2022 13:10:06 GMT",
"content-type": "application/json",
"content-length": "542",
"connection": "close",
"access-control-allow-origin": "*",
"access-control-allow-headers": "*",
"allow": "POST, OPTIONS",
"vary": "Cookie"
},
"data": {
"success": true,
"message": "Bank account updated successfully.",
"reference": "9d5074bd-1acc-4680-b932-19fe917df91d",
"account": {
"account_number": "*9012",
"routing_number": "123456780",
"account_name": "This is a automation testing dummy text.",
"account_type": "CHECKING",
"account_status": "active",
"active": true,
"account_link_status": "unverified_manual_input",
"web_debit_verified": true
},
"changes": [
{
"attribute": "account_name",
"old_value": "sila_bank",
"new_value": "This is a automation testing dummy text."
}
],
"status": "SUCCESS",
"response_time_ms": "129"
}
}
}
payload = {
"user_handle": "user handle",
"account_name": "old account name",
"new_account_name": "new account name",
"active": True
}
response = User.update_account(
app, payload, eth_private_key)
{
"success":true,
"message":"Bank account updated successfully.",
"reference":"018c68fb-1692-493e-a130-9cadd4d03fc9",
"account":{
"account_number":"*9013",
"routing_number":"123456780",
"account_name":"accountupdated",
"account_type":"CHECKING",
"account_status":"active",
"active":true,
"account_link_status":"unverified_manual_input",
"web_debit_verified":true
},
"changes":[
{
"attribute":"account_name",
"old_value":"forupdate",
"new_value":"accountupdated"
}
],
"status":"SUCCESS",
"response_time_ms":"147",
"status_code":200,
}
ApiResponse response = api.updateAccount("user handle", "user private key", "account name", "new account name", active);
UpdateAccountResponse parsedResponse = (UpdateAccountResponse) response.getData();
parsedResponse.getStatus();
parsedResponse.getMessage();
parsedResponse.getAccount().getAccountLinkStatus();
parsedResponse.getAccount().getAccountName();
parsedResponse.getAccount().getAccountNumber();
parsedResponse.getAccount().getAccountStatus();
parsedResponse.getAccount().getAccountType();
parsedResponse.getAccount().getRoutingNumber();
parsedResponse.getAccount().isActive();
parsedResponse.getAccount().getWebDebitVerified() // true/false
parsedResponse.getChanges().get(0).getAttribute();
parsedResponse.getChanges().get(0).getNewValue();
parsedResponse.getChanges().get(0).getOldValue();
//Load your information
$userHandle = 'user.silamoney.eth';
$userPrivateKey = 'some private key';
$accountName = 'account';
$newAccountName = 'new account';
$isActive = true; // Optional
//Call the API
$response = $client->updateAccount($userHandle, $userPrivateKey, $accountName, $newAccountName, $isActive);
// Success 200
echo $response->getStatusCode(); // 200
echo $response->getData()->getStatus(); // SUCCESS
echo $response->getData()->status;
echo $response->getData()->changes
echo $response->getData()->account;
echo $response->getData()->account->webDebitVerified;
//Load your informations
var response = api.UpdateAccount(
userHandle: "user handle",
userPrivateKey: "user private key",
accountName: "account name",
newAccountName: "new account name",
isActive: true
);
// Success response object
Console.WriteLine(response.StatusCode); // 200
var parsedResponse = (UpdateAccountResponse)response.Data;
Console.WriteLine(parsedResponse.Message); // Account updated.
Console.WriteLine(parsedResponse.Success); // true
Console.WriteLine(parsedResponse.Status); // SUCCESS
Console.WriteLine(parsedResponse.ResponseTimeMs); // 1712
Console.WriteLine(parsedResponse.Changes); // changes
Console.WriteLine(parsedResponse.Account); // Account
Console.WriteLine(parsedResponse.Account.AccountLinkStatus); // Account Link Status
Console.WriteLine(parsedResponse.Account.AccountName); // Account Name
Console.WriteLine(parsedResponse.Account.AccountNumber); // Account Number
Console.WriteLine(parsedResponse.Account.AccountStatus); // Account Status
Console.WriteLine(parsedResponse.Account.AccountType); // Account Type
Console.WriteLine(parsedResponse.Account.Active); // Active
Console.WriteLine(parsedResponse.Account.RoutingNumber); // Routing Number
Console.WriteLine(parsedResponse.Account.MatchScore); // Match Score
Console.WriteLine(parsedResponse.Account.AccountOwnerName); // Account Owner Name
Console.WriteLine(parsedResponse.Account.EntityName); // Entity Name
Console.WriteLine(parsedResponse.Account.WebDebitVerified); // true
Key | Type | Description |
---|---|---|
header | JSON object | Required. 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_name | String | Required. Min length 1, Max length 40, Example: Custom Account Name |
new_account_name | String | Optional. Min length 1, Max length 40, Example: New Custom Account Name |
active | Boolean | Optional. , Example: true |
Responses
The success
attribute is a JSON key sent in the response body.
Status Code | success Attribute | Description |
---|---|---|
200 | true | Successfully updated account. |
400 | false | Bad request format. |
401 | false | Auth signature is absent or derived address does not belong to app_handle. |
403 | false | Account name already in use. |
Updated 12 months ago