Skip to main content

Overview

Monzoh includes a built-in mock mode that allows you to test your application without making real API calls to the Monzo API. This is particularly useful for:
  • Development: Test your application logic without affecting real accounts
  • Testing: Write unit tests without requiring API credentials
  • Demos: Showcase your application with realistic data
  • Rate limit avoidance: Develop without consuming your API quota

Enabling Mock Mode

Mock mode is activated by using "test" as your access token:
When using mock mode, no real HTTP requests are made to the Monzo API. All responses are generated from predefined mock data.

Mock Data Coverage

Mock mode provides realistic test data for all major API endpoints:

Accounts

Mock accounts include:
  • Current account with realistic balance and spend data
  • Savings account with different balance information
  • Proper account IDs and metadata

Transactions

Mock transactions include:
  • Various transaction types (purchases, transfers, direct debits)
  • Realistic merchant data with logos and categories
  • Different amounts and descriptions
  • Proper timestamps and metadata

Balance Information

Pots (Savings)

Other Endpoints

Mock data is also available for:
  • Webhooks: Mock webhook registration and management
  • Attachments: Simulated file upload responses
  • Receipts: Mock receipt creation and management
  • Feed items: Sample custom feed item creation

Using Mock Mode in Tests

Mock mode is perfect for unit testing:

Development Workflow

Use mock mode during development to build your application logic:

Mock vs Real API Comparison

Limitations of Mock Mode

While mock mode is powerful, there are some limitations to be aware of:

1. Static Data

Mock data is predefined and doesn’t change based on operations:

2. Limited Error Scenarios

Mock mode doesn’t simulate all possible error conditions:

3. Business Logic Validation

Mock mode doesn’t enforce real-world business rules:

Advanced Mock Testing

For more sophisticated testing scenarios, combine mock mode with testing libraries:

Best Practices

1. Environment-Based Mode Selection

2. Feature Flags for Mock Mode

3. Mock Data Validation

Mock mode is an essential tool for Monzoh development, enabling you to build and test applications efficiently without consuming API quotas or affecting real account data. Use it extensively during development and testing, then switch to the real API for production deployment.