> ## Documentation Index
> Fetch the complete documentation index at: https://docs.lomadee.com.br/llms.txt
> Use this file to discover all available pages before exploring further.

# Deep link

> Build a tracked link to any page of a partner store, without opening the dashboard

A deep link is a URL you build yourself. It takes your channel and the store page you want to send people to, and redirects the click through Lomadee, so the sale is attributed to your channel.

```
https://lmdee.link/deep/{channel}?url={destination}&mdasc={sub-id}
```

| Part | Required | What it is |
| - | - | - |
| `{channel}` | Yes | Your [channel address](https://docs.lomadee.com.br/docs/affiliates/channel-address.md) (`blog-da-ana`) or the channel ID (a UUID) |
| `url` | Yes | The store page, starting with `https://` or `http://`. [Encode it](#encode-the-destination) |
| `mdasc` | No | Your [click sub-ID](https://docs.lomadee.com.br/docs/affiliates/click-sub-id.md), to tell clicks apart in your reports |

The link works on any of the Lomadee link domains: `lmdee.link`, `compre.vc` and `oferta.vc`. The examples use `lmdee.link`; the other two give the same result.

The first click on a new destination creates a link for your channel. Later clicks on the same channel and destination reuse it, so reports group them together.

## Before you start

* You have an active channel. See [Create a channel](https://docs.lomadee.com.br/docs/affiliates/channels.md).
* The store belongs to a brand on Lomadee, and the page is on a domain the brand registered.
* Your channel can promote that brand. Some brands approve channels first; see [Brand verticals](https://docs.lomadee.com.br/docs/get-started/verticals.md).

## Build a deep link

**1. Find your channel address or ID**

In the dashboard, open **Meus canais**. Each channel shows its address and its ID, and both can be copied. Either one works in the link.

**2. Copy the store page**

Open the product or category page on the store and copy the full URL from the browser.

**3. Encode the destination**

Percent-encode the page URL and put it after `url=`. See [Encode the destination](#encode-the-destination).

**4. Test the link**

Open the link in a private window. It should land on the store page. If it does not, check [When the link does not open](#when-the-link-does-not-open).

## Encode the destination

Encode the store URL before you put it in `url`. Without encoding, an `&` in the store URL would be read as a deep link parameter.

```javascript JavaScript theme={null}
const channel = "blog-da-ana";
const destination = "https://www.loja.com.br/tenis-corrida?cor=azul&tam=40";

const link =
  `https://lmdee.link/deep/${channel}` +
  `?url=${encodeURIComponent(destination)}` +
  `&mdasc=${encodeURIComponent("stories-black-friday")}`;
```

```python Python theme={null}
from urllib.parse import quote

channel = "blog-da-ana"
destination = "https://www.loja.com.br/tenis-corrida?cor=azul&tam=40"

link = (
    f"https://lmdee.link/deep/{channel}"
    f"?url={quote(destination, safe='')}"
    f"&mdasc={quote('stories-black-friday', safe='')}"
)
```

```text Google Sheets / Excel theme={null}
="https://lmdee.link/deep/blog-da-ana?url=" & ENCODEURL(A2) & "&mdasc=stories"
```

The result:

```
https://lmdee.link/deep/blog-da-ana?url=https%3A%2F%2Fwww.loja.com.br%2Ftenis-corrida%3Fcor%3Dazul%26tam%3D40&mdasc=stories-black-friday
```

> [!NOTE]
>
> A raw (not encoded) `url` also works when it is the **last** parameter: everything after `url=` is read as the destination. Encoding is safer, because the order of the parameters no longer matters.

## Slug or ID

Both identify the same channel and give the same result.

| | Channel address (slug) | Channel ID |
| - | - | - |
| Example | `blog-da-ana` | `3f9c2a7e-51b0-4c1d-9e0a-6b2d7f81c4aa` |
| Readable | Yes | No |
| Changes | Never, after the channel is created | Never |

Uppercase letters in the address are read as lowercase.

## When the link does not open

The link answers with a redirect (`302`) when everything is in place. Otherwise it answers with an error and does not send the visitor to the store.

| Status | `error` | What it means | What to do |
| - | - | - | - |
| `400` | `invalid_deep_link` | The channel or the `url` is missing or malformed | Check the address or ID, and that `url` starts with `https://` |
| `404` | `channel_not_found` | No active channel with that address or ID | Copy the address or ID again from **Meus canais** |
| `404` | `domain_not_found` | The page is not on a domain registered by a brand on your program | Use a page of a partner store. Domain and subdomains count, `www.` is ignored |
| `404` | `channel_not_approved` | The brand approves channels and has not approved yours | Request approval in the dashboard and wait for the brand |
| `404` | `channel_rejected` | The brand rejected your channel | Use another channel or another brand |
| `404` | `channel_blocked` | The brand blocked your channel | Use another channel or another brand |
| `503` | `deep_link_unavailable` | The service could not create the link right now | Try again in a few minutes |

After a brand approves your channel, the link can take a few minutes (at most 15) to start working, because refusals are cached for a short time.

## Deep link or short link

| | Deep link | Short link |
| - | - | - |
| Created | On the first click, from a URL you build | In the dashboard or with the [Affiliate API](https://docs.lomadee.com.br/api-reference/affiliate/shorten/create.md) |
| Looks like | `lmdee.link/deep/blog-da-ana?url=…` | `lmdee.link/AbC123` |
| Best for | Many products, spreadsheets, automation | One link to share by hand |
| Reports and sub-ID | Same | Same |

## FAQ

> [accordion] If I rename my channel, do my deep links change?
>
> No. The address is set when the channel is created and does not follow later name changes.

> [accordion] Can I use the same deep link in different places?
>
> Yes. Add a different `mdasc` to each place to tell the clicks apart in your reports.

> [accordion] Does a deep link work for any store?
>
> Only for pages on a domain registered by a brand on your program. Other URLs return `domain_not_found`.

> [card] [Channel address](https://docs.lomadee.com.br/docs/affiliates/channel-address.md)
>
> Rules for the slug

> [card] [Endpoint reference](https://docs.lomadee.com.br/api-reference/redirect/deep-link.md)
>
> `GET /deep/{channel}`


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.