Skip to main content
Welcome to Entri! This guide will walk you through your first integration.
New to DNS? Check out DNS Concepts for a quick primer on record types, propagation, and common gotchas.

1. Set up your dashboard

Before writing code, configure your application in the Entri Dashboard:
  1. Sign up or log in
  2. Create an application
  3. Set your display name and icon (PNG or SVG, 1:1 ratio, white or transparent background)
  4. Copy your applicationId and secret
Dashboard

2. Install Entri

Choose your preferred installation method:
<script src="https://cdn.goentri.com/entri.js"></script>
If using npm, import it in your code:
import Entri from 'entrijs';

3. Get a JWT token

For security, fetch the JWT on your server-side. The token expires after 60 minutes.
Never expose your secret in client-side code. Always fetch the JWT from your backend.
fetch('https://api.goentri.com/token', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    applicationId: "YOUR_APP_ID",    // From the dashboard
    secret: "YOUR_SECRET"            // From the dashboard
  }),
})
.then(response => response.json())
.then(data => {
  console.log('Token:', data.auth_token);
  // Save this token to use in step 4
})
.catch(error => console.error('Error:', error));

4. Launch the Entri modal

With your token ready, launch the Entri modal:
entri.showEntri({
  applicationId: "YOUR_APP_ID",
  token: "YOUR_JWT_TOKEN",  // From step 3
  dnsRecords: [
    {
      type: "CNAME",
      host: "www",
      value: "your-app.com",
      ttl: 300
    }
  ]
});
MX records require a priority field. See DNS Records for all record types.

5. Handle events

Listen for completion and close events:
entri.showEntri({
  applicationId: "YOUR_APP_ID",
  token: "YOUR_JWT_TOKEN",
  dnsRecords: [...],

  // Called when DNS setup completes successfully
  onSuccess: (data) => {
    console.log('Domain configured:', data.domain);
    // { domain: "example.com", success: true, setupType: "automatic", ... }
  },

  // Called when the modal is closed
  onEntriClose: (data) => {
    console.log('Modal closed:', data);
  }
});

Complete example: React

Here’s a full working example with React:
import { useEffect, useState } from 'react';

function DomainSetup() {
  const [token, setToken] = useState(null);

  useEffect(() => {
    // Fetch JWT from your backend
    fetch('/api/entri-token')
      .then(res => res.json())
      .then(data => setToken(data.token));
  }, []);

  const handleSetup = () => {
    if (!token) return;

    entri.showEntri({
      applicationId: "YOUR_APP_ID",
      token: token,
      dnsRecords: [
        {
          type: "CNAME",
          host: "www",
          value: "your-app.com",
          ttl: 300
        }
      ],
      onSuccess: (data) => {
        console.log('Success:', data);
        // Update your UI or backend
      }
    });
  };

  return (
    <button onClick={handleSetup} disabled={!token}>
      Connect Your Domain
    </button>
  );
}

export default DomainSetup;
For more framework-specific examples, see our React Integration Guide and Vanilla JS Guide.

Next steps

Now that you have the basics working, explore Entri’s products:

Connect

Automated DNS configuration for 60+ providers

Sell

Let users purchase domains in your app

Secure

Automatic SSL certificate provisioning

Power

Custom domain management for your users

Dive deeper

Configuration Reference

All showEntri() options

Events Reference

Complete events documentation

Webhooks

Server-side notifications

DNS Concepts

Understanding DNS records

Need help?

We’re here to help! Email us at support@entri.com or reach out to your account manager.