/api/v1/accounts

This endpoint returns the accounts of the access token creator with pagination

The response schema:

interface v1_AccountsResponse extends Base_ApiV1 {
  accounts: Array<Account_ApiV1>;
  pagination: PaginationResponse_ApiV1;
}

You can find the Base_ApiV1 and the PaginationResponse_ApiV1 interface here:

pageSchema

Accounts Object contains the following parameters:

 {
  id: number;
  created_at: string;
  network: {
     name: string;
     rpc: string;
     chain_id: string;
     currency: string;
     virtual_accounts_contract: string;
     connected_wallets_contract: string;
     available_currencies: Array<{name: string,native: boolean,contract_address: string}>
   }
  commitment: string;
  name: string;
  closed: boolean;
  currency: {name: string,native: boolean,contract_address: string}                           };
  balance: string;
  account_type: "VIRTUALACCOUNT" | "CONNECTEDWALLET"
  creator_address: string;
}
  • id - A unique numeric identifier for the account

  • created_at - Account creation UTC date string

  • network - The details of the network the account is connected to

  • commitment - The unique identifier of the account, useful for querying the blockchain with.

  • name - The name of the account

  • closed - The status of the account, closed accounts are not usable anymore.

  • currency - The currency the account is using

  • balance - The account balance in the currency. Formatted Eth string! To convert to wei you need to parseEther

  • account_type - The account type determines which smart contract the account is using. Spell it using all caps

  • creator_address - The address of the account creator

The accounts can be sorted by using these parameters:

enum Accounts_sortBy {
  created_at = "created_at",
  network_id = "network_id",
  name = "name",
  account_type = "account_type",
  creator_address = "creator_address",
  currency = "currency",
  balance = "balance",
  closed = "closed",
  last_modified = "last_modified
}

An Example GET request to fetch accounts sorted by network_id

https://debitllama.com/api/v1/accounts?current_page=0&page_size=20&sort_by=network_id&sort_direction=DESC
  • current_page - The current page number to fetch. Pages are indexed from 0 and defaults to 0

  • page_size - Override the default page size. It will determine the total pages based on the count of results defaults to 0

  • sort_by - See the Accounts_sortBy enum for the accepted values. Defaults to created_at

  • sort_direction - DESC or ASC . Defaults to DESC

Filtering

You can request to filter the responses using the filter query parameter which must contain a JSON string! See the below pseudo code:

const filter = JSON.stringify({
  network_id : string, // Must be a chain_id from supported_networks returned by /api/v1
  name : string, // The exact name of the accout
  account_type : "CONNECTEDWALLET" | "VIRTUALACCOUNT", // The account type must be all caps
  creator_address : string, // A valid ETH address that created the account
  currency : string, // The currency parameter must be a JSON string 
  balance : string, // The exact account balance we want to fetch in ETH
  closed : boolean, // true if the account is closed
});

All the parameters of the filter are optional, you should only include the parameters you want to match exactly.

Here is an example GET request URL to fetch all active accounts (closed: false) on network BTT Testnet (network_id: 0x405) created by the access token creator

https://debitllama.com/api/v1/accounts?filter={"closed": false,"network_id":"0x405"}

Note about filtering currencies: The currencies stored by the back-end are JSON strings with the following interface: { name: string, native: boolean, contractAddress : string

} You must filter for them using a JSON string, else it won't work. Query the /api/v1 endpoint for available currencies per network and JSON.stringify() before you pass it as filter parameter!

Last updated