Integration image

API for E2E test automation

Overview

The GetMyMFA API is designed to simplify the process of managing Multi-Factor Authentication (MFA) during end-to-end (E2E) tests. By using this API, you can bypass complex back-end modifications while still simulating real-world MFA flows. Key features of the GetMyMFA API include:

  • Programmatic API Access: Retrieve MFA codes directly from your application environment without any manual intervention.
  • Self-Service Key Management: Easily create, rotate, and manage your API keys through a self-service portal.
  • Comprehensive Documentation: Access Postman collections and Swaggers to streamline integration.

How It Works

Integrating the GetMyMFA API into your CI/CD or test automation workflow offers several benefits:

  • Simplifies Test Automation: The API allows you to seamlessly retrieve MFA codes programmatically, eliminating the need for manual intervention and reducing test complexity.
  • Enhances Security: Automate MFA processes without exposing sensitive data or modifying backend systems, maintaining high security standards throughout your development pipeline.
  • Improves Efficiency: By automating the retrieval and handling of MFA codes, you can accelerate your test cycles and ensure consistent results, leading to faster deployment times.

By leveraging the GetMyMFA API, you can streamline your CI/CD pipeline, reduce overhead, and maintain robust security practices, all while delivering a seamless experience for your development and testing teams.

Frequently Asked Questions

How does the GetMyMFA API retrieve MFA codes programmatically?

The GetMyMFA API exposes a REST endpoint at /v1/{phoneId}/mfa/latest that returns the most recent MFA code received by your virtual phone number. Call it with your API key in the x-api-key header, and the response includes the mfaCode field with the verification code. The API responds in under 500ms, making it fast enough for real-time test automation.

Can I run parallel tests with different MFA codes?

Yes. Purchase multiple virtual phone numbers and assign one to each parallel test worker. Each number receives its own MFA codes independently, so there are no collisions between concurrent test runs. This works with any parallel execution setup, including Playwright sharding, Cypress parallelization, and Selenium Grid.

Is there a rate limit on the GetMyMFA API?

The Pro plan supports up to 60 requests per minute per API key, which covers most test automation needs. The Enterprise plan offers higher rate limits and dedicated support for high-volume testing scenarios. Contact us at hello@mymfa.io if you need custom rate limits.

How do I handle MFA code timing in automated tests?

SMS codes typically arrive within 2-5 seconds. In your test, add a short wait (3-5 seconds) after triggering the MFA flow before calling the GetMyMFA API. For TOTP codes, there is no delay since they are generated instantly. If you need retry logic, poll the API endpoint every 2 seconds until a fresh code appears.