Automate Snyk organization management and integrate a single Universal Broker connection across multiple organizations with Python scripts.
This repo provides:
- Extraction of Snyk organizations by group
- Bulk integration of a Universal Broker connection to multiple organizations
Extracts all organizations from a Snyk group and saves them to a JSON file.
Integrates organizations to a single Universal Broker connection using the JSON output from the first script. Please remove organizations from the JSON that you don't want to scale the connection out for.
- Python 3.7+
- pip
- Snyk account with API access
- Environment variables only:
SNYK_API_TOKEN(required)SNYK_TENANT_ID(required)
Note: All instructions below work in both
zshandbashshells.
python3 -m venv venv
source venv/bin/activatepip install -r requirements.txtexport SNYK_API_TOKEN=your_api_token_here
export SNYK_TENANT_ID=your_tenant_id_herepython get_orgs_by_group.py --group-id <your-group-id>python scale_broker_for_orgs.py \
--json-file snyk_orgs_for_GroupName.json \
--connection-id <your-connection-id> \
--integration-id <your-integration-id> \
--integration-type github| Argument | Required | Description |
|---|---|---|
| --group-id | Yes | Snyk group ID to fetch organizations from |
| --output | No | Output JSON file path (auto-generated) |
| Argument | Required | Description |
|---|---|---|
| --json-file | Yes | Path to JSON file from previous script |
| --connection-id | Yes | Universal Broker connection ID |
| --integration-id | Yes | Integration ID for the broker connection |
| --integration-type | Yes | Integration type (github, gitlab, etc.) |
| --output-log | No | Output log file (default: auto-generated) |
{
"metadata": {
"group_id": "abc123",
"group_name": "My Company",
"total_organizations": 25
},
"organizations": {
"orgs": [
{
"id": "org123",
"name": "Frontend Team",
"url": "https://api.snyk.io/org/org123"
}
]
}
}{
"summary": {
"total_organizations": 25,
"successful_connections": 24,
"failed_connections": 1,
"tenant_id": "tenant123",
"connection_id": "conn456",
"timestamp": "2025-07-24T14:28:00.123456"
},
"results": [
{
"org_id": "org123",
"org_name": "Frontend Team",
"success": true,
"response": {"status": "connected"},
"timestamp": "2025-07-24T14:28:01.123456"
}
]
}MIT
