You can use the Agencies \& Brands API to generate reports that can provide
insights about the performance of your agency account.

## Agency accounts

An agency account represents advertising agencies that interact with Google Ad
Manager publishers. You can find the account ID for your agency account by
viewing the [Agency UI](https://realtimebidding.google.com/) while logged in to your
Google Account.

## Set up authentication

Google APIs use the [OAuth 2.0 protocol](https://developers.google.com/identity/protocols/oauth2) for
authentication and authorization. Here's how to set up a
[Service Account](https://developers.google.com/identity/protocols/oauth2/service-account)
to access the Agencies and Brands API:

1. If you haven't done so already, [create a Google Cloud
   Project](https://cloud.google.com/resource-manager/docs/creating-managing-projects)
   that hosts your credentials used to access the API.

   > [!IMPORTANT]
   > **Important:** We recommend that multiple members of your organization are granted access to this project. This avoids interruptions to your integration due to lost access to the project.

2. Go to the [Google Cloud console Enabled APIs
   page](https://console.cloud.google.com/apis/enabled?project=_). Select the project
   you created earlier.

3. You see a list of enabled APIs and services. To access the Agencies \&
   Brands API, you must enable it. If it isn't enabled, click **+Enable APIs
   and services** and search for **Agencies \& Brands API** , select it, and
   click **Enable**.

   It is a known issue that you might not be able to find the Agencies \&
   Brands API with the Google Cloud Console search box. As an alternative,
   you can use [Google Cloud CLI](https://docs.cloud.google.com/sdk/docs/install-sdk)
   to enable the API instead. After you install gcloud CLI, you can enable the
   Agencies \& Brands API with the following command:

       gcloud services enable agenciesandbrands.googleapis.com --project=CLOUD_PROJECT_ID

4. On the navigation menu, select **Credentials**.

5. Click **+Create credentials** , and in the resulting menu select
   **Service account**.

6. Enter a name in the **Name** field for the service account. The
   **Service account ID** is created automatically upon creation. This value
   is needed in a later step. Optionally enter a description. Click
   **Create and continue**.

7. Optionally configure permissions for the service account and click
   **Continue**.

8. Optionally configure users or groups that can perform actions as the
   service account and click **Done**.

9. Your new service account is listed under **Service Accounts**. Click the
   service account ID you just created.

10. Click the **Keys** tab.

11. In the **Add key** menu, select **Create new key**.

12. Select **JSON** as the **Key type** , and click **Create**.

13. Download the key to your working directory. For more information about
    storing your key securely, see [Managing service account
    keys](https://cloud.google.com/iam/docs/best-practices-for-managing-service-account-keys).
    The key is used by your application to make API calls.

14. Share the service account ID with your technical account manager to link
    the service account with your agency account.

### API scopes

When stepping through the OAuth 2.0 authorization flow to receive an access
token used to make an API call, you must specify the API scope:

`https://www.googleapis.com/auth/agencies-and-brands`

> [!WARNING]
> **Warning:** If you step through the OAuth 2.0 authorization flow without providing the correct API scope, the access token you receive is unauthorized to call the Agencies and Brands API.

## Next steps

- [Agencies and Brands API reference](https://developers.google.com/authorized-buyers/agencies-and-brands/apis/agenciesandbrands/reference/rest): Explore resources and methods in the API reference documentation.
- [Release notes](https://developers.google.com/authorized-buyers/agencies-and-brands/apis/release-notes): Review updates and release history for the Agencies and Brands API.