---
title: "How to open links in a specific browser profile"
description: "Make Donut Browser your default browser so each link from mail, chat or other apps asks which profile opens it, or open a URL in a chosen profile by API."
url: "https://donutbrowser.com/docs/guides/open-links-in-a-profile/"
---

# How to open links in a specific browser profile

When you click a link in a mail or chat app, Chrome opens it in the profile whose window you used last. With several accounts, that puts a link for one account into the session of another. Donut Browser can be your system's default browser and ask which profile opens each link. Scripts can open a URL in a named profile through the local API. You need Donut Browser [installed](https://donutbrowser.com/docs/install) (not the portable Windows build) and at least one profile.

## 1. Make Donut the default browser

1. Open **Settings** (**Cmd/Ctrl+,**) and go to **Default Browser**.
2. Click **Set as default browser**.

What happens next depends on the system:

| System | What Donut does |
| --- | --- |
| macOS | Registers itself for `http` and `https` links. macOS can ask you to confirm the change. |
| Windows | Registers itself and opens Windows Settings. Choose Donut Browser under **Web browser** to finish. The toast reads "Finish in Windows Settings". |
| Linux | Runs `xdg-mime default` for `http` and `https`, so `xdg-utils` must be installed. In a Snap it uses `xdg-settings`. The Flatpak build cannot set itself as default and shows instructions instead. |

The row then reads "Donut Browser is your default browser", with an **Active** chip in place of the button. The portable Windows build has no **Default Browser** section.

## 2. Click a link and choose the profile

Click a link in any app. Donut comes to the front and shows **Open link** with the link's host and path and a copy button.

- Profiles that are running have a green **Running** badge, and the first running profile is selected.
- With 6 profiles or more, a search box finds profiles by name, proxy or VPN name, or group.
- Each row shows the profile's operating system, proxy or VPN, and group, and marks password-protected and ephemeral profiles.

Choose the profile and click **Open**, press **Enter**, or double-click the row. If the profile runs, the link opens in a new tab of that browser. If it is stopped, Donut launches it with the link. A profile that is starting or stopping cannot take the link until it is done.

Before a stopped profile starts, Donut runs its usual launch checks. A [timezone mismatch with the proxy](https://donutbrowser.com/docs/guides/match-timezone-to-proxy) can stop the launch, and the picker then shows an error.

## Donut asks every time

Donut has no rule that sends links from one site to one profile. It always shows **Open link**. There is no command-line flag or `donut://` link that picks a profile either: a URL passed to the app opens the same picker.

To open links in one profile without a question, use the API below from a script, a launcher or a keyboard tool.

## Open a URL in a profile from a script

`POST /v1/profiles/{id}/open-url` opens a URL in a profile. If the profile is stopped, Donut launches it with a window. If it runs, the URL opens in a new tab. If the profile runs on a [remote machine](https://donutbrowser.com/docs/remote-browsers), that session goes to the URL. The route needs Pro, Team or Enterprise; other plans get `402`. Turn on the [local API](https://donutbrowser.com/docs/quickstart) and export the token as `DONUT_API_KEY` first.

```bash
curl -sS -X POST http://127.0.0.1:10108/v1/profiles/<profile id>/open-url \
  -H "Authorization: Bearer $DONUT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://mail.example.com/inbox"}'
```

```javascript
async function openIn(profileId, url) {
  const res = await fetch(
    `http://127.0.0.1:10108/v1/profiles/${profileId}/open-url`,
    {
      method: "POST",
      headers: {
        Authorization: `Bearer ${process.env.DONUT_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({ url }),
    },
  );
  if (!res.ok) throw new Error(`open-url failed: ${res.status}`);
}
```

```python
import os, requests

def open_in(profile_id: str, url: str) -> None:
    response = requests.post(
        f"http://127.0.0.1:10108/v1/profiles/{profile_id}/open-url",
        headers={"Authorization": f"Bearer {os.environ['DONUT_API_KEY']}"},
        json={"url": url},
        timeout=60,
    )
    response.raise_for_status()
```

Find a profile's ID in its panel (**Overview**), in the table's **ID** column when the window is wide, or with `GET /v1/profiles`. A small shell function gives you one command per account:

```bash
# ~/.zshrc or ~/.bashrc
open_in() {
  curl -sS -X POST "http://127.0.0.1:10108/v1/profiles/$1/open-url" \
    -H "Authorization: Bearer $DONUT_API_KEY" \
    -H "Content-Type: application/json" \
    -d "{\"url\": \"$2\"}"
}
# open_in <profile id> https://example.com
```

Only `http`, `https` and `about:blank` addresses are allowed. Unlike a launch from the picker, a launch from the API is not stopped by a timezone mismatch; the app shows a warning instead.

## Troubleshooting

| Problem | What to do |
| --- | --- |
| "Could not set the default browser" | On Linux, install `xdg-utils` and try again. On Windows, finish the choice in Windows Settings. |
| Links still open in another browser | Donut is not the default. In **Settings** → **Default Browser**, the row reads "Donut Browser is not your default browser". Set it again. |
| "This profile is launching. Wait a moment." | The profile is starting. Wait, then open the link again. |
| "No profiles available. Please create a profile first." | Create a profile in the main window. |
| `402` from `open-url` | The route needs Pro, Team or Enterprise. |
| `400` with "Only http and https addresses can be opened." | The URL has another scheme, such as `file:` or `mailto:`. |
| `409` from `open-url` | A teammate has the profile locked, or a remote session of it is still being pulled back. |

## Related

- [Profiles and fingerprints](https://donutbrowser.com/docs/profiles#open-links-in-the-right-profile): the setting in the app.
- [Settings and shortcuts](https://donutbrowser.com/docs/settings): every setting.
- [How to run several browser profiles at once with Playwright](https://donutbrowser.com/docs/guides/run-profiles-in-parallel)

The link picker is free. Opening URLs by API is part of [Pro](https://donutbrowser.com/pricing).
