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

# Update Link Rule

`POST /links/{link_id}/rules/{rule_id}`

## Request

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

Update an existing routing rule on a link.

**Requires:**

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

## Path parameters

- `link_id` string, required
- `rule_id` string, required

## Headers

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

## Request body

- object
  - `destination` string, uri: Redirect destination when conditions match
  - `conditions` object[]: 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 updated

- 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`: Insufficient permissions
- `404`: Resource not found

---

[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)
