← OAuth 2.0
Get Location Access Token from Agency Token
Generate a sub-account (location) access token from an agency-level (company) access token. This allows your app to act on behalf of a specific location without requiring separate authorization.
POST
/oauth/locationTokenScope
—
Auth Method
Bearer Token (Agency)
Token Type
Company
Header Parameters
| Parameter | Type | Description |
|---|---|---|
Authorizationrequired | string | Bearer {company_access_token} |
Versionrequired | string | API Version Possible values: 2021-07-28 |
Content-Typerequired | string | application/x-www-form-urlencoded |
Body Parameters
| Parameter | Type | Description |
|---|---|---|
companyIdrequired | string | The Company ID of the agency that owns the location you want to request a token for. |
locationIdrequired | string | The Location ID (sub-account) for which you want to obtain an access token. |
Example RequestcURL
curl -X POST \
'https://services.leadconnectorhq.com/oauth/locationToken' \
-H 'Authorization: Bearer {company_access_token}' \
-H 'Version: 2021-07-28' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'companyId=5DP41231LkQsiKESj6rh' \
-d 'locationId=ve9EPM428h8vShlRW1KT'Response — 200 OK
Example ResponseJSON
{
"access_token": "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 86400,
"scope": "contacts.readonly contacts.write conversations.readonly ...",
"locationId": "ve9EPM428h8vShlRW1KT",
"userId": "usr_abc123",
"planId": "plan_xyz789",
"appId": "app_def456",
"appVersionId": "ver_ghi789"
}Response Fields
| Parameter | Type | Description |
|---|---|---|
access_token | string | Location access token which can be used to authenticate and authorize API calls under the granted scopes. |
token_type | string | Always "Bearer". |
expires_in | integer | Time in seconds remaining for the token to expire. |
scope | string | Scopes the access token has access to. |
locationId | string | Location ID — present only for Sub-Account access tokens. |
userId | string | User ID of the person who performed the installation. |
planId | string | Plan ID of the subscribed plan (paid apps only). |
appId | string | App ID of the installed application. |
appVersionId | string | Version ID of the installed app version. |
Important
This endpoint requires a Company-level access token in the Authorization header. The resulting location token inherits the scopes that were approved during the original OAuth installation flow. No refresh token is returned — generate a new location token from the agency token whenever needed.
