# Bulk Enable SaaS

POST https://services.leadconnectorhq.com/saas/bulk-enable-saas/{companyId}

Enable SaaS mode for multiple locations with support for both SaaS v1 and v2

## 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": "2021-07-28"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/saas/bulk-enable-saas/{companyId}": {
      "post": {
        "summary": "Bulk Enable SaaS",
        "operationId": "bulkEnableSaas",
        "description": "Enable SaaS mode for multiple locations with support for both SaaS v1 and v2",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-07-28"
              ]
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BulkEnableSaasRequestDto"
              }
            }
          }
        },
        "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": {
      "BulkEnableSaasRequestDto": {
        "type": "object",
        "properties": {
          "locationIds": {
            "description": "Array of location IDs to enable SaaS for",
            "example": [
              "locationId1",
              "locationId2"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "isSaaSV2": {
            "type": "boolean",
            "description": "Indicates if the SaaS is V2",
            "example": true
          },
          "actionPayload": {
            "description": "Action payload for the bulk enable SaaS operation",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "priceId": {
                    "type": "string",
                    "description": "Price ID for the SaaS plan",
                    "example": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
                  },
                  "stripeAccountId": {
                    "type": "string",
                    "description": "Stripe account ID",
                    "example": "acct_1QDPY5FpU9DlKp7RQ8BXfywx"
                  },
                  "saasPlanId": {
                    "type": "string",
                    "description": "SaaS plan ID",
                    "example": "66c4d36534f21f900dc2a265"
                  },
                  "providerLocationId": {
                    "type": "string",
                    "description": "Provider location ID",
                    "example": "r06mdj4OrrERzYDvsOdh"
                  }
                },
                "required": [
                  "saasPlanId"
                ],
                "title": "BulkEnableSaasActionPayloadDto"
              }
            ]
          }
        },
        "required": [
          "locationIds",
          "isSaaSV2",
          "actionPayload"
        ],
        "title": "BulkEnableSaasRequestDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/saas/bulk-enable-saas/<companyId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-07-28' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "locationIds": [
    "locationId1",
    "locationId2"
  ],
  "isSaaSV2": true,
  "actionPayload": {
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "saasPlanId": "66c4d36534f21f900dc2a265",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh"
  }
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2021-07-28',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "locationIds": [
        "locationId1",
        "locationId2"
      ],
      "isSaaSV2": true,
      "actionPayload": {
        "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
        "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
        "saasPlanId": "66c4d36534f21f900dc2a265",
        "providerLocationId": "r06mdj4OrrERzYDvsOdh"
      }
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/saas/bulk-enable-saas/<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/bulk-enable-saas/{companyId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-07-28"
}

payload = {
    "locationIds": [
        "locationId1",
        "locationId2"
    ],
    "isSaaSV2": true,
    "actionPayload": {
        "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
        "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
        "saasPlanId": "66c4d36534f21f900dc2a265",
        "providerLocationId": "r06mdj4OrrERzYDvsOdh"
    }
}

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/bulk-enable-saas/<companyId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-07-28',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "locationIds": [
    "locationId1",
    "locationId2"
  ],
  "isSaaSV2": true,
  "actionPayload": {
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "saasPlanId": "66c4d36534f21f900dc2a265",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh"
  }
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/saas/bulk-enable-saas/<companyId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-07-28")
  .header("Content-Type", "application/json")
  .body("{\"locationIds\":[\"locationId1\",\"locationId2\"],\"isSaaSV2\":true,\"actionPayload\":{\"priceId\":\"price_1QDPY5FpU9DlKp7RQ8BXfywx\",\"stripeAccountId\":\"acct_1QDPY5FpU9DlKp7RQ8BXfywx\",\"saasPlanId\":\"66c4d36534f21f900dc2a265\",\"providerLocationId\":\"r06mdj4OrrERzYDvsOdh\"}}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/saas/bulk-enable-saas/<companyId>"
  payload := strings.NewReader(`{
  "locationIds": [
    "locationId1",
    "locationId2"
  ],
  "isSaaSV2": true,
  "actionPayload": {
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "saasPlanId": "66c4d36534f21f900dc2a265",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh"
  }
}`)
  req, _ := http.NewRequest("POST", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-07-28")

  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/bulk-enable-saas/<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"] = "2021-07-28"
request["Content-Type"] = "application/json"
request.body = '{
  "locationIds": [
    "locationId1",
    "locationId2"
  ],
  "isSaaSV2": true,
  "actionPayload": {
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "saasPlanId": "66c4d36534f21f900dc2a265",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh"
  }
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2021-07-28"
}

$body = '{
  "locationIds": [
    "locationId1",
    "locationId2"
  ],
  "isSaaSV2": true,
  "actionPayload": {
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "saasPlanId": "66c4d36534f21f900dc2a265",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh"
  }
}'

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