---
title: "Update & Delete Routing Algorithm"
description: "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
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
{
  "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
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
{
  "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)
