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

# Delete Routing Rule

> Permanently remove a redirect or proxy rule

```
DELETE /functions/v1/domains/{domainId}/routing-rules/{ruleId}
```

<Info>
  **Beta.** The routing rules endpoints are new and their response shapes may
  still change.
</Info>

Permanently deletes one [routing rule](/dashboard/routing-rules). It stops applying right away.

You need the `owner` or `manager` role on the rule's domain. Viewers get `403 forbidden`.

<Tip>
  To turn a rule off temporarily, [update it](/api-reference/endpoint/update-routing-rule)
  with `"isActive": false` instead. The rule is kept, so you can turn it back
  on later.
</Tip>

<Warning>
  Always call this endpoint from a **server-side environment** (backend API, serverless function, build script, etc.). Never include your API key in client-side code — it will be visible to anyone inspecting your frontend.
</Warning>

<Info>
  Programmatic (API key) access requires the **Pro plan and above** — requests
  from Starter accounts return `403 plan_upgrade_required`.
</Info>

## Request

### Headers

| Header          | Required | Description                    |
| --------------- | -------- | ------------------------------ |
| `Authorization` | Yes      | `Bearer hado_sk_your_key_here` |

### Path Parameters

| Parameter  | Type   | Required | Description                                                                                          |
| ---------- | ------ | -------- | ---------------------------------------------------------------------------------------------------- |
| `domainId` | string | Yes      | The ID of the domain the rule belongs to, from [List Domains](/api-reference/endpoint/list-domains). |
| `ruleId`   | string | Yes      | The rule to delete, from [List Routing Rules](/api-reference/endpoint/list-routing-rules).           |

### Example Request

```bash theme={null}
curl -X DELETE https://api.hadoseo.com/functions/v1/domains/11111111-1111-1111-1111-111111111111/routing-rules/cccccccc-cccc-cccc-cccc-cccccccccccc \
  -H "Authorization: Bearer hado_sk_your_key_here"
```

## Response

### Success (200)

The response includes a copy of the rule you deleted, so you can log it or recreate it later.

```json theme={null}
{
  "deleted": true,
  "rule": {
    "ruleId": "cccccccc-cccc-cccc-cccc-cccccccccccc",
    "domainId": "11111111-1111-1111-1111-111111111111",
    "sourcePath": "/old-blog/*",
    "targetUrl": "/blog",
    "ruleType": "redirect",
    "redirectCode": 301,
    "priority": 0,
    "isActive": true,
    "notes": "Blog moved in the 2026 redesign",
    "createdAt": "2026-09-25T10:00:00.000Z",
    "updatedAt": "2026-09-25T10:00:00.000Z"
  },
  "cacheInvalidated": true
}
```

| Field              | Type    | Description                                                                                                                                  |
| ------------------ | ------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| `deleted`          | boolean | Always `true` on success.                                                                                                                    |
| `rule`             | object  | The rule as it was just before deletion. See [The rule object](/api-reference/endpoint/list-routing-rules#the-rule-object).                  |
| `cacheInvalidated` | boolean | `true` when the rule has stopped applying. If `false`, the rule is deleted but may keep applying for a few minutes. You don't need to retry. |

### Error Responses

| Status | Body                                                                     | Description                                                                                                                                                   |
| ------ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| 400    | `{ "error": "invalid_request", "message": "..." }`                       | The `domainId` or `ruleId` in the path isn't a valid ID.                                                                                                      |
| 401    | `{ "error": "invalid_api_key" }`                                         | API key is missing, invalid, or revoked.                                                                                                                      |
| 403    | `{ "error": "plan_upgrade_required" }`                                   | Programmatic access requires the Pro plan or above.                                                                                                           |
| 403    | `{ "error": "forbidden" }`                                               | You have `viewer` access to this rule's domain. Deleting rules needs `owner` or `manager`.                                                                    |
| 404    | `{ "error": "domain_not_found" }`                                        | The domain in the path doesn't exist or your account can't access it.                                                                                         |
| 404    | `{ "error": "rule_not_found" }`                                          | No rule with this ID on this domain (it may have been deleted already).                                                                                       |
| 429    | `{ "error": "rate_limit_exceeded_monthly", "usage": 300, "limit": 300 }` | Rate limit exceeded. The code is `rate_limit_exceeded_monthly` or `rate_limit_exceeded_per_minute` — match on the `rate_limit_exceeded` prefix to catch both. |
