This script retrieves all projects from a specified Snyk organization and moves them to another target organization.
- Python 3.x installed
- A valid Snyk API Token
requests
library installed (if not, install usingpip install requests
)
- Clone this repository:
git clone https://github.com/your-username/move-project-to-another-org.git cd move-project-to-another-org
- Ensure the script
move_projects.py
is inside the repository directory.
- Set your Snyk API token as an environment variable:
export SNYK_TOKEN=your-snyk-api-token
- Run the script:
python move_projects.py
- Enter the required details when prompted:
- Current Organization ID (where projects are currently located)
- Target Organization ID (where projects will be moved)
- The script retrieves and displays all projects from the current organization.
- It then attempts to move each project to the new organization.
- Success or failure messages are printed for each project.
- Ensure that the authenticated user has permissions to move projects between organizations.
- If you encounter a
409 Conflict
error, it may be due to project constraints (e.g., already existing in the target org).
This project is open-source and available under the MIT License.