Testing Merge linking using CodeSandbox

Last updated: December 8, 2025

Overview

When implementing Merge, you might want to see Merge Link in action before wiring it into your own product. This public sandbox provides a fast, low-lift way to do exactly that.

This sandbox is designed to help newly onboarding customers experience the full Merge Link connection flow without needing to build any backend or frontend code. By generating a single link_token and pasting it into the sandbox, you can instantly launch Merge Link, test different categories and integrations, and walk through the exact flow your end users will see. It’s an easy, low-effort way to validate your configuration, understand how Merge Link behaves, and get hands-on familiarity with the linking experience before integrating it into your own product.

Sandbox URL: https://codesandbox.io/p/sandbox/merge-link-sandbox-public-mgj2rl

Screenshot 2025-12-02 at 11.55.08 AM.png

Prerequisites

Before you start, you'll need

  • A Merge account

  • An API key from the Merge dashboard

  • The ability to make an HTTP request (cURL, Postman, or your own script)

If you're new to Merge Link, you can read the full guide here (optional but helpful).

Instructions

1. Generate a link_token

The sandbox doesn’t generate tokens for you. Each visitor creates their own link_token using the Merge API, then pastes it into the sandbox.

Call this endpoint:

POST https://api.merge.dev/api/{category}/v1/link-token

Use your API Key in the Authorization header.

Example (cURL)

curl -X POST 'https://api.merge.dev/api/hris/v1/link-token' \
-H 'Authorization: Bearer [Insert your API key]' \
-H 'Content-Type: application/json'
-d '{
    "end_user_origin_id": "sandbox-user-123",
    "end_user_organization_name": "Sandbox Org",
    "end_user_email_address": "[email protected]",
    "categories": ["hris"]
  }'

Required fields (simplest setup):

  1. end_user_origin_id: Unique ID for this end user in your system

  2. end_user_organization_name: Your customer’s organization name

  3. end_user_email_address: Their email

  4. categories: Which Merge categories to show in the Link UI

    • e.g. ["hris", "ats", "accounting", "ticketing", "crm", "filestorage", "knowledgebase"]

Optional:

  • integration: Skip the selection menu and jump straight to a specific integration. Note: if a single integration is specified, only one category can be included.

  • link_expiry_mins: Customize how long the token is valid (default 30).

  • should_create_magic_link_url: true/false to also generate a Magic Link URL. Note: magic link url creation is only supported for a single category.

The response will look like:

{
    "link_token": "Ha8xBFvbXT2CYDEfjUqAILB247B5fI7J4L2rC-tiWf1J0xc7UndVTw",
    "integration_name": null,
    "magic_link_url": null
}

Copy the value of link_token – you’ll use it in the sandbox.

2. Plug your link_token into the sandbox

  1. Open the public sandbox:

    1. https://codesandbox.io/p/sandbox/merge-link-sandbox-public-mgj2rl

  2. Sign in to fork and edit the sandbox.

  3. In the UI, find the linkToken initialization.

  4. Paste your link_token from the API response.

    Screenshot 2025-12-02 at 11.07.49 AM.png
  5. Refresh the Preview and then click the Preview linking experience button to launch Merge Link.

    Screenshot 2025-12-02 at 11.28.20 AM.png
  6. The sandbox will use that token to render the Merge Link component, just like you would in your own frontend.

3. Go through the linking experience

In the Merge Link modal:

  1. Pick a category (e.g. HRIS, ATS, CRM) based on what you included in categories in your request.

  2. Choose an integration (e.g. “BambooHR”, “Workday”, etc.).

  3. Complete the provider’s auth flow (login, OAuth, API key, etc.).

When the flow completes successfully, Merge Link returns a public_token to the frontend via the onSuccess callback.

In this sandbox, that value is logged to the browser console:

  • Open up Developer Tools in your web browser → Console and look for a message containing a string.

    Screenshot 2025-12-02 at 11.39.20 AM.png

4. What this would look like in your own app

The sandbox is only simulating the frontend part. In a real integration, the flow is:

  1. Backend: Create a link_token (same as you did above).

  2. Frontend: Initialize Merge Link with that link_token.

  3. Frontend: When Merge Link returns a public_token in onSuccess, send it to your backend.

  4. Backend: Exchange the public_token for an account_token using the category-specific account-token endpoint, e.g.:

GET https://api.merge.dev/api/hris/v1/account-token/{public_token}
  1. Backend: Store the account_token securely – that’s what you’ll use as X-Account-Token when calling the Unified API on behalf of this linked account.