Create Sub-Ledger Account

You can create a virtual account number for the sub account at the point of creating the subaccount by setting the value of createVirtualNuban to true

📘

Sub accounts can only be created under FBO account. If you try to use any other deposit account as a parentAccount, you will get an error

You can add metadata when creating subaccount. Metadata serves as a way to store additional information into our system

When createVirtualNuban value is set to true as seen in the below sample payload, a virtual account number will be created and attached to the sub-ledger account.

Sample request payload to create a sub-account and 200 OK response are given below:

curl --request POST \
     --url https://api.sandbox.getanchor.co/api/v1/sub-accounts \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --header 'x-anchor-key: <API Key>' \
     --data '
{
    "data": {
        "type": "SubAccount",
        "attributes": {
            "createVirtualNuban": true,
            "provider": "nine9psb",
            "metadata": {
                "label": "premium_goods",
                "subscription": "premium"
            }
        },
        "relationships": {
            "parentAccount": {
                "data": {
                    "id": "16922123768364-anc_acc",
                    "type": "DepositAccount"
                }
            },
            "customer": {
                "data": {
                    "id": "16968486366112-anc_ind_cst",
                    "type": "IndividualCustomer"
                }
            }
        }
    }
}'
{
    "data": {
        "id": "16970500095163-anc_subacc",
        "type": "SubAccount",
        "attributes": {
            "createdAt": "2023-10-11T18:46:49.524461",
            "metadata": {
                "label": "premium_goods",
                "subscription": "premium"
            },
            "accountType": "REGULAR"
        },
        "relationships": {
            "virtualNubans": {
                "data": [
                    {
                        "id": "16970500101245-anc_va",
                        "type": "VirtualNuban"
                    }
                ]
            },
            "parentAccount": {
                "data": {
                    "id": "16922123768364-anc_acc",
                    "type": "DepositAccount"
                }
            },
            "customer": {
                "data": {
                    "id": "16968486366112-anc_ind_cst",
                    "type": "IndividualCustomer"
                }
            }
        }
    }
}

📘

Currently, sub-ledger account cannot be deleted or frozen.

ParameterTypeDescription
typestringThis is the type for the sub account resource. It is of the format SubAccount
createVirtualNubanenumOptional. This attribute specifies if a virtual account number should be created and attached to this subaccount. Takes the values true or false.
providerstringOptional. This parameter specifies the provider or partner bank their virtual account should be created in.
metadataobjectWe support including metadata on most of our resources as a way to add internal information to our system. Metadata takes the form of key-value pairs.

Here is a sample{ "metadata": { "customer_id": "bd8-aff1793", "loan_type": "instalment"}}
parentAccountobjectThis is the parent deposit account (FBO) object where the sub account was created under. It includes the following:

id: This is the ID of the parent (FBO) account. It is of the format 16922123768364-anc_acc.

type: This is the type of the parent account. It is of type DepositAccount
customerobjectThis is the customer related to the sub account. It includes:

id: This is the ID of the customer resource. It has the format, "16922123736510-anc_bus_cst",

type: This is the type of customer related to the SubAccount. It can either be BusinessCustomer or IndividualCustomer