# List rules in a business ruleset

> For the complete machine-readable documentation index, see [llms.txt](https://apidocs.chargebee.com/llms.txt).


Returns the business rules that belong to a ruleset, along with the priority that determines their evaluation order. The results can be filtered by active status and are paginated.

Each entry carries the `rule_id` of the rule and its `priority` within this ruleset. Use `rule_id` with [Retrieve a business rule](/docs/api/business_rules/retrieve-a-business-rule) to read the definition of a rule.

### Implementation Notes

-   Call this operation before passing `rules` to [Update a business ruleset](/docs/api/business_rulesets/update-a-business-ruleset), because that parameter replaces the entire membership of the ruleset.

## Sample Request

#### cURL

```bash
curl  https://{site}.chargebee.com/api/v2/business_rulesets/quote_create_rules/rules \
     -G  \
     -u {site_api_key}:\
     -d limit=5 \
     -d offset="0"
```

#### .NET

```dotnet
using ChargeBee.Api;
using ChargeBee.Models;

ApiConfig.Configure("{site}","{site_api_key}");
EntityResult result = BusinessRuleset.ListRules("quote_create_rules")
		.Limit(5)
		.Offset("0")
		.Request();

BusinessRulesetRule businessRulesetRule = result.BusinessRulesetRule;
```

#### Go

```go
package main
import (
    "fmt"
    "github.com/chargebee/chargebee-go/v3"
    businessrulesetAction "github.com/chargebee/chargebee-go/v3/actions/businessruleset"
    "github.com/chargebee/chargebee-go/v3/models/businessruleset"
)
func main() {
    chargebee.Configure("{site_api_key}","{site}");
    res,err := businessrulesetAction.ListRules("quote_create_rules", &businessruleset.ListRulesRequestParams{
        Limit : chargebee.Int32(5),
        Offset : "0",
    }).Request()
    if err != nil {
        fmt.Println(err)
    } else {
        BusinessRulesetRule := res.BusinessRulesetRule
    }
}
```

#### Go

```go
package main

import (
  "fmt"
  "github.com/chargebee/chargebee-go/v4"
)

func main() {
  config := &chargebee.ClientConfig{
    SiteName: "{site}",
    ApiKey: "{site_api_key}",
  }    
  client := chargebee.NewClient(config)
  req := &chargebee.BusinessRulesetListRulesRequest{
    Limit : chargebee.Int32(5),
    Offset : "0",
}
  res, err := client.BusinessRuleset.ListRules("quote_create_rules", req)
      if err != nil {
        fmt.Println(err)
    } else {
        BusinessRulesetRule := res.BusinessRulesetRule
    }
}
```

#### Java

```java
import com.chargebee.*;
import com.chargebee.ListResult;
import com.chargebee.models.*;
import com.chargebee.models.enums.*;
import java.io.IOException;

public class Sample {

    public static void main(String args[]) throws IOException, Exception {
        Environment.configure("{site}", "{site_api_key}");
        Result result = BusinessRuleset.listRules("quote_create_rules")
            .limit(5)
            .offset("0")
            .request();

        BusinessRulesetRule businessRulesetRule = result.businessRulesetRule();
    }
}
```

#### Java

```java
import com.chargebee.v4.client.ChargebeeClient;
import com.chargebee.v4.models.businessRuleset.params.BusinessRulesetListRulesParams;
import com.chargebee.v4.models.businessRuleset.responses.BusinessRulesetListRulesResponse;
import com.chargebee.v4.models.businessRulesetRule.BusinessRulesetRule;

public class BusinessRulesetListRules {

    public static void main(String[] args) {
        ChargebeeClient client = ChargebeeClient.builder()
            .apiKey("{site_api_key}")
            .siteName("{site}")
            .build();

        BusinessRulesetListRulesParams params = BusinessRulesetListRulesParams.builder()
            .limit(5)
            .offset("0")
            .build();

        BusinessRulesetListRulesResponse response = client
            .businessRulesets()
            .listRules("quote_create_rules", params);

        BusinessRulesetRule businessRulesetRule = response.getBusinessRulesetRule();
    }
}
```

#### Node.js

```node
import Chargebee from "chargebee";

const chargebee = new Chargebee({
    site: "{site}",
    apiKey: "{site_api_key}",
});

try {
    const result = await chargebee.businessRuleset.listRules("quote_create_rules", {
        limit: 5,
        offset: "0"
    });

    console.log(result);
    const businessRulesetRule = result.business_ruleset_rule;
} catch (err) {
    console.log(err);
}
```

#### PHP

```php
<?php

require __DIR__ . '/vendor/autoload.php';

use Chargebee\ChargebeeClient;

$chargebee = new ChargebeeClient(options: [
    "site" => "{site}",
    "apiKey" => "{site_api_key}",
]);
$result = $chargebee->businessRuleset()->listRules("quote_create_rules", [
    "limit" => 5,
    "offset" => "0"
]);
$businessRulesetRule = $result->business_ruleset_rule;
```

#### Python

```python
from chargebee import Chargebee

cb_client = Chargebee(api_key="{site_api_key}", site="{site}")
response = cb_client.BusinessRuleset.list_rules("quote_create_rules",
    cb_client.BusinessRuleset.ListRulesParams(
        limit=5,
        offset="0"
    )
)
business_ruleset_rule = response.business_ruleset_rule
```

#### Ruby

```ruby
require 'chargebee'

ChargeBee.configure(:site => "{site}",
  :api_key => "{site_api_key}")

result = ChargeBee::BusinessRuleset.list_rules("quote_create_rules",{
  :limit => 5,
  :offset => "0"
})

business_ruleset_rule = result.business_ruleset_rule
```

## Sample Response

```json
{
  "list": [
    {
      "business_ruleset_rule": {
        "rule_id": "custom-uuid-1",
        "priority": 1,
        "object": "business_ruleset_rule"
      }
    },
    {..}
  ]
}
```

## URL Format

**GET** https://[site].chargebee.com/api/v2/business_rulesets/{business-ruleset-id}/rules

## Input Parameters

- `limit` (optional, integer, default=10, min=1, max=100)
  The number of resources to be returned.

- `offset` (optional, string, max chars=1000)
  Determines your position in the list for pagination. To ensure that the next page is retrieved correctly, always set `offset` to the value of `next_offset` obtained in the previous iteration of the API call.

## Returns

- `business_ruleset_rule` (Business ruleset rule object)
  The membership of one rule in the ruleset. It carries `rule_id`, the identifier of the [business rule](/docs/api/business_rules), and `priority`, the number that fixes the position of that rule in the ruleset's evaluation order. Priorities are unique within a ruleset.
  
  The definition of the rule is not included. Use `rule_id` with [Retrieve a business rule](/docs/api/business_rules/retrieve-a-business-rule) to read its expression and actions.
