# Get target interests

GET https://services.leadconnectorhq.com/ad-publishing/google/target-interests

Retrieve affinity and in-market audience options for Google Ads targeting. Without `limit` the response is a plain array of root interests (each with a nested children tree). When `limit` is provided (max 100) the response is a paginated `{ targetInterests, paging }` envelope — a page counts root interests; pass `pageToken` (from `paging.next`) to fetch the next batch. By default each node is returned in full; pass `projection` (comma-separated, e.g. ?projection=name,userInterestId,children) to return only the requested fields — selecting `children` prunes the whole tree recursively with the same selection, and any value outside the known field set is rejected.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `adPublishing.readonly`

## Parameters

### Header Parameters

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

### Query Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `locationId` | string | Yes | Location identifier |
| `type` | string | Yes | Interest type |
| `advertisingChannelType` | string | Yes | Channel type |
| `limit` | string | No | Page size for a paginated fetch (max 100). When set, the response is a { targetInterests, paging } envelope instead of a plain array. Counts root interests — each root includes its full children tree. |
| `pageToken` | string | No | Opaque cursor for the next batch, taken from the previous response paging.next |
| `projection` | array | No | Fields to return on each interest node, comma-separated (e.g. ?projection=name,userInterestId,children). When set, only the requested fields are returned. Selecting `children` prunes the whole tree recursively with the same selection; `availabilities` returns the whole array. Any value outside the known field set is rejected. Omit the param entirely to receive the full node as-is. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-07-28"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/google/target-interests": {
      "get": {
        "summary": "Get target interests",
        "operationId": "getTargetInterests",
        "description": "Retrieve affinity and in-market audience options for Google Ads targeting. Without `limit` the response is a plain array of root interests (each with a nested children tree). When `limit` is provided (max 100) the response is a paginated `{ targetInterests, paging }` envelope — a page counts root interests; pass `pageToken` (from `paging.next`) to fetch the next batch. By default each node is returned in full; pass `projection` (comma-separated, e.g. ?projection=name,userInterestId,children) to return only the requested fields — selecting `children` prunes the whole tree recursively with the same selection, and any value outside the known field set is rejected.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-07-28"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location identifier",
            "schema": {
              "example": "HChooFuiyPpVYzeJ4HMe",
              "type": "string"
            }
          },
          {
            "name": "type",
            "required": true,
            "in": "query",
            "description": "Interest type",
            "schema": {
              "example": "AFFINITY",
              "enum": [
                "AFFINITY",
                "IN_MARKET"
              ],
              "type": "string"
            }
          },
          {
            "name": "advertisingChannelType",
            "required": true,
            "in": "query",
            "description": "Channel type",
            "schema": {
              "example": "SEARCH",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size for a paginated fetch (max 100). When set, the response is a { targetInterests, paging } envelope instead of a plain array. Counts root interests — each root includes its full children tree.",
            "schema": {
              "example": "100",
              "type": "string"
            }
          },
          {
            "name": "pageToken",
            "required": false,
            "in": "query",
            "description": "Opaque cursor for the next batch, taken from the previous response paging.next",
            "schema": {
              "example": "100",
              "type": "string"
            }
          },
          {
            "name": "projection",
            "required": false,
            "in": "query",
            "description": "Fields to return on each interest node, comma-separated (e.g. ?projection=name,userInterestId,children). When set, only the requested fields are returned. Selecting `children` prunes the whole tree recursively with the same selection; `availabilities` returns the whole array. Any value outside the known field set is rejected. Omit the param entirely to receive the full node as-is.",
            "schema": {
              "example": [
                "name",
                "userInterestId",
                "children"
              ],
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "resourceName",
                  "taxonomyType",
                  "userInterestId",
                  "name",
                  "userInterestParent",
                  "availabilities",
                  "children"
                ]
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A plain array of root interests (default), or a { targetInterests, paging } envelope when `limit` is provided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetTargetInterestsResponse"
                }
              }
            }
          },
          "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"
                }
              }
            }
          },
          "500": {
            "description": "Internal Server Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InternalServerErrorDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "adPublishing.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": {
      "GetTargetInterestsResponse": {
        "oneOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "example": [
              {
                "resourceName": "customers/6776452901/userInterests/80546",
                "userInterestId": "80546",
                "name": "Sports & Fitness",
                "taxonomyType": "AFFINITY",
                "children": [
                  {
                    "resourceName": "customers/6776452901/userInterests/92948",
                    "userInterestId": "92948",
                    "name": "Fitness Buffs",
                    "taxonomyType": "AFFINITY",
                    "userInterestParent": "customers/6776452901/userInterests/80546",
                    "children": []
                  }
                ]
              }
            ]
          },
          {
            "type": "object",
            "properties": {
              "targetInterests": {
                "type": "array",
                "description": "Page of root Google Ads target interests, each with a nested children tree",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                },
                "example": [
                  {
                    "resourceName": "customers/6776452901/userInterests/80546",
                    "userInterestId": "80546",
                    "name": "Sports & Fitness",
                    "taxonomyType": "AFFINITY",
                    "children": [
                      {
                        "resourceName": "customers/6776452901/userInterests/92948",
                        "userInterestId": "92948",
                        "name": "Fitness Buffs",
                        "taxonomyType": "AFFINITY",
                        "userInterestParent": "customers/6776452901/userInterests/80546",
                        "children": []
                      }
                    ]
                  }
                ]
              },
              "paging": {
                "description": "Pagination cursor",
                "example": {
                  "next": "100"
                },
                "allOf": [
                  {
                    "type": "object",
                    "properties": {
                      "next": {
                        "type": "string",
                        "description": "Cursor for the next page of results, or null when there are no more pages",
                        "example": "100",
                        "nullable": true
                      }
                    },
                    "required": [
                      "next"
                    ],
                    "title": "GoogleTargetInterestsPagingDTO"
                  }
                ]
              }
            },
            "required": [
              "targetInterests",
              "paging"
            ],
            "title": "PaginatedGoogleTargetInterestsDTO"
          }
        ]
      },
      "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"
      },
      "InternalServerErrorDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "description": "HTTP status code for an unexpected server error",
            "example": 500
          },
          "message": {
            "type": "string",
            "description": "Error message describing the server failure",
            "example": "Internal Server Error"
          }
        },
        "title": "InternalServerErrorDTO"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-07-28'
```

**Node.js**

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

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/ad-publishing/google/target-interests"

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

params = {
    "locationId": "<LOCATIONID>",
    "type": "<TYPE>",
    "advertisingChannelType": "<ADVERTISINGCHANNELTYPE>"
}

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/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-07-28',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-07-28")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>"
  req, _ := http.NewRequest("GET", url, nil)
  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/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>")

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

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

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/google/target-interests?locationId=<LOCATIONID>&type=<TYPE>&advertisingChannelType=<ADVERTISINGCHANNELTYPE>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
