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

# Export rules

> Get a list of all rules defined on an index.

export const Legacy = ({title, href}) => {
  return <Note>

    This page documents an earlier version of the API client.
    For the latest version, see <a href={href}>{title}</a>.

    </Note>;
};

<Legacy title="Browse all rules" href="/doc/libraries/sdk/methods/search/browse-rules" />

**Required ACL:** `settings`

The list contains the name and details of conditions and consequences for all rules for the selected index.

To export rules, you will need to use an iterator.

## Examples

<CodeGroup>
  ```cs C# theme={"system"}
  var rulesIterator = index.BrowseRules();

  foreach (var rule in rulesIterator)
  {
      Console.WriteLine(rule);
  }
  ```

  ```go Go theme={"system"}
  it, err := index.BrowseRules()
  if err != nil {
  	panic(err)
  }

  for {
  	rule, err := it.Next()
  	if err != nil {
  		if err == io.EOF {
  			break
  		}
  	}

  	fmt.Printf("%#v\n", *rule)
  }
  ```

  ```java Java theme={"system"}
  List<Rule> rules = new ArrayList();
  RulesIterable sourceRules = index.browseRules();
  sourceRules.forEach(rules::add);
  ```

  ```js JavaScript theme={"system"}
  index
    .browseRules({
      batch: (batch) => console.log(batch),
    })
    .then(() => {
      // done
    });
  ```

  ```kotlin Kotlin theme={"system"}
  index.browseRules().forEach {
      println(it)
  }
  ```

  ```php PHP theme={"system"}
  $iterator = $index->browseRules();

  foreach ($iterator as $rule) {
    var_dump($rule);
  }
  ```

  ```python Python theme={"system"}
  for rule in index.browse_rules():
      print(rule)
  ```

  ```ruby Ruby theme={"system"}
  rules = index.browse_rules
  ```

  ```scala Scala theme={"system"}
  val helper = AlgoliaSyncHelper(client)
  helper.exportRules("myIndex").map(println)
  ```

  ```swift Swift theme={"system"}
  index.browseRules { result in
    if case .success(let response) = result {
      print("Response: \(response)")
    }
  }
  ```
</CodeGroup>

## Parameters

<ParamField body="indexName" type="string">
  Index name. Only required in the Scala API client.
</ParamField>

<ParamField body="requestOptions" type="object">
  A mapping of request options to send along with the query.
</ParamField>

## Response

This method returns an iterator.
