# Obtain the required tokens for setup

To set up the Code Agent wtih the Broker client, you must have the following tokens:

* **Snyk API token** - this token is **required for the Code Agent setup**. It is used in the `-e SNYK_TOKEN` parameter to authenticate the Code Agent component with your Snyk Account. See [Obtain and use your Snyk API token](../../../../../getting-started#obtain-and-use-your-snyk-api-token) and [Set up the Code Agent](set-up-the-code-agent).
* **Broker token** - this token is **required for the Broker client setup**. It is used in the `-e BROKER_TOKEN` parameter. The Broker token is associated with a specific Organization by default and with a specific integrated SCM, and enables Snyk Broker deployment for this Organization and SCM. For each SCM, a different Broker token is required. Details are on this page.
* **Integrated SCM token** - this token is required for the Broker Client setup. It is used in the `-e <SCM>_TOKEN` parameter, for example, `-e GITHUB_TOKEN=xxx…`, to enable access to the SCM with certain permissions needed for the operation of the Broker and Snyk Code. For details, see [Integrated SCM tokens for Snyk Broker](../../../../../scm-ide-and-ci-cd-integrations/snyk-scm-integrations#integrated-scm-tokens-for-snyk-broker).

After you have obtained the required tokens, save them in a safe and accessible place for use in setting up the Code Agent and the Broker Client.

## Obtain your Broker token for Snyk Broker - Code Agent

You have the following options for obtaining the Broker token:

* **Using an existing Broker token for the Code Agent setup** -If you already have a Broker token, which you used for running the Broker client for another Snyk product in the same Organization and the same SCM, you can also use it to set up Snyk Broker - Code Agent.
* **Using the same Broker token for multiple Snyk Organizations** -\
  Although by default a Broker token is associated with only one Snyk Organization, if you have Organization Admin permissions, you can use the same Broker token for multiple Organizations as follows:
  * **A new Organization** - If you create a new Organization based on an existing Organization that has a Broker token, the existing Broker token is cloned during the creation of the new Organization, and you can use it for the new Organization as well.
  * **An existing Organization** - If you want to use an existing Broker token for other existing Organizations, you can use the endpoint [Clone an integration (with settings and credentials)](../../../../../snyk-api/reference/integrations-v1#org-orgid-integrations-integrationid-clone). This API clones existing integration settings, including the Broker token for the Integration.
* **Using a Broker token for redundancy** -If you set up two Broker Clients for the same Organization and the same SCM for redundancy purposes, you must use the same Broker token for both Broker clients. You can obtain the Snyk Broker token in the following ways:
  * Recommended: ask your Snyk account team to generate a Broker token for you and then obtain it from the Web UI.
  * Generate the Broker token using Snyk APIs. See the instructions in the next section.

After a Broker token is generated by your Snyk account team or through the API, you can [obtain your Broker token from the Web UI](#obtain-your-broker-token-from-the-web-ui).

## **Generate your Broker token using the Snyk API**

You can generate the Broker token by using the API as follows:

1. Use the endpoint [Update Existing Integration](../../../../../snyk-api/reference/integrations-v1#org-orgid-integrations-type) to enable Snyk Broker for a specific Organization and a specific SCM. This generates a Broker token in the UI.
2. To generate a Broker token programmatically after enabling Snyk Broker, use the endpoint [Provision new Broker token](../../../../../snyk-api/reference/integrations-v1#org-orgid-integrations-integrationid-authentication-provision-token) to generate a Broker token.\
   You can see the generated Broker token in the API response body and on the Web UI.
3. After generating the Broker token, copy and save it and store it in a secure location for future use, or obtain it later using the Web UI.

## **Obtain your Broker token from the Web UI**

After your Broker token is generated, it is displayed on the Web UI. Follow these steps to obtain the token:

1. In the Snyk Web UI, select the **Organization** for which you want to set up the Snyk Broker.
2. In the selected Organization, select **Integration**. Find the Integration to which you want to connect Snyk Broker, and click the **Settings** icon.
3. On the **Settings** page of the selected Integration, in the **Broker Credentials** section, copy the Broker token from the **Token** box and save it for future use:

<figure><img src="https://2533899886-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MdwVZ6HOZriajCf5nXH%2Fuploads%2FYj4jJT0ERljLl8kFJuj6%2FSnyk%20Broker%20-%20Broker%20Token%20-%20box.png?alt=media&#x26;token=6f018534-0749-4181-849c-20fcf9026542" alt="Copy the Broker token"><figcaption><p>Copy the Broker token</p></figcaption></figure>
