# Enable SaaS for Sub-Account (Formerly Location)

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

<div>
                  <p>Enable SaaS for Sub-Account (Formerly Location) based on the data provided</p> 
                  <div>
<span>
                     :::info
 This feature is only available on Agency Pro ($497) plan.
 :::  
 </span>
                  </div>
                </div>
    

## 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 |
|------|------|----------|-------------|
| `locationId` | 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/enable-saas/{locationId}": {
      "post": {
        "summary": "Enable SaaS for Sub-Account (Formerly Location)",
        "operationId": "enableSaasForSubaccountFormerlyLocation",
        "description": "<div>\n                  <p>Enable SaaS for Sub-Account (Formerly Location) based on the data provided</p> \n                  <div>\n<span>\n                     :::info\n This feature is only available on Agency Pro ($497) plan.\n :::  \n </span>\n                  </div>\n                </div>\n    ",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EnableSaasDto"
              }
            }
          }
        },
        "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": {
      "EnableSaasDto": {
        "type": "object",
        "properties": {
          "stripeAccountId": {
            "type": "string",
            "description": "Stripe account id(Required only for SaaS V1)",
            "example": "acct_1QDPY5FpU9DlKp7RQ8BXfywx"
          },
          "name": {
            "type": "string",
            "description": "Name of the stripe customer(Required only for SaaS V1)",
            "example": "John Doe"
          },
          "email": {
            "type": "string",
            "description": "Email of the stripe customer(Required only for SaaS V1)",
            "example": "john.doe@example.com"
          },
          "stripeCustomerId": {
            "type": "string",
            "description": "Stripe customer id if exists(Required only for SaaS V1)",
            "example": "cus_1QDPY5FpU9DlKp7RQ8BXfywx"
          },
          "companyId": {
            "type": "string"
          },
          "isSaaSV2": {
            "type": "boolean",
            "description": "Denotes if it is a saas v2 or v1 sub-account",
            "example": true
          },
          "contactId": {
            "type": "string",
            "description": "Agency subaccount used for payment provider integration(Required Only for SaaS V2)",
            "example": "1QDPY5FpU9DlKp7RQ8BXfywx"
          },
          "providerLocationId": {
            "type": "string",
            "description": "Agency Subaccount ID",
            "example": "r06mdj4OrrERzYDvsOdh"
          },
          "description": {
            "type": "string",
            "description": "Description",
            "example": "Description"
          },
          "saasPlanId": {
            "type": "string",
            "description": "Required only while pre-configuring saas subscription",
            "example": "1QDPY5FpU9DlKp7RQ8BXfywx"
          },
          "priceId": {
            "type": "string",
            "description": "Required only while pre-configuring saas subscription",
            "example": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
          }
        },
        "required": [
          "companyId",
          "isSaaSV2"
        ],
        "title": "EnableSaasDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X POST 'https://services.leadconnectorhq.com/saas/enable-saas/<locationId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
  "isSaaSV2": true,
  "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "providerLocationId": "r06mdj4OrrERzYDvsOdh",
  "description": "Description",
  "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}'
```

**Node.js**

```javascript
const options = {
  method: 'POST',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2023-02-21',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
      "name": "John Doe",
      "email": "john.doe@example.com",
      "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
      "isSaaSV2": true,
      "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
      "providerLocationId": "r06mdj4OrrERzYDvsOdh",
      "description": "Description",
      "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
      "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
  })
};

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

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/saas/enable-saas/{locationId}"

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

payload = {
    "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
    "name": "John Doe",
    "email": "john.doe@example.com",
    "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
    "isSaaSV2": true,
    "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
    "providerLocationId": "r06mdj4OrrERzYDvsOdh",
    "description": "Description",
    "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}

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/enable-saas/<locationId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
  "isSaaSV2": true,
  "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "providerLocationId": "r06mdj4OrrERzYDvsOdh",
  "description": "Description",
  "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .post("https://services.leadconnectorhq.com/saas/enable-saas/<locationId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .header("Content-Type", "application/json")
  .body("{\"stripeAccountId\":\"acct_1QDPY5FpU9DlKp7RQ8BXfywx\",\"name\":\"John Doe\",\"email\":\"john.doe@example.com\",\"stripeCustomerId\":\"cus_1QDPY5FpU9DlKp7RQ8BXfywx\",\"isSaaSV2\":true,\"contactId\":\"1QDPY5FpU9DlKp7RQ8BXfywx\",\"providerLocationId\":\"r06mdj4OrrERzYDvsOdh\",\"description\":\"Description\",\"saasPlanId\":\"1QDPY5FpU9DlKp7RQ8BXfywx\",\"priceId\":\"price_1QDPY5FpU9DlKp7RQ8BXfywx\"}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/saas/enable-saas/<locationId>"
  payload := strings.NewReader(`{
  "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
  "isSaaSV2": true,
  "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "providerLocationId": "r06mdj4OrrERzYDvsOdh",
  "description": "Description",
  "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}`)
  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/enable-saas/<locationId>")

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 = '{
  "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
  "isSaaSV2": true,
  "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "providerLocationId": "r06mdj4OrrERzYDvsOdh",
  "description": "Description",
  "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}'

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

**PowerShell**

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

$body = '{
  "stripeAccountId": "acct_1QDPY5FpU9DlKp7RQ8BXfywx",
  "name": "John Doe",
  "email": "john.doe@example.com",
  "stripeCustomerId": "cus_1QDPY5FpU9DlKp7RQ8BXfywx",
  "isSaaSV2": true,
  "contactId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "providerLocationId": "r06mdj4OrrERzYDvsOdh",
  "description": "Description",
  "saasPlanId": "1QDPY5FpU9DlKp7RQ8BXfywx",
  "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx"
}'

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