Fetch Virtual Account Number of an Account

You can get the account number tied to a deposit account in two ways.

Option 1:
Make a GET request to the List Virtual Nuban endpoint and provide the settlementAccountId of the deposit account in your query parameter

VerbURL
GET{{baseUrl}}/api/v1/virtual-nubans

Sample request payload and 200 OK response are given below:


curl --request GET \
     --url 'https://api.sandbox.getanchor.co/api/v1/virtual-nubans?settlementAccountId=169925847367121-anc_acc' \
     --header 'accept: application/json' \
     --header 'x-anchor-key: <API Key>'
{
  "data": [
    {
      "id": "169925847405340-anc_va",
      "type": "VirtualNuban",
      "attributes": {
        "createdAt": "2023-11-06T08:14:34",
        "bank": {
          "id": "1656585494013221-anc_bk",
          "name": "PROVIDUS BANK",
          "nipCode": "000023"
        },
        "isDefault": true,
        "accountName": "Great Busness",
        "permanent": true,
        "currency": "NGN",
        "accountNumber": "2962576964",
        "status": "ACTIVE"
      },
      "relationships": {
        "settlementAccount": {
          "data": {
            "id": "169925847367121-anc_acc",
            "type": "DepositAccount"
          }
        },
        "customer": {
          "data": {
            "id": "16976298908802-anc_bus_cst",
            "type": "BusinessCustomer"
          }
        }
      }
    }
  ],
  "meta": {
    "pagination": {
      "number": 0,
      "size": 20,
      "total": 1,
      "totalPages": 1
    }
  }
}

Option 2

Make use of our include feature to expand the VirtuaNuban relationship when you fetch a deposit account.

Make a GET request to Fetch Deposit Account Endpoint and include VirtualNuban /api/v1/accounts/accountID?include=VirtualNuban

VerbURL
GET{{baseUrl}}/api/v1/accounts/accountID?include=VirtualNuban

Sample request payload and 200 OK response are given below:

curl --request GET \
     --url 'https://api.sandbox.getanchor.co/api/v1/accounts/169925847367121-anc_acc?include=VirtualNuban' \
     --header 'accept: application/json' \
     --header 'x-anchor-key: <API Key>'
{
  "data": {
    "id": "169925847367121-anc_acc",
    "type": "DepositAccount",
    "attributes": {
      "createdAt": "2023-11-06T08:14:34",
      "bank": {
        "id": "16565854883910-anc_bk",
        "name": "CORESTEP MICROFINANCE BANK",
        "cbnCode": "",
        "nipCode": "090365"
      },
      "accountName": "Great Busness",
      "frozen": false,
      "currency": "NGN",
      "accountNumber": "******9800",
      "type": "CURRENT",
      "status": "ACTIVE"
    },
    "relationships": {
      "subAccounts": {
        "data": []
      },
      "virtualNubans": {
        "data": [
          {
            "id": "169925847405340-anc_va",
            "type": "VirtualNuban"
          }
        ]
      },
      "customer": {
        "data": {
          "id": "16976298908802-anc_bus_cst",
          "type": "BusinessCustomer"
        }
      }
    }
  },
  "included": [
    {
      "id": "169925847405340-anc_va",
      "type": "VirtualNuban",
      "attributes": {
        "createdAt": "2023-11-06T08:14:34",
        "bank": {
          "id": "1656585494013221-anc_bk",
          "name": "PROVIDUS BANK",
          "nipCode": "000023"
        },
        "isDefault": true,
        "accountName": "Great Busness",
        "permanent": true,
        "currency": "NGN",
        "accountNumber": "2962576964",
        "status": "ACTIVE"
      },
      "relationships": {
        "settlementAccount": {
          "data": {
            "id": "169925847367121-anc_acc",
            "type": "DepositAccount"
          }
        },
        "customer": {
          "data": {
            "id": "16976298908802-anc_bus_cst",
            "type": "BusinessCustomer"
          }
        }
      }
    }
  ]
}