How to set a primary domain on Dub?

Learn what a primary domain is on Dub and how to set it up.

Steven Tey

Written by Steven Tey

Dub.co is the only link management platform that allows you to add custom domains for free. On Dub, you can add up to 3 domains on the free plan, and 10+ domains on the Pro plan and above.

When you add multiple domains to your Dub account, the first domain you add will automatically be set as the primary domain. This domain will be the default domain in your link creation modal:

Primary domain in the link creation modal
Primary domain in the link creation modal

It will also be the default domain if when using the Dub API. Here's an example of how it works with our TypeScript SDK:

import Dub from "dub";

const dub = new Dub({
  workspaceId: "xxx",
});

async function main() {
  const link = await dub.links.create({
    url: "string",
    // domain: (optional - default to primary domain)
  });

  console.log(link);
}

main();

If you want, you can change the primary domain to another domain that you have added to your Dub account.

Here's how you can set a primary domain on Dub:

  1. Go to the Dub dashboard.
  2. Click on the Domains tab on the top navigation bar.
  3. Click on the button of domain that you want to set as the primary domain, which will open a dropdown menu.
  4. In the dropdown menu, click on the Set as Primary button, which will open the primary domain modal.
More options popover
More options popover
  1. Click on the Set as primary domain button in the modal.
Set as primary domain modal
Set as primary domain modal

Voilà! You have successfully set a primary domain on Dub. Now, the domain you have set as the primary domain will be the default domain in your link creation modal and when using the Dub API.

Did this answer your question?