# Links

## Create a Link

POST /links: Create a link

Send an `Idempotency-Key` header to make a retry safe: the same key and body returns the first response with `Idempotent-Replayed: true` instead of creating a second link. Add `?dry_run=true` to run every check without creating anything. A dry run returns `{ "dry_run": true, "result": ... }`, with `id: null`, and with `slug` and `short_url` null plus a `slug_note` when WarpLink would generate the slug. See [Safe retries and dry runs](https://warplink.app/docs/api#safe-retries-and-dry-runs).

The destination is the address of a web page. An address with a user part, such as `https://name@example.com` or `name@example.com`, is an email address, and the request fails with `400 VALIDATION_ERROR`. `ios_fallback_url` and `android_fallback_url` follow the same rule. A link you already created keeps its address, and an update that leaves the field out does not check it.

When a body also holds a valid field, the API ignores a field it does not know and still answers `2xx`, so check the fields in the response body. A `PATCH` body with no known field fails with `400 VALIDATION_ERROR` and the message "Invalid request body". The field details hold "At least one field must be provided". A common mistake is `deep_link_url`: the iPhone and Android in-app URLs are `ios_url` and `android_url`. See [Unknown request fields](https://warplink.app/docs/api#unknown-request-fields).

In a workspace that an AI agent started and no person has claimed yet (claiming is when a person takes the workspace over from the emailed claim link), a new link starts paused, and the workspace holds at most 10 links. A request over that cap returns `403 UNCLAIMED_LIMIT`. See [Agent sign-up](https://warplink.app/docs/api/agent-signup).

## List Links

GET /links: List links

## Get a Link

GET /links/{id}: Get a link

## Update a Link

PATCH /links/{id}: Update a link

To pause a link, send `PATCH` with `is_active` set to `false`. Send `true` to resume it. A paused link keeps its click history and its slug. `DELETE` removes both and cannot be undone. A request that sends only `is_active` is allowed for every role on any link.

Add `?dry_run=true` to check an update without saving it. The response is `{ "dry_run": true, "result": <the link as the update would leave it> }`.

## Referral Links

Send `is_referral: true` on create or update to make a link a referral link: an invitation whose installs can be recorded as referrals. A referral claim ties one install to the invitation that brought it. Only a link with an app can be one, and a link with no app answers `400 VALIDATION_ERROR`. The link returns `is_referral` and `referral_since`, the time it became a referral link. Turning it off clears `referral_since`, and turning it on again sets a new time. A tap from before `referral_since` is not a referral.

`GET /v1/links?is_referral=true` lists only referral links. The MCP tools `create_link`, `update_link` and `list_links` take the same field. See [Referrals](https://warplink.app/docs/guides/referrals) for what a referral link does after the tap.

## UTM Fields

`utm_source`, `utm_medium` and `utm_campaign` on a link add those query parameters to the URL a visitor is redirected to, including for links created before you set them. The same fields on the MCP `create_link` and `update_link` tools behave the same way.

A field applies to the URL the redirect sends the visitor to when that URL is an `http` or `https` URL. This covers the web destination and any `http` or `https` iOS or Android URL you set. It does not apply to pages on `apps.apple.com`, `itunes.apple.com`, `play.google.com` or `apps.microsoft.com`, or to custom-scheme deep links such as `myapp://`. Each field sets only its own key.

For one key, up to four sources can supply a value. The one that wins depends on the mode of an injected parameter for that key (in the link's `parameters.injected` or the organization's injected parameters):

- **An injected parameter in `always` mode** wins over everything, including the visitor's own value.
- **Otherwise,** the first of these that has a value wins:
  1. The visitor's own value, when `parameters.forwarding` passes that key. The default forwarding rule passes five keys: `utm_source`, `utm_medium`, `utm_campaign`, `utm_term` and `utm_content`. Other keys, such as `utm_id`, are not forwarded by default.
  2. A value already in the destination URL.
  3. An injected parameter in `default` mode. When one exists for the key, the link field is not used for that key.
  4. The link field.

So when the visitor, the destination URL, a `default` injected parameter and the link field all supply `utm_source`, the visitor's value is the one sent.

A key is never added twice. An empty or blank field adds nothing. Clearing a field (`null` on update) stops the tag on the next redirect. Clicks to a web destination record the UTM values the visitor was sent, read from the final URL, so an applied link field appears in analytics. App store and app scheme destinations keep the values from the tap.

## Delete a Link

DELETE /links/{id}: Delete a link

## Move Choice

If an app's links later move to its subdomain, a link whose slug is taken on the target stays where it is. Choose a new slug (used if the link moves, and its old URL then redirects to it) or keep the link where it is. Owners and admins can set the choice for any link, members for their own. `DELETE` clears the choice.

PUT /links/{id}/move-choice: Choose how a link moves

DELETE /links/{id}/move-choice: Clear a link's move choice

A link that has moved returns `redirected_from` on `GET /v1/links/{id}`: the old URLs that redirect to it, with the date each began. The field is not on the list, update, activate or deactivate responses.

## Resolve a Link

GET /links/resolve/{slug}: Resolve a link by slug
