Beta Version: The API is under active development and may change without notice. Not recommended for production use until stable version is released.

Getting Started with OTPDock

Learn how to integrate OTPDock into your application and automate OTP verification in your tests.

Installation

npmnpm install @otpdock/client
yarnyarn add @otpdock/client

Basic Usage

To get started, you'll need an API key from the OTPDock dashboard. If you don't have an account yet, sign up here.

Here's a basic example showing how to generate a temporary inbox and capture an OTP code in your tests:


import { OtpDockClient } from '@otpdock/client';
const client = new OtpDockClient('your_api_key_here');

describe('Sign Up Flow', () => {
  it('should complete registration with email verification', async () => {
    // Generate a temporary inbox
    const inbox = await client.generateTemporaryInbox({ prefix: 'e2e-test' });

    // Fill out the registration form code with the email address from inbox.email

    // Wait for and retrieve the OTP code
    const otp = await inbox.getOtp({ timeout: 20000 });

    // Fill out the verification code
  
    // Verify successful registration
  });
});

The example above demonstrates the core functionality: generating a temporary inbox and retrieving an OTP code. Check out our framework-specific guides below for complete examples with Playwright or Cypress.

Resources