> ## Documentation Index
> Fetch the complete documentation index at: https://api-reference.hyperswitch.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Update & Delete Routing Algorithm

> Curl examples for /routing/update and /routing/delete.

# Update & Delete Routing Algorithm

Edit or remove a previously created routing algorithm — including [A/B test experiments](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create), which are stored the same way. Both operations only work on an **inactive** algorithm; deactivate it first with [`/routing/deactivate`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate) if it's currently live.

## Update

Rewrites the name, description, and algorithm definition in place — the `rule_id` doesn't change.

```bash theme={null}
curl --location "$BASE_URL/routing/update" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{
    "created_by": "merchant_demo",
    "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
    "name": "priority rule (v2)",
    "description": "try adyen before stripe",
    "algorithm": {
      "type": "priority",
      "data": [
        { "gateway_name": "adyen", "gateway_id": "mca_112" },
        { "gateway_name": "stripe", "gateway_id": "mca_111" }
      ]
    }
  }'
```

`algorithm` accepts the same `type` values as [`/routing/create`](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create) — `single`, `priority`, `volume_split`, `advanced`, or `ab_test`.

```json theme={null}
{
  "id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0",
  "name": "priority rule (v2)",
  "algorithm_for": "payment",
  "created_at": "2026-07-01 09:12:04",
  "modified_at": "2026-07-16 10:00:00"
}
```

Returns an error if the algorithm is currently active, or if `created_by` doesn't own the algorithm.

## Delete

```bash theme={null}
curl --location "$BASE_URL/routing/delete" \
  --header "$AUTH_HEADER" \
  --header "Content-Type: application/json" \
  --data '{
    "created_by": "merchant_demo",
    "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
  }'
```

```json theme={null}
{
  "status": "deleted",
  "routing_algorithm_id": "routing_e641380c-6f24-4405-8454-5ae6cbceb7a0"
}
```

## Related

* [Create Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-create)
* [Activate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-activate)
* [Deactivate Routing Algorithm](/decision-engine-api-reference/api-reference/guides/configure-routing/routing-algorithm-deactivate)
* [A/B Testing: Create An Experiment](/decision-engine-api-reference/api-reference/guides/ab-testing/ab-testing-create)
