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

# set isActive

PATCH {base_url}/api/v1/{account_id}/projects/{project_id}/rules/{rule_id}/active
Content-Type: application/json

### Update Rule Active Status

This endpoint allows the user to update the active status of a specific rule within a project. The HTTP PATCH request should be made to `{base_url}/api/v1/{account_id}/projects/{project_id}/rules/{rule_id}/active`.

#### Request

- `base_url` (string): The base URL of the API.
    
- `account_id` (string): The unique identifier of the account.
    
- `project_id` (string): The unique identifier of the project.
    
- `rule_id` (string): The unique identifier of the rule.
    

#### Request Body

- isActive: (boolean) Indicates the new active status of the rule.
    

#### Response

The response will include the updated active status of the rule.

Example Response:

``` json
{
    "active": true
}

 ```

Reference: https://api-docs.botbye.com/bot-bye-api/protection/custom-rules/set-is-active

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/{account_id}/projects/{project_id}/rules/{rule_id}/active:
    patch:
      operationId: set-is-active
      summary: set isActive
      description: >-
        ### Update Rule Active Status


        This endpoint allows the user to update the active status of a specific
        rule within a project. The HTTP PATCH request should be made to
        `{base_url}/api/v1/{account_id}/projects/{project_id}/rules/{rule_id}/active`.


        #### Request


        - `base_url` (string): The base URL of the API.
            
        - `account_id` (string): The unique identifier of the account.
            
        - `project_id` (string): The unique identifier of the project.
            
        - `rule_id` (string): The unique identifier of the rule.
            

        #### Request Body


        - isActive: (boolean) Indicates the new active status of the rule.
            

        #### Response


        The response will include the updated active status of the rule.


        Example Response:


        ``` json

        {
            "active": true
        }

         ```
      tags:
        - subpackage_customRules
      parameters:
        - name: account_id
          in: path
          required: true
          schema:
            type: string
        - name: project_id
          in: path
          required: true
          schema:
            type: string
        - name: rule_id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Custom rules_setIsActive_Response_200'
        '500':
          description: fail
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetIsActiveRequestInternalServerError'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                isActive:
                  type: boolean
              required:
                - isActive
servers:
  - url: '{base_url}'
    description: '{base_url}'
components:
  schemas:
    Custom rules_setIsActive_Response_200:
      type: object
      properties: {}
      title: Custom rules_setIsActive_Response_200
    SetIsActiveRequestInternalServerError:
      type: object
      properties:
        message:
          type: string
        code:
          type: string
        type:
          type: string
        context:
          description: Any type
      required:
        - message
        - code
        - type
      title: SetIsActiveRequestInternalServerError

```

## Examples



**Request**

```json
{
  "isActive": false
}
```

**Response**

```json
{}
```

**SDK Code**

```python Custom rules_setIsActive_example
import requests

url = "https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active"

payload = { "isActive": False }
headers = {"Content-Type": "application/json"}

response = requests.patch(url, json=payload, headers=headers)

print(response.json())
```

```javascript Custom rules_setIsActive_example
const url = 'https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active';
const options = {
  method: 'PATCH',
  headers: {'Content-Type': 'application/json'},
  body: '{"isActive":false}'
};

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

```go Custom rules_setIsActive_example
package main

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

func main() {

	url := "https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active"

	payload := strings.NewReader("{\n  \"isActive\": false\n}")

	req, _ := http.NewRequest("PATCH", url, payload)

	req.Header.Add("Content-Type", "application/json")

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

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

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

}
```

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

url = URI("https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active")

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

request = Net::HTTP::Patch.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"isActive\": false\n}"

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

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

HttpResponse<String> response = Unirest.patch("https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active")
  .header("Content-Type", "application/json")
  .body("{\n  \"isActive\": false\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active', [
  'body' => '{
  "isActive": false
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Custom rules_setIsActive_example
using RestSharp;

var client = new RestClient("https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active");
var request = new RestRequest(Method.PATCH);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"isActive\": false\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Custom rules_setIsActive_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["isActive": false] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://{base_url}/api/v1/account_id/projects/project_id/rules/rule_id/active")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```