# Get Location where app is installed

GET https://services.leadconnectorhq.com/oauth/installedLocations

Fetch the locations where the app is installed.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Agency token: OAuth access token only (Private Integration Tokens are not accepted).** Scopes: `oauth.readonly`

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `skip` | string | No | Parameter to skip the number installed locations |
| `limit` | string | No | Parameter to limit the number installed locations (max 100) |
| `query` | string | No | Parameter to search for the installed location by name |
| `isInstalled` | boolean | No | Filters out location which are installed for specified app under the specified company |
| `restrictToUserLocations` | boolean | No | When true, restricts the list to locations the current user has access to (for restricted agency admins and account admins). When false or omitted, no user-based filter is applied for installed list; for backward compatibility, install list (isInstalled=false) is still filtered by user when this param is omitted. |
| `companyId` | string | Yes | Parameter to search by the companyId |
| `appId` | string | Yes | Parameter to search by the appId |
| `versionId` | string | No | VersionId of the app |
| `sortOrder` | string | No | Sort order for installedAt date. Defaults to desc (latest first) |
| `installedAfter` | string | No | Filter locations installed on or after this date (ISO 8601) |
| `installedBefore` | string | No | Filter locations installed on or before this date (ISO 8601) |
| `onTrial` | boolean | No | Filters out locations which are installed for specified app in trial mode |
| `planId` | string | No | Filters out location which are installed for specified app under the specified planId |
| `locationId` | string | No | locationId |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/oauth/installedLocations": {
      "get": {
        "summary": "Get Location where app is installed",
        "operationId": "getLocationWhereAppIsInstalled",
        "description": "Fetch the locations where the app is installed.",
        "parameters": [
          {
            "name": "skip",
            "required": false,
            "in": "query",
            "description": "Parameter to skip the number installed locations",
            "schema": {
              "default": "0",
              "example": "1",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Parameter to limit the number installed locations (max 100)",
            "schema": {
              "default": "10",
              "example": "10",
              "type": "string"
            }
          },
          {
            "name": "query",
            "required": false,
            "in": "query",
            "description": "Parameter to search for the installed location by name",
            "schema": {
              "example": "location name",
              "type": "string"
            }
          },
          {
            "name": "isInstalled",
            "required": false,
            "in": "query",
            "description": "Filters out location which are installed for specified app under the specified company",
            "schema": {
              "example": true,
              "type": "boolean"
            }
          },
          {
            "name": "restrictToUserLocations",
            "required": false,
            "in": "query",
            "description": "When true, restricts the list to locations the current user has access to (for restricted agency admins and account admins). When false or omitted, no user-based filter is applied for installed list; for backward compatibility, install list (isInstalled=false) is still filtered by user when this param is omitted.",
            "schema": {
              "example": true,
              "type": "boolean"
            }
          },
          {
            "name": "companyId",
            "required": true,
            "in": "query",
            "description": "Parameter to search by the companyId",
            "schema": {
              "example": "tDtDnQdgm2LXpyiqYvZ6",
              "type": "string"
            }
          },
          {
            "name": "appId",
            "required": true,
            "in": "query",
            "description": "Parameter to search by the appId",
            "schema": {
              "example": "tDtDnQdgm2LXpyiqYvZ6",
              "type": "string"
            }
          },
          {
            "name": "versionId",
            "required": false,
            "in": "query",
            "description": "VersionId of the app",
            "schema": {
              "example": "tDtDnQdgm2LXpyiqYvZ6",
              "type": "string"
            }
          },
          {
            "name": "sortOrder",
            "required": false,
            "in": "query",
            "description": "Sort order for installedAt date. Defaults to desc (latest first)",
            "schema": {
              "example": "asc",
              "enum": [
                "asc",
                "desc"
              ],
              "type": "string"
            }
          },
          {
            "name": "installedAfter",
            "required": false,
            "in": "query",
            "description": "Filter locations installed on or after this date (ISO 8601)",
            "schema": {
              "example": "2025-01-01T00:00:00.000Z",
              "type": "string"
            }
          },
          {
            "name": "installedBefore",
            "required": false,
            "in": "query",
            "description": "Filter locations installed on or before this date (ISO 8601)",
            "schema": {
              "example": "2025-12-31T23:59:59.999Z",
              "type": "string"
            }
          },
          {
            "name": "onTrial",
            "required": false,
            "in": "query",
            "description": "Filters out locations which are installed for specified app in trial mode",
            "schema": {
              "example": true,
              "type": "boolean"
            }
          },
          {
            "name": "planId",
            "required": false,
            "in": "query",
            "description": "Filters out location which are installed for specified app under the specified planId",
            "schema": {
              "example": true,
              "type": "string"
            }
          },
          {
            "name": "locationId",
            "required": false,
            "in": "query",
            "description": "locationId",
            "schema": {
              "example": "1245",
              "type": "string"
            }
          },
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetInstalledLocationsSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Agency-Access-Only": [
              "oauth.readonly"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "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",
        "name": "Authorization",
        "in": "header",
        "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",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "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",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "GetInstalledLocationsSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "locations": {
            "description": "List of locations with their installation status for the requested app",
            "example": [
              {
                "_id": "0IHuJvc2ofPAAA8GzTRi",
                "name": "John Deo",
                "address": "47 W 13th St, New York, NY 10011, USA",
                "isInstalled": true
              }
            ],
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "_id": {
                  "type": "string",
                  "example": "0IHuJvc2ofPAAA8GzTRi",
                  "description": "Location ID"
                },
                "name": {
                  "type": "string",
                  "example": "John Deo",
                  "description": "Name of the location"
                },
                "address": {
                  "type": "string",
                  "example": "47 W 13th St, New York, NY 10011, USA",
                  "description": "Address linked to location"
                },
                "isInstalled": {
                  "type": "boolean",
                  "example": true,
                  "description": "Check if the requested app is installed for following location"
                },
                "versionId": {
                  "type": "string",
                  "example": "6578278e879ad2646715ba9c",
                  "description": "Version ID of the installed app version for this location"
                },
                "installedAt": {
                  "format": "date-time",
                  "type": "string",
                  "example": "2024-01-15T10:30:00.000Z",
                  "description": "Timestamp when the app was installed on this location"
                }
              },
              "required": [
                "_id",
                "name",
                "address"
              ],
              "title": "InstalledLocationSchema"
            }
          },
          "count": {
            "type": "number",
            "example": 1231,
            "description": "Total location count under the company"
          },
          "installToFutureLocations": {
            "type": "boolean",
            "description": "Boolean to control if user wants app to be automatically installed to future locations",
            "example": true
          }
        },
        "title": "GetInstalledLocationsSuccessfulResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const response = await ghl.oauth.getLocationWhereAppIsInstalled({ companyId: '<COMPANYID>', appId: '<APPID>' });
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

response = await client.oauth.get_location_where_app_is_installed(companyId='<COMPANYID>', appId='<APPID>')
print(response)
```

**PHP** (`gohighlevel/api-client`)

```php
<?php
require_once 'vendor/autoload.php';

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$response = $ghl->oauth->getLocationWhereAppIsInstalled(['companyId' => '<COMPANYID>', 'appId' => '<APPID>']);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21'
```

**Node.js**

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

try {
  const response = await fetch('https://services.leadconnectorhq.com/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/oauth/installedLocations"

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

params = {
    "companyId": "<COMPANYID>",
    "appId": "<APPID>"
}

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/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>"
  req, _ := http.NewRequest("GET", url, nil)
  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/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>")

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

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

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/oauth/installedLocations?companyId=<COMPANYID>&appId=<APPID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
