Documentation Index Fetch the complete documentation index at: https://docs.monei.cc/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Master advanced filtering techniques to find exactly the transactions you need. This guide covers all available filters, search patterns, and optimization strategies.
What you’ll learn:
Filter by multiple criteria
Combine filters effectively
Search strategies
Performance optimization
Common filtering patterns
Available Filters
All filter parameters for transaction queries:
Filter Type Description Example statusstring Transaction status SUCCESS, PENDING, FAILED typestring Transaction type DEBIT, CREDIT, PEER-TRANSFER currencystring Currency code NGN, USD, SOL, ETH minAmountnumber Minimum amount 1000 maxAmountnumber Maximum amount 50000 startDatestring Start date 2024-02-01 endDatestring End date 2024-02-29 sortBystring Sort field createdAt, amount, updatedAt sortOrderstring Sort direction asc, desc pagenumber Page number 1 limitnumber Items per page 20
Filter by Status
Get transactions by status.
import MoneiSDK from 'monei-sdk' ;
const monei = new MoneiSDK ({
apiKey: process . env . MONEI_API_KEY ,
});
// Get successful transactions
const successful = await monei . transactions . getAll ({
status: 'SUCCESS' ,
limit: 20
});
console . log ( 'Successful:' , successful . pagination . total );
// Get pending transactions
const pending = await monei . transactions . getAll ({
status: 'PENDING' ,
limit: 20
});
console . log ( 'Pending:' , pending . pagination . total );
// Get failed transactions
const failed = await monei . transactions . getAll ({
status: 'FAILED' ,
limit: 20
});
console . log ( 'Failed:' , failed . pagination . total );
// Get completed transactions
const completed = await monei . transactions . getAll ({
status: 'COMPLETED' ,
limit: 20
});
console . log ( 'Completed:' , completed . pagination . total );
Filter by Type
Get transactions by type (DEBIT, CREDIT, etc.).
// Money out (debits)
const debits = await monei . transactions . getAll ({
type: 'DEBIT' ,
limit: 20
});
console . log ( 'Debits (Money Out):' , debits . pagination . total );
debits . transactions . forEach ( tx => {
console . log ( ` - ₦ ${ tx . amount } to ${ tx . narration } ` );
});
// Money in (credits)
const credits = await monei . transactions . getAll ({
type: 'CREDIT' ,
limit: 20
});
console . log ( ' \n Credits (Money In):' , credits . pagination . total );
credits . transactions . forEach ( tx => {
console . log ( ` + ₦ ${ tx . amount } from ${ tx . narration } ` );
});
// Peer transfers
const p2p = await monei . transactions . getAll ({
type: 'PEER-TRANSFER' ,
limit: 20
});
console . log ( ' \n P2P Transfers:' , p2p . pagination . total );
Filter by Currency
Get transactions for specific currencies.
// Naira transactions
const ngnTxns = await monei . transactions . getAll ({
currency: 'NGN' ,
limit: 20
});
console . log ( 'NGN Transactions:' , ngnTxns . pagination . total );
// USD transactions
const usdTxns = await monei . transactions . getAll ({
currency: 'USD' ,
limit: 20
});
console . log ( 'USD Transactions:' , usdTxns . pagination . total );
// SOL transactions
const solTxns = await monei . transactions . getAll ({
currency: 'SOL' ,
limit: 20
});
console . log ( 'SOL Transactions:' , solTxns . pagination . total );
// ETH transactions
const ethTxns = await monei . transactions . getAll ({
currency: 'ETH' ,
limit: 20
});
console . log ( 'ETH Transactions:' , ethTxns . pagination . total );
Filter by Amount Range
Get transactions within specific amount ranges.
// Small transactions (under ₦1,000)
const small = await monei . transactions . getAll ({
maxAmount: 1000 ,
currency: 'NGN' ,
limit: 20
});
console . log ( 'Small (<₦1K):' , small . pagination . total );
// Medium transactions (₦1,000 - ₦10,000)
const medium = await monei . transactions . getAll ({
minAmount: 1000 ,
maxAmount: 10000 ,
currency: 'NGN' ,
limit: 20
});
console . log ( 'Medium (₦1K-₦10K):' , medium . pagination . total );
// Large transactions (₦10,000 - ₦100,000)
const large = await monei . transactions . getAll ({
minAmount: 10000 ,
maxAmount: 100000 ,
currency: 'NGN' ,
limit: 20
});
console . log ( 'Large (₦10K-₦100K):' , large . pagination . total );
// Very large transactions (>₦100,000)
const veryLarge = await monei . transactions . getAll ({
minAmount: 100000 ,
currency: 'NGN' ,
limit: 20
});
console . log ( 'Very Large (>₦100K):' , veryLarge . pagination . total );
Filter by Date Range
Get transactions within specific time periods.
// Today
const today = new Date (). toISOString (). split ( 'T' )[ 0 ];
const todayTxns = await monei . transactions . getAll ({
startDate: today ,
endDate: today ,
limit: 100
});
console . log ( 'Today:' , todayTxns . pagination . total );
// This week
const thisWeekStart = new Date ();
thisWeekStart . setDate ( thisWeekStart . getDate () - 7 );
const thisWeek = await monei . transactions . getAll ({
startDate: thisWeekStart . toISOString (). split ( 'T' )[ 0 ],
endDate: today ,
limit: 100
});
console . log ( 'This Week:' , thisWeek . pagination . total );
// This month
const thisMonthStart = new Date ();
thisMonthStart . setDate ( 1 );
const thisMonth = await monei . transactions . getAll ({
startDate: thisMonthStart . toISOString (). split ( 'T' )[ 0 ],
endDate: today ,
limit: 100
});
console . log ( 'This Month:' , thisMonth . pagination . total );
// Last month
const lastMonthStart = new Date ();
lastMonthStart . setMonth ( lastMonthStart . getMonth () - 1 );
lastMonthStart . setDate ( 1 );
const lastMonthEnd = new Date ();
lastMonthEnd . setDate ( 0 );
const lastMonth = await monei . transactions . getAll ({
startDate: lastMonthStart . toISOString (). split ( 'T' )[ 0 ],
endDate: lastMonthEnd . toISOString (). split ( 'T' )[ 0 ],
limit: 100
});
console . log ( 'Last Month:' , lastMonth . pagination . total );
// Custom range
const custom = await monei . transactions . getAll ({
startDate: '2024-01-01' ,
endDate: '2024-01-31' ,
limit: 100
});
console . log ( 'January 2024:' , custom . pagination . total );
Combine Multiple Filters
Combine filters for precise queries.
// Successful debits over ₦10,000 this month
const results = await monei . transactions . getAll ({
type: 'DEBIT' ,
status: 'SUCCESS' ,
minAmount: 10000 ,
currency: 'NGN' ,
startDate: '2024-02-01' ,
endDate: '2024-02-29' ,
sortBy: 'amount' ,
sortOrder: 'desc' ,
limit: 50
});
console . log ( 'Matching Transactions:' , results . pagination . total );
// Display results
results . transactions . forEach ( tx => {
console . log ( `₦ ${ tx . amount . toLocaleString () } - ${ tx . narration } ` );
console . log ( ` Date: ${ new Date ( tx . createdAt ). toLocaleDateString () } ` );
console . log ( ` Ref: ${ tx . reference } ` );
console . log ( '' );
});
// Failed transactions this week
const failed = await monei . transactions . getAll ({
status: 'FAILED' ,
startDate: new Date ( Date . now () - 7 * 24 * 60 * 60 * 1000 ). toISOString (). split ( 'T' )[ 0 ],
endDate: new Date (). toISOString (). split ( 'T' )[ 0 ],
limit: 20
});
console . log ( 'Failed This Week:' , failed . pagination . total );
// Credits (money in) over ₦5,000
const largeCredits = await monei . transactions . getAll ({
type: 'CREDIT' ,
minAmount: 5000 ,
currency: 'NGN' ,
sortBy: 'createdAt' ,
sortOrder: 'desc' ,
limit: 20
});
console . log ( 'Large Credits:' , largeCredits . pagination . total );
Sorting
Sort transactions by different fields.
// Sort by date (newest first)
const newest = await monei . transactions . getAll ({
sortBy: 'createdAt' ,
sortOrder: 'desc' ,
limit: 20
});
// Sort by date (oldest first)
const oldest = await monei . transactions . getAll ({
sortBy: 'createdAt' ,
sortOrder: 'asc' ,
limit: 20
});
// Sort by amount (highest first)
const highestAmount = await monei . transactions . getAll ({
sortBy: 'amount' ,
sortOrder: 'desc' ,
limit: 20
});
// Sort by amount (lowest first)
const lowestAmount = await monei . transactions . getAll ({
sortBy: 'amount' ,
sortOrder: 'asc' ,
limit: 20
});
// Sort by last updated
const recentlyUpdated = await monei . transactions . getAll ({
sortBy: 'updatedAt' ,
sortOrder: 'desc' ,
limit: 20
});
Common Filtering Patterns
Monthly Report
Failed Transactions
Large Transactions
Pending Review
// Get all transactions for a specific month
async function getMonthlyReport ( year , month ) {
const startDate = ` ${ year } - ${ String ( month ). padStart ( 2 , '0' ) } -01` ;
const lastDay = new Date ( year , month , 0 ). getDate ();
const endDate = ` ${ year } - ${ String ( month ). padStart ( 2 , '0' ) } - ${ lastDay } ` ;
const txns = await monei . transactions . getAll ({
startDate: startDate ,
endDate: endDate ,
limit: 1000
});
return txns ;
}
// Usage
const feb2024 = await getMonthlyReport ( 2024 , 2 );
console . log ( 'February 2024:' , feb2024 . pagination . total );
// Get all failed transactions to review
async function getFailedTransactions () {
const failed = await monei . transactions . getAll ({
status: 'FAILED' ,
sortBy: 'createdAt' ,
sortOrder: 'desc' ,
limit: 100
});
console . log ( 'Failed Transactions:' , failed . pagination . total );
failed . transactions . forEach ( tx => {
console . log ( ` ${ tx . reference } : ₦ ${ tx . amount } ` );
console . log ( ` Reason: ${ tx . failureReason || 'Unknown' } ` );
});
return failed ;
}
await getFailedTransactions ();
// Get transactions over a certain threshold
async function getLargeTransactions ( threshold = 50000 ) {
const large = await monei . transactions . getAll ({
minAmount: threshold ,
currency: 'NGN' ,
sortBy: 'amount' ,
sortOrder: 'desc' ,
limit: 100
});
console . log ( `Transactions Over ₦ ${ threshold } :` , large . pagination . total );
return large ;
}
await getLargeTransactions ( 100000 );
// Get all pending transactions
async function getPendingTransactions () {
const pending = await monei . transactions . getAll ({
status: 'PENDING' ,
sortBy: 'createdAt' ,
sortOrder: 'asc' ,
limit: 100
});
console . log ( 'Pending Transactions:' , pending . pagination . total );
// Group by age
const now = Date . now ();
const byAge = {
recent: [], // < 1 hour
moderate: [], // 1-24 hours
old: [] // > 24 hours
};
pending . transactions . forEach ( tx => {
const age = now - new Date ( tx . createdAt ). getTime ();
const hours = age / ( 1000 * 60 * 60 );
if ( hours < 1 ) {
byAge . recent . push ( tx );
} else if ( hours < 24 ) {
byAge . moderate . push ( tx );
} else {
byAge . old . push ( tx );
}
});
console . log ( 'Recent (<1h):' , byAge . recent . length );
console . log ( 'Moderate (1-24h):' , byAge . moderate . length );
console . log ( 'Old (>24h):' , byAge . old . length );
return byAge ;
}
await getPendingTransactions ();
Best Practices
Specific Filters Use specific filters to reduce response size
Date Ranges Always use date ranges for large datasets
Limit Results Use appropriate page limits (max 100)
Cache Results Cache frequently accessed filter results
Sort Wisely Sort by indexed fields (createdAt, amount)
Pagination Always implement pagination for UX
Next Steps
Management Learn transaction management basics
Webhooks Set up real-time transaction notifications
Analytics Analyze transaction patterns
Export Export transaction data