Transactions
An account's transaction history: deposits, withdrawals, trades, staking, rewards and fees. Each transaction lists the assets that moved, as parts that were sent or received, and its fees, each with its fiat value.
Like Accounts, every call is made for one user, with that user's token.
Endpoints
| Endpoint | Returns |
|---|---|
GET /accounts/{account_id}/transactionsuser.transactions.getList({ accountId, ... }) | A page of the account's transactions. |
GET /accounts/{account_id}/transactions/{tx_id}user.transactions.getOne({ accountId, txId }) | One transaction. |
Every field and filter is in the API reference.
Filters and pagination
| Parameter | Use |
|---|---|
from, to | The date range, as YYYY-MM-DD. Without from, older transactions are left out: for the full history, pass a date before the account's first transaction. |
ticker | Only transactions involving this asset, for example BTC. |
wallet | Only this wallet's transactions: a wallet id from the account. |
types | Only these types, comma-separated, for example trade,deposit. |
limit | The page size: 100 by default, 1,000 at most. |
last | Where the page starts: the id of the last transaction on the previous page. Empty for the first page. |
sort | asc or desc, by date. |
exclude_fields | Fields to leave out of the response, comma-separated, for example other_parties,transaction_hash. |
Get every transaction
Page through the history with last, starting with an empty value:
const accountId = '613f3f9fe9b200002a0cc768';
const transactions = [];
// A date before the account's first transaction. If unsure, use a very early one.
const from = '2009-01-01';
const limit = 100;
let last = '';
while (true) {
const page = await user.transactions.getList({ accountId, from, last, limit });
if (!page.length) break;
transactions.push(...page);
// The next page starts after this page's last transaction.
last = page[page.length - 1].id;
}
Stop when a page comes back empty, not when it is shorter than limit. Vezgo keeps both sides of a trade on the same page, so a page can hold fewer transactions than you asked for.
The transaction object
A trade on an exchange: USD sent, BTC received, and a fee.
{
"id": "613f3fac965d03004f6cf7a7",
"resource_type": "transaction",
"transaction_type": "trade",
"transaction_subtype": "buy",
"initiated_at": 1631535020587,
"confirmed_at": 1631535020587,
"wallet": "coinbase:cash:usd",
"parts": [
{
"direction": "sent",
"ticker": "USD",
"provider_ticker": "USD",
"amount": "1000",
"fiat_ticker": "USD",
"fiat_value": "1000"
},
{
"direction": "received",
"ticker": "BTC",
"provider_ticker": "BTC",
"amount": "0.02225",
"fiat_ticker": "USD",
"fiat_value": "1000"
}
],
"fees": [
{
"ticker": "USD",
"provider_ticker": "USD",
"amount": "4.99",
"fiat_ticker": "USD",
"fiat_value": "4.99",
"resource_type": "transaction_fee"
}
],
"misc": {},
"fiat_calculated_at": 1631535020587
}
| Field | What it is |
|---|---|
id | The transaction ID. Use it as last to page. |
transaction_type | What happened: see Transaction types. |
transaction_subtype | More detail, for example onchain_deposit, buy or staking_reward. Can be null. |
parts | The assets that moved. Each has a direction (sent or received), a ticker, an amount and a fiat_value, and for blockchains the from_address and to_address. |
fees | What the transaction cost, each with a ticker, an amount and a fiat_value. |
initiated_at, confirmed_at | When the transaction started and was confirmed, in milliseconds since the epoch. confirmed_at is null until it is. |
wallet | The wallet the transaction belongs to. |
transaction_hash | The blockchain transaction hash, for on-chain transactions. |
misc | Details specific to the provider. See the FAQ. |
Amounts and fiat values are strings, so they keep their full precision. How fiat values are calculated is in the FAQ.
Transaction types
transaction_type | Usual parts |
|---|---|
deposit | One part, received. |
withdrawal | One part, sent. |
trade | Two parts: one sent, one received. |
staking | Two parts: the base asset sent, the staked asset received. |
unstaking | Two parts: the staked asset sent, the base asset received. |
reward | One part, received: staking, learning and other rewards. |
bonus | One part, received: airdrops, referral bonuses and similar. |
other | Anything else. |
Which types, subtypes and wallets each provider produces is on its status page, under Data mapping: for example vezgo.com/status/coinbase-api.
Missing transactions
If an account's history looks incomplete, check from and your pagination first. Other causes, such as API keys without permission to read transactions, are in the FAQ.