> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.paymentkit.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.paymentkit.com/_mcp/server.

# List Routing Rules

GET https://app.paymentkit.com/api/{account_id}/routing-rules/

List routing rules in evaluation order (position 1 first). **Deprecated**
-- use `GET /processor-routes?in_evaluation_order=true`.

Only POSITIONED routes are listed, and only those the rule vocabulary can
publish faithfully. An unpositioned route was never a rule. Neither was a
positioned route that sends payments straight to processors or cascades
through several routes in order: a rule names ONE destination or ONE
weighted split, so those shapes have no honest rule form -- see
`rule_shim.shape_problem`. They are filtered out HERE, in SQL, rather than
dropped from the page after the fact, so `total` keeps agreeing with the
rows and paging does not go short.

Reference: https://docs.paymentkit.com/api-reference/api-reference/routing-rules/list-routing-rules

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://app.paymentkit.com` (Production, default)
- `https://staging.paymentkit.com` (Staging)

## Request

### Path parameters

- `account_id` (string, required)

### Query parameters

- `limit` (integer, optional, default: 50) — Number of items per page
- `offset` (integer, optional, default: 0) — Number of items to skip
- `filter` (string, optional, default: {}) — Filter conditions as key-value pairs or advanced filter objects (JSON string)
- `sortBy` (string, optional, nullable) — Field to sort by
- `sortOrder` (integer, optional, default: -1) — Sort order: 1 for ascending, -1 for descending
- `search` (string, optional, nullable) — Keyword-based search across multiple fields

## Response

### 200

Successful Response

- `data` (list of RoutingRule, required)
- `total` (integer, required)
- `limit` (integer, required)
- `offset` (integer, required)

## Errors

### 422 Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### RoutingRule

A routing rule as returned by the API.

- `id` (string, required)
- `name` (string, required)
- `position` (integer, required) — Evaluation order, 1 = first
- `match_mode` (enum, required) — How a route combines its conditions. The spec offers exactly these two and no nesting of boolean logic. Compound logic that neither expresses is written as several conditional routes pointing at the same route -- see the spec's "subscription tenure" example. That keeps the stored shape flat and the builder UI honest about what it can express.
  - Allowed values: `all`, `any`
- `conditions` (list of RuleCondition, required)
- `outcome` (enum, required) — What a matching rule did. Mapped onto a route's `type` by `rule_shim`: `stop` is a STOP route, `primary_only` a step-less LAST_SUCCESSFUL_ONLY one, and `route_to` any route that names steps.
  - Allowed values: `route_to`, `stop`, `primary_only`
- `status` (enum, required) — Unchanged from the old API: the values are identical to `RouteStatus`.
  - Allowed values: `draft`, `active`, `inactive`
- `created_at` (datetime, required)
- `updated_at` (datetime, required)
- `route_id` (string, optional, nullable) — Route ID, when outcome is 'route_to' and one route takes all
- `route_distribution` (list of RouteSplit-Output, optional, nullable) — Weighted route split, when outcome is 'route_to' and traffic is shared

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### RuleCondition

One `field operator value` test. `value` is typed loosely on purpose: its shape depends on the operator. A scalar for equals/not_equals and the ordering operators, a list for in/not_in, a string for contains/not_contains, and a BillingFrequencyValue object for billing_frequency.

- `field` (enum, required) — The fact to match on. See GET /processor-routes/matchers for the catalog.
  - Allowed values: `payment_method`, `card_brand`, `card_funding_type`, `card_bin`, `card_issuer_country`, `billing_country`, `network_token_available`, `product`, `price`, `price_amount`, `billing_frequency`, `currency`, `processing_phase`, `payment_sequence`, `payment_type`, `initiator`, `mit_type`, `is_dunning_retry`, `last_decline_type`, `subscription_status`, `successful_payments`, `successful_rebills`, `failed_payments`
- `operator` (enum, required) — How to compare
  - Allowed values: `equals`, `not_equals`, `in`, `not_in`, `greater_than`, `greater_or_equal`, `less_than`, `less_or_equal`, `contains`, `not_contains`
- `value` (any, required) — What to compare against

### RouteSplit-Output

One slice of a rule's route distribution.

- `route_id` (string, required) — Route this share goes to
- `weight` (string, required) — Share of matching traffic, as a percentage

### ValidationErrorLocItems

- string
- integer

## Examples

**Response**

```json
{
  "data": [
    {
      "id": "rrule_dev_a1b2c3d4e5f6g7h8",
      "name": "string",
      "position": 1,
      "match_mode": "all",
      "conditions": [
        {
          "field": "initiator",
          "operator": "equals",
          "value": null
        }
      ],
      "outcome": "route_to",
      "status": "draft",
      "created_at": "2024-01-15T09:30:00Z",
      "updated_at": "2024-01-15T09:30:00Z",
      "route_id": "string",
      "route_distribution": [
        {
          "route_id": "proute_dev_x7k9m2n4p8q1",
          "weight": "80"
        }
      ]
    }
  ],
  "total": 1,
  "limit": 1,
  "offset": 1
}
```

**SDK Code**

```python
import requests

url = "https://app.paymentkit.com/api/account_id/routing-rules/"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://app.paymentkit.com/api/account_id/routing-rules/';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://app.paymentkit.com/api/account_id/routing-rules/"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://app.paymentkit.com/api/account_id/routing-rules/")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("https://app.paymentkit.com/api/account_id/routing-rules/")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://app.paymentkit.com/api/account_id/routing-rules/', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://app.paymentkit.com/api/account_id/routing-rules/");
var request = new RestRequest(Method.GET);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://app.paymentkit.com/api/account_id/routing-rules/")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```