# Update Rebilling

POST https://services.leadconnectorhq.com/saas/update-rebilling/{companyId}

Bulk update rebilling for given locationIds

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** No scopes required.

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `companyId` | string | Yes |  |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/saas/update-rebilling/{companyId}": {
      "post": {
        "summary": "Update Rebilling",
        "operationId": "updateRebilling",
        "description": "Bulk update rebilling for given locationIds",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateRebillingDto"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": ""
          }
        },
        "security": [
          {
            "Agency-Access": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "token-id",
        "in": "header",
        "description": "Use the Access Token generated by exchanging API Key for token id",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Location",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Company",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateRebillingDto": {
        "type": "object",
        "properties": {
          "product": {
            "type": "string",
            "description": "The product to update rebilling for",
            "example": "contentAI",
            "enum": [
              "contentAI",
              "workflow_premium_actions",
              "workflow_ai",
              "conversationAI",
              "EmailNotification",
              "whatsApp",
              "reviewsAI",
              "VERIFIED_CALLER_ID",
              "WALLET_SALES_TAX",
              "NOTIFICATION_SMS",
              "EmailSmtp",
              "EmailVerification",
              "autoCompleteAddress",
              "funnelAI",
              "domainPurchase",
              "Phone",
              "Email"
            ]
          },
          "locationIds": {
            "description": "Array of location IDs to update rebilling for",
            "example": [
              "zzyG7A4x6bRJl5SlhQhH",
              "Vygq7VgXCDfg3xnl8TBR"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "config": {
            "type": "object",
            "description": "Configuration for rebilling settings",
            "properties": {
              "optIn": {
                "type": "boolean",
                "description": "Enable the product for the locations",
                "example": true
              },
              "enabled": {
                "type": "boolean",
                "description": "Enable the rebilling for the locations",
                "example": true
              },
              "markup": {
                "type": "number",
                "description": "Additional value to be added in terms of percentage. For example, if the product price is $100 and the markup is 5, the amount charged to will be $105.",
                "example": 5
              }
            }
          }
        },
        "required": [
          "product",
          "locationIds",
          "config"
        ],
        "title": "UpdateRebillingDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "product": "contentAI",
  "locationIds": [
    "zzyG7A4x6bRJl5SlhQhH",
    "Vygq7VgXCDfg3xnl8TBR"
  ],
  "config": {
    "optIn": true,
    "enabled": true,
    "markup": 5
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2023-02-21',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "product": "contentAI",
      "locationIds": [
        "zzyG7A4x6bRJl5SlhQhH",
        "Vygq7VgXCDfg3xnl8TBR"
      ],
      "config": {
        "optIn": true,
        "enabled": true,
        "markup": 5
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/saas/update-rebilling/{companyId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2023-02-21"
}

payload = {
    "product": "contentAI",
    "locationIds": [
        "zzyG7A4x6bRJl5SlhQhH",
        "Vygq7VgXCDfg3xnl8TBR"
    ],
    "config": {
        "optIn": true,
        "enabled": true,
        "markup": 5
    }
}

response = requests.post(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "product": "contentAI",
  "locationIds": [
    "zzyG7A4x6bRJl5SlhQhH",
    "Vygq7VgXCDfg3xnl8TBR"
  ],
  "config": {
    "optIn": true,
    "enabled": true,
    "markup": 5
  }
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .header("Content-Type", "application/json")
  .body("{\"product\":\"contentAI\",\"locationIds\":[\"zzyG7A4x6bRJl5SlhQhH\",\"Vygq7VgXCDfg3xnl8TBR\"],\"config\":{\"optIn\":true,\"enabled\":true,\"markup\":5}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>"
  payload := strings.NewReader(`{
  "product": "contentAI",
  "locationIds": [
    "zzyG7A4x6bRJl5SlhQhH",
    "Vygq7VgXCDfg3xnl8TBR"
  ],
  "config": {
    "optIn": true,
    "enabled": true,
    "markup": 5
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2023-02-21")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2023-02-21"
request["Content-Type"] = "application/json"
request.body = '{
  "product": "contentAI",
  "locationIds": [
    "zzyG7A4x6bRJl5SlhQhH",
    "Vygq7VgXCDfg3xnl8TBR"
  ],
  "config": {
    "optIn": true,
    "enabled": true,
    "markup": 5
  }
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2023-02-21"
}

$body = '{
  "product": "contentAI",
  "locationIds": [
    "zzyG7A4x6bRJl5SlhQhH",
    "Vygq7VgXCDfg3xnl8TBR"
  ],
  "config": {
    "optIn": true,
    "enabled": true,
    "markup": 5
  }
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/saas/update-rebilling/<companyId>' -Method 'POST' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
