> ## 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.

# Management

> Manage and monitor all your transactions across Monei

## Overview

Track all your transactions across Naira wallet, crypto, offramp, and bill payments in one unified interface. This guide covers transaction management, monitoring, and reporting.

**What you'll learn:**

* Get all transactions
* View transaction details
* Track transaction status
* Search and filter
* Export transaction data

***

## Transaction Types

Monei supports multiple transaction types:

<CardGroup cols={3}>
  <Card title="Naira" icon="naira-sign">
    Deposits, payouts, transfers
  </Card>

  <Card title="Crypto" icon="bitcoin">
    EVM and Solana transactions
  </Card>

  <Card title="Offramp" icon="money-bill-transfer">
    Crypto to fiat conversions
  </Card>

  <Card title="Bill Payments" icon="file-invoice-dollar">
    Airtime, data, utilities
  </Card>

  <Card title="Swaps" icon="arrows-rotate">
    Token swaps on DEXs
  </Card>

  <Card title="P2P" icon="users">
    Peer-to-peer transfers
  </Card>
</CardGroup>

***

## Get All Transactions

Retrieve all your transactions across all types.

<CodeGroup>
  ```javascript Node.js theme={null}
  import MoneiSDK from 'monei-sdk';

  const monei = new MoneiSDK({
    apiKey: process.env.MONEI_API_KEY,
  });

  // Get all transactions
  const transactions = await monei.transactions.getAll({
    page: 1,
    limit: 20,
    sortBy: 'createdAt',
    sortOrder: 'desc'
  });

  console.log(`Total Transactions: ${transactions.pagination.total}\n`);

  transactions.transactions.forEach(tx => {
    console.log(`${tx.type} - ₦${tx.amount} ${tx.currency}`);
    console.log(`  Status: ${tx.status}`);
    console.log(`  Reference: ${tx.reference}`);
    console.log(`  Date: ${new Date(tx.createdAt).toLocaleString()}`);
    console.log(`  Narration: ${tx.narration || 'N/A'}`);
    console.log('');
  });
  ```

  ```python Python theme={null}
  from monei import MoneiClient

  monei = MoneiClient(
      api_key=os.getenv('MONEI_API_KEY')
  )

  # Get all transactions
  transactions = monei.transactions.get_all(
      page=1,
      limit=20,
      sort_by='createdAt',
      sort_order='desc'
  )

  print(f'Total: {transactions.pagination.total}\n')

  for tx in transactions.transactions:
      print(f'{tx.type} - ₦{tx.amount} {tx.currency}')
      print(f'  Status: {tx.status}')
      print(f'  Reference: {tx.reference}')
      print(f'  Date: {tx.created_at}')
      print()
  ```

  ```bash cURL theme={null}
  curl "https://api.monei.cc/api/v1/transactions/user?page=1&limit=20&sortBy=createdAt&sortOrder=desc" \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

**Query Parameters:**

| Parameter   | Type   | Description               | Default   |
| ----------- | ------ | ------------------------- | --------- |
| `page`      | number | Page number               | 1         |
| `limit`     | number | Items per page (max: 100) | 10        |
| `status`    | string | Filter by status          | All       |
| `type`      | string | Filter by type            | All       |
| `currency`  | string | Filter by currency        | All       |
| `minAmount` | number | Minimum amount            | None      |
| `maxAmount` | number | Maximum amount            | None      |
| `startDate` | string | Start date (YYYY-MM-DD)   | None      |
| `endDate`   | string | End date (YYYY-MM-DD)     | None      |
| `sortBy`    | string | Sort field                | createdAt |
| `sortOrder` | string | asc or desc               | desc      |

**Response:**

```json theme={null}
{
  "statusCode": 200,
  "message": "Transactions retrieved successfully",
  "data": {
    "transactions": [
      {
        "id": "tx_abc123",
        "reference": "TXN-ABC123XYZ",
        "type": "DEBIT",
        "status": "SUCCESS",
        "amount": 5000,
        "currency": "NGN",
        "narration": "MTN Airtime Purchase",
        "metadata": {
          "billerId": "mtn-ng",
          "customerName": "JOHN DOE"
        },
        "createdAt": "2024-02-15T10:30:00Z",
        "updatedAt": "2024-02-15T10:30:05Z"
      }
    ],
    "pagination": {
      "page": 1,
      "limit": 20,
      "total": 150,
      "pages": 8
    }
  }
}
```

***

## Transaction Types

| Type            | Description                | Example                            |
| --------------- | -------------------------- | ---------------------------------- |
| `DEBIT`         | Money leaving your wallet  | Bill payment, payout, transfer out |
| `CREDIT`        | Money entering your wallet | Deposit, refund, transfer in       |
| `PEER-TRANSFER` | P2P transfer               | Send/receive from other users      |
| `SWAP`          | Token exchange             | DEX swap on EVM/Solana             |
| `OFFRAMP`       | Crypto to fiat             | USDT to NGN conversion             |

***

## Transaction Status

Understanding transaction states:

| Status       | Description            | Final State |
| ------------ | ---------------------- | ----------- |
| `PENDING`    | Transaction initiated  | No          |
| `PROCESSING` | Being processed        | No          |
| `SUCCESS`    | Completed successfully | Yes         |
| `COMPLETED`  | Fully completed        | Yes         |
| `FAILED`     | Transaction failed     | Yes         |
| `REVERSED`   | Reversed/refunded      | Yes         |
| `CANCELLED`  | Cancelled by user      | Yes         |

***

## Get Transaction by ID

Retrieve specific transaction details.

<CodeGroup>
  ```javascript Node.js theme={null}
  // Get transaction by ID
  const transaction = await monei.transactions.getById('tx_abc123');

  console.log('Transaction Details:');
  console.log('===================');
  console.log('ID:', transaction.id);
  console.log('Reference:', transaction.reference);
  console.log('Type:', transaction.type);
  console.log('Status:', transaction.status);
  console.log('Amount:', transaction.amount, transaction.currency);
  console.log('Narration:', transaction.narration);
  console.log('Created:', new Date(transaction.createdAt).toLocaleString());
  console.log('Updated:', new Date(transaction.updatedAt).toLocaleString());

  // Check metadata for additional info
  if (transaction.metadata) {
    console.log('\nMetadata:');
    console.log(JSON.stringify(transaction.metadata, null, 2));
  }

  // For blockchain transactions
  if (transaction.metadata?.signature || transaction.metadata?.txHash) {
    console.log('\nBlockchain Details:');
    console.log('Hash:', transaction.metadata.signature || transaction.metadata.txHash);
    console.log('Network:', transaction.metadata.network || transaction.metadata.chainId);
  }
  ```

  ```python Python theme={null}
  # Get by ID
  transaction = monei.transactions.get_by_id('tx_abc123')

  print('Transaction Details:')
  print('=' * 20)
  print(f'ID: {transaction.id}')
  print(f'Reference: {transaction.reference}')
  print(f'Type: {transaction.type}')
  print(f'Status: {transaction.status}')
  print(f'Amount: {transaction.amount} {transaction.currency}')
  print(f'Narration: {transaction.narration}')
  print(f'Created: {transaction.created_at}')

  if transaction.metadata:
      print('\nMetadata:')
      print(transaction.metadata)
  ```

  ```bash cURL theme={null}
  curl https://api.monei.cc/api/v1/transactions/tx_abc123 \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

***

## Get Transaction by Reference

Retrieve transaction using your custom reference.

<CodeGroup>
  ```javascript Node.js theme={null}
  // Get by reference
  const transaction = await monei.transactions.getByReference('TXN-ABC123XYZ');

  console.log('Transaction found!');
  console.log('ID:', transaction.id);
  console.log('Reference:', transaction.reference);
  console.log('Status:', transaction.status);
  console.log('Amount:', transaction.amount, transaction.currency);
  ```

  ```python Python theme={null}
  # Get by reference
  transaction = monei.transactions.get_by_reference('TXN-ABC123XYZ')

  print('Transaction found!')
  print(f'ID: {transaction.id}')
  print(f'Reference: {transaction.reference}')
  print(f'Status: {transaction.status}')
  ```

  ```bash cURL theme={null}
  curl https://api.monei.cc/api/v1/transactions/reference/TXN-ABC123XYZ \
    -H "x-api-key: YOUR_API_KEY"
  ```
</CodeGroup>

***

## Filter Transactions

Filter transactions by various criteria.

<CodeGroup>
  ```javascript Node.js theme={null}
  // Get successful transactions only
  const successful = await monei.transactions.getAll({
    status: 'SUCCESS',
    limit: 20
  });

  console.log('Successful Transactions:', successful.pagination.total);

  // Get debit transactions (money out)
  const debits = await monei.transactions.getAll({
    type: 'DEBIT',
    limit: 20
  });

  console.log('Debit Transactions:', debits.pagination.total);

  // Get credit transactions (money in)
  const credits = await monei.transactions.getAll({
    type: 'CREDIT',
    limit: 20
  });

  console.log('Credit Transactions:', credits.pagination.total);

  // Get transactions by currency
  const usdTransactions = await monei.transactions.getAll({
    currency: 'USD',
    limit: 20
  });

  console.log('USD Transactions:', usdTransactions.pagination.total);

  // Get transactions by amount range
  const largeTransactions = await monei.transactions.getAll({
    minAmount: 10000,
    maxAmount: 100000,
    limit: 20
  });

  console.log('Large Transactions (₦10K-₦100K):', largeTransactions.pagination.total);

  // Get transactions by date range
  const thisMonth = await monei.transactions.getAll({
    startDate: '2024-02-01',
    endDate: '2024-02-29',
    limit: 100
  });

  console.log('This Month:', thisMonth.pagination.total);
  ```

  ```python Python theme={null}
  # Successful only
  successful = monei.transactions.get_all(
      status='SUCCESS',
      limit=20
  )

  print(f'Successful: {successful.pagination.total}')

  # Debits only
  debits = monei.transactions.get_all(
      type='DEBIT',
      limit=20
  )

  print(f'Debits: {debits.pagination.total}')

  # By currency
  usd_txns = monei.transactions.get_all(
      currency='USD',
      limit=20
  )

  print(f'USD Transactions: {usd_txns.pagination.total}')

  # By amount range
  large_txns = monei.transactions.get_all(
      min_amount=10000,
      max_amount=100000,
      limit=20
  )

  print(f'Large Transactions: {large_txns.pagination.total}')

  # By date range
  this_month = monei.transactions.get_all(
      start_date='2024-02-01',
      end_date='2024-02-29',
      limit=100
  )

  print(f'This Month: {this_month.pagination.total}')
  ```
</CodeGroup>

***

## Transaction Analytics

Analyze your transaction patterns.

<CodeGroup>
  ```javascript Node.js theme={null}
  async function analyzeTransactions(startDate, endDate) {
    // Get all transactions
    const txns = await monei.transactions.getAll({
      startDate: startDate,
      endDate: endDate,
      limit: 1000
    });
    
    const analytics = {
      total: txns.pagination.total,
      totalIn: 0,
      totalOut: 0,
      byType: {},
      byCurrency: {},
      byStatus: {},
      largestTransaction: null
    };
    
    // Process each transaction
    txns.transactions.forEach(tx => {
      // Calculate in/out
      if (tx.type === 'CREDIT') {
        analytics.totalIn += tx.amount;
      } else if (tx.type === 'DEBIT') {
        analytics.totalOut += tx.amount;
      }
      
      // By type
      analytics.byType[tx.type] = (analytics.byType[tx.type] || 0) + 1;
      
      // By currency
      analytics.byCurrency[tx.currency] = 
        (analytics.byCurrency[tx.currency] || 0) + tx.amount;
      
      // By status
      analytics.byStatus[tx.status] = (analytics.byStatus[tx.status] || 0) + 1;
      
      // Largest transaction
      if (!analytics.largestTransaction || tx.amount > analytics.largestTransaction.amount) {
        analytics.largestTransaction = tx;
      }
    });
    
    // Calculate net
    analytics.net = analytics.totalIn - analytics.totalOut;
    
    // Display
    console.log('Transaction Analytics');
    console.log('====================');
    console.log('Total Transactions:', analytics.total);
    console.log('Total In: ₦' + analytics.totalIn.toLocaleString());
    console.log('Total Out: ₦' + analytics.totalOut.toLocaleString());
    console.log('Net: ₦' + analytics.net.toLocaleString());
    
    console.log('\nBy Type:');
    Object.entries(analytics.byType).forEach(([type, count]) => {
      console.log(`  ${type}: ${count}`);
    });
    
    console.log('\nBy Currency:');
    Object.entries(analytics.byCurrency).forEach(([currency, amount]) => {
      console.log(`  ${currency}: ${amount.toLocaleString()}`);
    });
    
    console.log('\nBy Status:');
    Object.entries(analytics.byStatus).forEach(([status, count]) => {
      console.log(`  ${status}: ${count}`);
    });
    
    console.log('\nLargest Transaction:');
    console.log(`  ${analytics.largestTransaction.type}: ${analytics.largestTransaction.amount} ${analytics.largestTransaction.currency}`);
    console.log(`  ${analytics.largestTransaction.narration}`);
    
    return analytics;
  }

  // Analyze this month
  await analyzeTransactions('2024-02-01', '2024-02-29');
  ```

  ```python Python theme={null}
  async def analyze_transactions(start_date, end_date):
      # Get transactions
      txns = monei.transactions.get_all(
          start_date=start_date,
          end_date=end_date,
          limit=1000
      )
      
      analytics = {
          'total': txns.pagination.total,
          'total_in': 0,
          'total_out': 0,
          'by_type': {},
          'by_currency': {},
          'by_status': {}
      }
      
      # Process
      for tx in txns.transactions:
          # In/Out
          if tx.type == 'CREDIT':
              analytics['total_in'] += tx.amount
          elif tx.type == 'DEBIT':
              analytics['total_out'] += tx.amount
          
          # By type
          analytics['by_type'][tx.type] = \
              analytics['by_type'].get(tx.type, 0) + 1
          
          # By currency
          analytics['by_currency'][tx.currency] = \
              analytics['by_currency'].get(tx.currency, 0) + tx.amount
          
          # By status
          analytics['by_status'][tx.status] = \
              analytics['by_status'].get(tx.status, 0) + 1
      
      # Net
      analytics['net'] = analytics['total_in'] - analytics['total_out']
      
      # Display
      print('Transaction Analytics')
      print('=' * 20)
      print(f"Total: {analytics['total']}")
      print(f"In: ₦{analytics['total_in']:,}")
      print(f"Out: ₦{analytics['total_out']:,}")
      print(f"Net: ₦{analytics['net']:,}")
      
      print('\nBy Type:')
      for tx_type, count in analytics['by_type'].items():
          print(f'  {tx_type}: {count}')
      
      return analytics

  # Analyze
  await analyze_transactions('2024-02-01', '2024-02-29')
  ```
</CodeGroup>

***

## Export Transactions

Export transaction data for accounting or reporting.

<CodeGroup>
  ```javascript Node.js theme={null}
  async function exportToCSV(startDate, endDate) {
    const txns = await monei.transactions.getAll({
      startDate: startDate,
      endDate: endDate,
      limit: 1000
    });
    
    // CSV headers
    const headers = [
      'Date',
      'Reference',
      'Type',
      'Status',
      'Amount',
      'Currency',
      'Narration'
    ];
    
    // CSV rows
    const rows = txns.transactions.map(tx => [
      new Date(tx.createdAt).toISOString(),
      tx.reference,
      tx.type,
      tx.status,
      tx.amount,
      tx.currency,
      tx.narration || ''
    ]);
    
    // Combine
    const csv = [
      headers.join(','),
      ...rows.map(row => row.map(field => `"${field}"`).join(','))
    ].join('\n');
    
    // Save
    const fs = require('fs');
    fs.writeFileSync('transactions.csv', csv);
    
    console.log('Exported', txns.transactions.length, 'transactions');
    
    return csv;
  }

  // Export this month
  await exportToCSV('2024-02-01', '2024-02-29');
  ```

  ```python Python theme={null}
  import csv

  async def export_to_csv(start_date, end_date):
      txns = monei.transactions.get_user_transactions(
          start_date=start_date,
          end_date=end_date,
          limit=1000
      )
      
      # Write CSV
      with open('transactions.csv', 'w', newline='') as f:
          writer = csv.writer(f)
          
          # Headers
          writer.writerow([
              'Date', 'Reference', 'Type', 'Status',
              'Amount', 'Currency', 'Narration'
          ])
          
          # Rows
          for tx in txns.transactions:
              writer.writerow([
                  tx.created_at,
                  tx.reference,
                  tx.type,
                  tx.status,
                  tx.amount,
                  tx.currency,
                  tx.narration or ''
              ])
      
      print(f'Exported {len(txns.transactions)} transactions')

  # Export
  await export_to_csv('2024-02-01', '2024-02-29')
  ```
</CodeGroup>

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Use Pagination" icon="pages">
    Don't fetch all transactions at once - use pagination
  </Card>

  <Card title="Filter Wisely" icon="filter">
    Use filters to reduce response size and improve performance
  </Card>

  <Card title="Save References" icon="bookmark">
    Always save transaction references for tracking
  </Card>

  <Card title="Monitor Status" icon="eye">
    Check pending transactions regularly
  </Card>

  <Card title="Export Regularly" icon="download">
    Export transaction history for accounting
  </Card>

  <Card title="Use Webhooks" icon="webhook">
    Set up webhooks for real-time updates
  </Card>
</CardGroup>

***

## Next Steps

<CardGroup cols={2}>
  <Card title="Filtering" icon="filter" href="/transactions/filtering">
    Advanced filtering and search
  </Card>

  <Card title="Naira Wallet" icon="naira-sign" href="/naira-wallet/deposits">
    Manage Naira transactions
  </Card>

  <Card title="EVM Blockchain" icon="ethereum" href="/evm-blockchain/transactions">
    View crypto transactions
  </Card>

  <Card title="Bill Payments" icon="file-invoice-dollar" href="/bill-payments/history">
    View bill payment history
  </Card>
</CardGroup>
