Using the API to set up a GitHub connection
Example of using the Snyk API to set up a GitHub connection with the Universal Broker
This page provides an example of using the API to set up a GitHub connection with the Universal Broker. Repeat connecting your Organization for as many integrations as needed.
Using the snyk-broker-config CLI tool is recommended for an easier experience. The API allows for automation and more control, and also requires a clear understanding of Broker deployments, credentials, connections, and integrations.
Prerequisites
You must be a Snyk Tenant admin.
You must use a personal Snyk API token. Service account tokens do not work.
You need Org admin access for the Organization where you install the Broker app.
Install Broker for your Organization
Universal Broker facilitates the secure connection and communication with the Broker server through OAuth.
Install the Broker app at the Organization level. Group-level installation is not supported.
Identify the Snyk Broker App ID for your region.
For most regions, the app ID is
cb43d761-bd17-4b44-9b6c-e5b8ad077d33.If you are using Snyk for Government, contact your account team for the app ID.
Install the Broker on the Organization you use to administer Broker:
curl --location --request POST 'https://api.snyk.io/rest/orgs/ORG_ID/apps/installs?version=2025-11-05' \
--header 'Content-Type: application/vnd.api+json' \
--header 'Authorization: token YOUR_SNYK_TOKEN' \
--data-raw '{
"data": {
"type": "app_install",
"relationships": {
"app": {
"data": {
"id": "SNYK_BROKER_APP_ID",
"type": "app"
}
}
}
}
}'Use the endpoint Install a Snyk App to this Organization as the source of truth for the exact request and response schema.
Save the values needed in later steps:
INSTALL_IDis thedata.idfrom the response.The Broker App ID is shown under
data.relationships.app.data.id.CLIENT_IDandCLIENT_SECRET(returned by the install call) are needed to run the Broker client.
Create your deployment
Use the following call to create your deployment.
This returns the DEPLOYMENT_ID (data.id), for example:
At this point, you can start running the Broker client.
Run your Broker deployment
Target your desired environment with the usual -e BROKER_SERVER_URL=https://broker.REGION.snyk.io \ if needed. For a list of URLs, see Broker server URLs.
Use the CLIENT_ID and CLIENT_SECRET values returned when you installed the Broker app.
When the command is running, you should get the following message in the output:
Create your credentials reference or references
This returns the credential reference ID (data. id), for example:
You can create a maximum of ten credentials in one call by adding more objects in attributes. These objects can be of different types.
Create your connection or connections
This returns a Connection ID (data.id), as shown in the example. This call returns the credential reference directly, ready for use, rather than the credential reference UUID.
If your credential reference is missing, you get the following message:
When you update an environment variable, you must restart your Broker. See Restart your Broker for a new environment variable.
You can now use the connection in an Organization integration.
Connect your Organization integration to use a connection
Repeat the process of connecting your Organization for as many integrations as needed.
Last updated
Was this helpful?

