# Get audiences

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

Retrieve Google Ads combined audiences for a location. Without `limit` the response is a plain array. When `limit` is provided (max 100, default 100) the response is a paginated `{ audiences, paging }` envelope; pass `pageToken` (from `paging.next`) to fetch the next batch.

## 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 |
| `limit` | string | No | Page size for a paginated fetch (max 100, defaults to 100). When set, the response is a { audiences, paging } envelope instead of a plain array. |
| `pageToken` | string | No | Opaque cursor for the next batch, taken from the previous response paging.next |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2021-04-15"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/ad-publishing/google/audiences": {
      "get": {
        "summary": "Get audiences",
        "operationId": "getAudiences",
        "description": "Retrieve Google Ads combined audiences for a location. Without `limit` the response is a plain array. When `limit` is provided (max 100, default 100) the response is a paginated `{ audiences, paging }` envelope; pass `pageToken` (from `paging.next`) to fetch the next batch.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2021-04-15"
              ]
            }
          },
          {
            "name": "locationId",
            "required": true,
            "in": "query",
            "description": "Location identifier",
            "schema": {
              "example": "loc_abc123",
              "type": "string"
            }
          },
          {
            "name": "limit",
            "required": false,
            "in": "query",
            "description": "Page size for a paginated fetch (max 100, defaults to 100). When set, the response is a { audiences, paging } envelope instead of a plain array.",
            "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"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "A plain array of audiences (default), or a { audiences, paging } envelope when `limit` is provided",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetAudiencesResponse"
                }
              }
            }
          },
          "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": {
      "GetAudiencesResponse": {
        "oneOf": [
          {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "resourceName": {
                  "type": "string",
                  "description": "Google Ads resource name",
                  "example": "customers/6776452901/audiences/330214962"
                },
                "id": {
                  "type": "string",
                  "description": "Audience id",
                  "example": "330214962"
                },
                "status": {
                  "type": "string",
                  "description": "Audience status",
                  "example": "ENABLED"
                },
                "name": {
                  "type": "string",
                  "description": "Audience name",
                  "example": "Returning customers"
                },
                "scope": {
                  "type": "string",
                  "description": "Scope the audience is defined at",
                  "example": "CUSTOMER"
                },
                "dimensions": {
                  "description": "Inclusion targeting",
                  "example": {
                    "ageRanges": [
                      {
                        "minAge": 18,
                        "maxAge": 64
                      }
                    ],
                    "genders": [
                      "MALE"
                    ],
                    "incomeRanges": [
                      "INCOME_RANGE_0_50"
                    ],
                    "parentalStatuses": [
                      "PARENT"
                    ],
                    "audienceSegments": {
                      "customAudiences": [
                        "customers/6776452901/customAudiences/901256299"
                      ],
                      "userLists": [
                        "customers/6776452901/userLists/9144367872"
                      ],
                      "userInterests": [
                        "customers/6776452901/userInterests/80276"
                      ]
                    },
                    "isAgeUnknown": true,
                    "isHouseHoldIncomeUnknown": true
                  },
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "ageRanges": {
                          "description": "Targeted age ranges. Returned as spans, which may cover several Google buckets.",
                          "example": [
                            {
                              "minAge": 18,
                              "maxAge": 64
                            }
                          ],
                          "type": "array",
                          "items": {
                            "type": "object",
                            "properties": {
                              "minAge": {
                                "type": "number",
                                "description": "Lower bound of the range, inclusive",
                                "example": 18
                              },
                              "maxAge": {
                                "type": "number",
                                "description": "Upper bound of the range, inclusive. Absent for the open-ended 65+ range.",
                                "example": 64
                              }
                            },
                            "required": [
                              "minAge"
                            ],
                            "title": "GoogleAudienceAgeRangeDTO"
                          }
                        },
                        "genders": {
                          "type": "array",
                          "description": "Targeted genders",
                          "example": [
                            "MALE"
                          ],
                          "items": {
                            "type": "string",
                            "enum": [
                              "MALE",
                              "FEMALE",
                              "UNDETERMINED"
                            ]
                          }
                        },
                        "incomeRanges": {
                          "description": "Targeted household income bands, in Google `INCOME_RANGE_*` form",
                          "example": [
                            "INCOME_RANGE_0_50"
                          ],
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        },
                        "parentalStatuses": {
                          "type": "array",
                          "description": "Targeted parental statuses",
                          "example": [
                            "PARENT"
                          ],
                          "items": {
                            "type": "string",
                            "enum": [
                              "PARENT",
                              "NOT_A_PARENT",
                              "UNDETERMINED"
                            ]
                          }
                        },
                        "audienceSegments": {
                          "description": "Segment targeting",
                          "example": {
                            "customAudiences": [
                              "customers/6776452901/customAudiences/901256299"
                            ],
                            "userLists": [
                              "customers/6776452901/userLists/9144367872"
                            ],
                            "userInterests": [
                              "customers/6776452901/userInterests/80276"
                            ]
                          },
                          "allOf": [
                            {
                              "type": "object",
                              "properties": {
                                "customAudiences": {
                                  "description": "Custom audience resource names",
                                  "example": [
                                    "customers/6776452901/customAudiences/901256299"
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "userLists": {
                                  "description": "User list resource names",
                                  "example": [
                                    "customers/6776452901/userLists/9144367872"
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                },
                                "userInterests": {
                                  "description": "User interest resource names. Omitted entirely when the audience targets none.",
                                  "example": [
                                    "customers/6776452901/userInterests/80276"
                                  ],
                                  "type": "array",
                                  "items": {
                                    "type": "string"
                                  }
                                }
                              },
                              "required": [
                                "customAudiences",
                                "userLists"
                              ],
                              "title": "GoogleAudienceSegmentsDTO"
                            }
                          ]
                        },
                        "isAgeUnknown": {
                          "type": "boolean",
                          "description": "Whether users of unknown age are included. Omitted when not set.",
                          "example": true
                        },
                        "isHouseHoldIncomeUnknown": {
                          "type": "boolean",
                          "description": "Whether users of unknown household income are included. Omitted when not set.",
                          "example": true
                        }
                      },
                      "required": [
                        "ageRanges",
                        "genders",
                        "incomeRanges",
                        "parentalStatuses",
                        "audienceSegments"
                      ],
                      "title": "GoogleAudienceDimensionsDTO"
                    }
                  ]
                },
                "exclusionDimension": {
                  "description": "Exclusion targeting",
                  "example": {
                    "userLists": [
                      "customers/6776452901/userLists/8999046675"
                    ]
                  },
                  "allOf": [
                    {
                      "type": "object",
                      "properties": {
                        "userLists": {
                          "description": "User list resource names excluded from the audience",
                          "example": [
                            "customers/6776452901/userLists/8999046675"
                          ],
                          "type": "array",
                          "items": {
                            "type": "string"
                          }
                        }
                      },
                      "required": [
                        "userLists"
                      ],
                      "title": "GoogleAudienceExclusionDimensionDTO"
                    }
                  ]
                }
              },
              "required": [
                "resourceName",
                "id",
                "status",
                "name",
                "scope",
                "dimensions",
                "exclusionDimension"
              ],
              "title": "GoogleAudienceDTO"
            }
          },
          {
            "type": "object",
            "properties": {
              "audiences": {
                "description": "Page of Google Ads combined audiences",
                "example": [
                  {
                    "resourceName": "customers/6776452901/audiences/330214962",
                    "id": "330214962",
                    "status": "ENABLED",
                    "name": "Returning customers",
                    "scope": "CUSTOMER",
                    "dimensions": {
                      "ageRanges": [
                        {
                          "minAge": 18,
                          "maxAge": 64
                        }
                      ],
                      "genders": [
                        "MALE"
                      ],
                      "incomeRanges": [
                        "INCOME_RANGE_0_50"
                      ],
                      "parentalStatuses": [
                        "PARENT"
                      ],
                      "audienceSegments": {
                        "customAudiences": [
                          "customers/6776452901/customAudiences/901256299"
                        ],
                        "userLists": [
                          "customers/6776452901/userLists/9144367872"
                        ],
                        "userInterests": [
                          "customers/6776452901/userInterests/80276"
                        ]
                      },
                      "isAgeUnknown": true,
                      "isHouseHoldIncomeUnknown": true
                    },
                    "exclusionDimension": {
                      "userLists": [
                        "customers/6776452901/userLists/8999046675"
                      ]
                    }
                  }
                ],
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "resourceName": {
                      "type": "string",
                      "description": "Google Ads resource name",
                      "example": "customers/6776452901/audiences/330214962"
                    },
                    "id": {
                      "type": "string",
                      "description": "Audience id",
                      "example": "330214962"
                    },
                    "status": {
                      "type": "string",
                      "description": "Audience status",
                      "example": "ENABLED"
                    },
                    "name": {
                      "type": "string",
                      "description": "Audience name",
                      "example": "Returning customers"
                    },
                    "scope": {
                      "type": "string",
                      "description": "Scope the audience is defined at",
                      "example": "CUSTOMER"
                    },
                    "dimensions": {
                      "description": "Inclusion targeting",
                      "example": {
                        "ageRanges": [
                          {
                            "minAge": 18,
                            "maxAge": 64
                          }
                        ],
                        "genders": [
                          "MALE"
                        ],
                        "incomeRanges": [
                          "INCOME_RANGE_0_50"
                        ],
                        "parentalStatuses": [
                          "PARENT"
                        ],
                        "audienceSegments": {
                          "customAudiences": [
                            "customers/6776452901/customAudiences/901256299"
                          ],
                          "userLists": [
                            "customers/6776452901/userLists/9144367872"
                          ],
                          "userInterests": [
                            "customers/6776452901/userInterests/80276"
                          ]
                        },
                        "isAgeUnknown": true,
                        "isHouseHoldIncomeUnknown": true
                      },
                      "allOf": [
                        {
                          "type": "object",
                          "properties": {
                            "ageRanges": {
                              "description": "Targeted age ranges. Returned as spans, which may cover several Google buckets.",
                              "example": [
                                {
                                  "minAge": 18,
                                  "maxAge": 64
                                }
                              ],
                              "type": "array",
                              "items": {
                                "type": "object",
                                "properties": {
                                  "minAge": {
                                    "type": "number",
                                    "description": "Lower bound of the range, inclusive",
                                    "example": 18
                                  },
                                  "maxAge": {
                                    "type": "number",
                                    "description": "Upper bound of the range, inclusive. Absent for the open-ended 65+ range.",
                                    "example": 64
                                  }
                                },
                                "required": [
                                  "minAge"
                                ],
                                "title": "GoogleAudienceAgeRangeDTO"
                              }
                            },
                            "genders": {
                              "type": "array",
                              "description": "Targeted genders",
                              "example": [
                                "MALE"
                              ],
                              "items": {
                                "type": "string",
                                "enum": [
                                  "MALE",
                                  "FEMALE",
                                  "UNDETERMINED"
                                ]
                              }
                            },
                            "incomeRanges": {
                              "description": "Targeted household income bands, in Google `INCOME_RANGE_*` form",
                              "example": [
                                "INCOME_RANGE_0_50"
                              ],
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            },
                            "parentalStatuses": {
                              "type": "array",
                              "description": "Targeted parental statuses",
                              "example": [
                                "PARENT"
                              ],
                              "items": {
                                "type": "string",
                                "enum": [
                                  "PARENT",
                                  "NOT_A_PARENT",
                                  "UNDETERMINED"
                                ]
                              }
                            },
                            "audienceSegments": {
                              "description": "Segment targeting",
                              "example": {
                                "customAudiences": [
                                  "customers/6776452901/customAudiences/901256299"
                                ],
                                "userLists": [
                                  "customers/6776452901/userLists/9144367872"
                                ],
                                "userInterests": [
                                  "customers/6776452901/userInterests/80276"
                                ]
                              },
                              "allOf": [
                                {
                                  "type": "object",
                                  "properties": {
                                    "customAudiences": {
                                      "description": "Custom audience resource names",
                                      "example": [
                                        "customers/6776452901/customAudiences/901256299"
                                      ],
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    "userLists": {
                                      "description": "User list resource names",
                                      "example": [
                                        "customers/6776452901/userLists/9144367872"
                                      ],
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    },
                                    "userInterests": {
                                      "description": "User interest resource names. Omitted entirely when the audience targets none.",
                                      "example": [
                                        "customers/6776452901/userInterests/80276"
                                      ],
                                      "type": "array",
                                      "items": {
                                        "type": "string"
                                      }
                                    }
                                  },
                                  "required": [
                                    "customAudiences",
                                    "userLists"
                                  ],
                                  "title": "GoogleAudienceSegmentsDTO"
                                }
                              ]
                            },
                            "isAgeUnknown": {
                              "type": "boolean",
                              "description": "Whether users of unknown age are included. Omitted when not set.",
                              "example": true
                            },
                            "isHouseHoldIncomeUnknown": {
                              "type": "boolean",
                              "description": "Whether users of unknown household income are included. Omitted when not set.",
                              "example": true
                            }
                          },
                          "required": [
                            "ageRanges",
                            "genders",
                            "incomeRanges",
                            "parentalStatuses",
                            "audienceSegments"
                          ],
                          "title": "GoogleAudienceDimensionsDTO"
                        }
                      ]
                    },
                    "exclusionDimension": {
                      "description": "Exclusion targeting",
                      "example": {
                        "userLists": [
                          "customers/6776452901/userLists/8999046675"
                        ]
                      },
                      "allOf": [
                        {
                          "type": "object",
                          "properties": {
                            "userLists": {
                              "description": "User list resource names excluded from the audience",
                              "example": [
                                "customers/6776452901/userLists/8999046675"
                              ],
                              "type": "array",
                              "items": {
                                "type": "string"
                              }
                            }
                          },
                          "required": [
                            "userLists"
                          ],
                          "title": "GoogleAudienceExclusionDimensionDTO"
                        }
                      ]
                    }
                  },
                  "required": [
                    "resourceName",
                    "id",
                    "status",
                    "name",
                    "scope",
                    "dimensions",
                    "exclusionDimension"
                  ],
                  "title": "GoogleAudienceDTO"
                }
              },
              "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": "GoogleAudiencesPagingDTO"
                  }
                ]
              }
            },
            "required": [
              "audiences",
              "paging"
            ],
            "title": "PaginatedGoogleAudiencesDTO"
          }
        ]
      },
      "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/audiences?locationId=<LOCATIONID>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2021-04-15'
```

**Node.js**

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

try {
  const response = await fetch('https://services.leadconnectorhq.com/ad-publishing/google/audiences?locationId=<LOCATIONID>', 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/audiences"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2021-04-15"
}

params = {
    "locationId": "<LOCATIONID>"
}

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/audiences?locationId=<LOCATIONID>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2021-04-15',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/ad-publishing/google/audiences?locationId=<LOCATIONID>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2021-04-15")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/ad-publishing/google/audiences?locationId=<LOCATIONID>"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2021-04-15")

  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/audiences?locationId=<LOCATIONID>")

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-04-15"

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/ad-publishing/google/audiences?locationId=<LOCATIONID>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
