---
title: "Create Link Rule"
method: POST
path: "/links/{link_id}/rules"
tags: ["Link Rules"]
---

# Create Link Rule

`POST /links/{link_id}/rules`

## Request

- Base URL: `https://api.rebrandly.com/v1`
- URL: `https://api.rebrandly.com/v1/links/{link_id}/rules`
- Auth: API key in header `apikey`

Add a routing rule to a link for conditional redirects.

**Requires:**
- Feature: `links.rules`

**Blocked by:**
- Link deleted (status=3)
- Revoked workspace
- Revoked domain

## Path parameters

- `link_id` string, required

## Headers

- `Workspace` string
- `apikey` string, required

## Request body

- object
  - `destination` string, uri, required: Redirect destination when conditions match
  - `conditions` object[], required: Conditions that must match for rule to apply
    - `type` 'device' | 'location' | 'time' | 'platform': Condition type
    - `value` string: Condition value to match
  - `rank` integer: Rule priority (lower numbers evaluated first)

## Response `200`

Rule created

- LinkRule
  - `id` string, required: Rule public ID
  - `rank` integer
  - `destination` string, uri, required
  - `conditions` object[], required
    - `type` string
    - `value` string
  - `createdAt` string, date-time

## Other responses

- `403`: Feature not available or insufficient permissions

---

[API](https://skmtc.dev/rebrandly/apis/rebrandly-api.md) - [All operations](https://skmtc.dev/rebrandly/apis/rebrandly-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rebrandly/apis/rebrandly-api/revisions/b098bf9fb684?raw)
