API Reference
Transactions
Here are examples for working with the Transactions collection through the REST API.
Getting Transaction History
Get User Transaction History
const getUserTransactionHistory = async (token, userId, limit = 50) => {
const response = await fetch(
`https://api.picoshealth.com/v1/transactions?where={"user":{"equals":"${userId}"}}&limit=${limit}&sort=-createdAt`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Get Transaction Details
const getTransactionDetails = async (token, transactionId) => {
const response = await fetch(
`https://api.picoshealth.com/v1/transactions/${transactionId}?depth=2`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Get Refunds for a Period
const getRefunds = async (token, startDate, endDate) => {
const response = await fetch(
`https://api.picoshealth.com/v1/transactions?where={"and":[{"type":{"equals":"refund"}},{"createdAt":{"greater_than":"${startDate}"}},{"createdAt":{"less_than":"${endDate}"}}]}&limit=100`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Get Transactions by Type
const getTransactionsByType = async (token, transactionType) => {
const response = await fetch(
`https://api.picoshealth.com/v1/transactions?where={"type":{"equals":"${transactionType}"}}&sort=-createdAt`,
{
headers: { 'Authorization': `Bearer ${token}` },
}
);
return response.json();
};
Last Updated: June 22, 2026