# Attribution

How a booking gets credited to you.

HTML version: https://dyme.earth/affiliates/build/attribution

A booking is credited to whoever's code was on the link the traveller clicked, for 90 days after the click (last click wins). The API puts your code on every link it returns, so you never build one by hand.

## Links in responses

| Field | Endpoint | Opens |
|---|---|---|
| `url` | `/hotels/search`, `/hotels/find`, `/hotels/{id}` | The hotel's page on Dyme. |
| `url` | `/links` | The Dyme URL you sent, with your code on it. |

Each carries your affiliate code when you called with your key. Use them exactly as returned.

## Stamping your own URLs

Already have a Dyme address you want to link to, say a city page, a search, or a hotel you mention in text? `POST /links` puts your code on it.

```bash
curl -X POST "https://affiliates.dyme.earth/links" \
  -H "Authorization: Bearer dyme_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{"urls": ["https://travel.dyme.earth/hotels/lisbon-pestana-rua-augusta-lisboa"]}'
```

Up to 10 addresses per call, each counting as one request. Only `dyme.earth` and `travel.dyme.earth` addresses are stamped. For anything else, or an address that already carries another affiliate's code, `url` comes back `null` and `error` says why.

## The tracking parameter

Your code travels in the `_from` query parameter. Don't confuse it with `ref`, which is for Dyme's member-to-member referral codes; an affiliate code in `ref` credits nobody. Use the links the API returns, or `POST /links`, rather than adding parameters yourself.

## Per-placement reporting

Want to know which page or newsletter a booking came from? Pass `sub_id` on any request. It comes back as `utm_content` on every link in the response and shows up in your reporting.

```bash
curl "https://affiliates.dyme.earth/hotels/search?destination=Lisbon&sub_id=lisbon-guide-2026" \
  -H "Authorization: Bearer dyme_live_YOUR_KEY"
```

`sub_id` is 1 to 200 characters from `A-Z a-z 0-9 _ -`.

## Cookies

The click is recorded when the traveller lands on Dyme with your code on the link. Where the law requires consent, tracking starts once they accept marketing cookies. Someone who declines can still book, but that booking can't be credited.
