# Get SaaS Locations

GET https://services.leadconnectorhq.com/saas/saas-locations/{companyId}

Fetch all SaaS-activated locations for a company with pagination

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token or Private Integration Token.** Scopes: `saas/company.read`

## Parameters

### Header Parameters

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

### Path Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `page` | number | Yes |  |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/saas/saas-locations/{companyId}": {
      "get": {
        "summary": "Get SaaS Locations",
        "operationId": "getSaasLocations",
        "description": "Fetch all SaaS-activated locations for a company with pagination",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "path",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "page",
            "required": true,
            "in": "query",
            "schema": {
              "type": "number"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Paginated SaaS-enabled sub-accounts for the company.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetSaasLocationsResponseDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access": [
              "saas/company.read"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetSaasLocationsResponseDto": {
        "type": "object",
        "properties": {
          "locations": {
            "description": "Array of SaaS locations",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "locationId": {
                  "type": "string",
                  "description": "Location ID",
                  "example": "locationId1"
                },
                "companyId": {
                  "type": "string",
                  "description": "Company ID",
                  "example": "companyId1"
                },
                "saasMode": {
                  "type": "string",
                  "description": "SaaS mode",
                  "example": "saasV2"
                },
                "subscriptionId": {
                  "type": "string",
                  "description": "Subscription ID",
                  "example": "subscriptionId1"
                },
                "customerId": {
                  "type": "string",
                  "description": "Customer ID",
                  "example": "customerId1"
                },
                "name": {
                  "type": "string",
                  "description": "Name",
                  "example": "John Doe"
                },
                "email": {
                  "type": "string",
                  "description": "Email",
                  "example": "john.doe@example.com"
                },
                "providerLocationId": {
                  "type": "string",
                  "description": "Provider location ID",
                  "example": "r06mdj4OrrERzYDvsOdh"
                },
                "isSaaSV2": {
                  "type": "boolean",
                  "description": "Indicates if the SaaS is V2",
                  "example": true
                },
                "subscriptionInfo": {
                  "type": "object",
                  "description": "Subscription information",
                  "example": {
                    "priceId": "price_1QDPY5FpU9DlKp7RQ8BXfywx",
                    "saasPlanId": "66c4d36534f21f900dc2a265",
                    "stripeProductId": "prod_1QDPY5FpU9DlKp7RQ8BXfywx",
                    "subscriptionStatus": "active"
                  }
                }
              },
              "required": [
                "locationId",
                "companyId",
                "saasMode",
                "subscriptionId"
              ],
              "title": "SaasLocationDto"
            }
          },
          "pagination": {
            "type": "object",
            "properties": {
              "page": {
                "type": "number",
                "example": 1,
                "description": "Page number"
              },
              "limit": {
                "type": "number",
                "example": 10,
                "description": "Number of items per page"
              },
              "total": {
                "type": "number",
                "example": 100,
                "description": "Total number of items"
              },
              "totalPages": {
                "type": "number",
                "example": 10,
                "description": "Total number of pages"
              },
              "hasNext": {
                "type": "boolean",
                "example": true,
                "description": "Indicates if there is a next page"
              },
              "hasPrev": {
                "type": "boolean",
                "example": true,
                "description": "Indicates if there is a previous page"
              }
            }
          }
        },
        "required": [
          "locations",
          "pagination"
        ],
        "title": "GetSaasLocationsResponseDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/saas/saas-locations/<companyId>?page=<PAGE>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3'
  }
};

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

**Python**

```python
import requests

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

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

params = {
    "page": "<PAGE>"
}

response = requests.get(url, params=params, headers=headers)
print(response.json())
```

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/saas/saas-locations/<companyId>?page=<PAGE>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/saas/saas-locations/<companyId>?page=<PAGE>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/saas/saas-locations/<companyId>?page=<PAGE>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  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/saas-locations/<companyId>?page=<PAGE>")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/saas/saas-locations/<companyId>?page=<PAGE>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
