Admin API Examples
Overview
Whether you're managing feature flags at scale, migrating between environments, or reporting on usage, these examples are designed to help platform and release engineering teams speed up workflows and enforce governance.
Common use cases
You can use these sample scripts to automate common tasks with the Admin API.
tip
All examples use the Python PyPi library for the Admin API, and require access tokens with Admin permissions. For setup instructions, see Python PyPi Library.
Flag lifecycle management
- Find all Feature Flags that depend on a given flag
- Delete a list of Feature Flags and their definitions
- Export all feature flag definitions to JSON files
- Copy feature flags with their definitions between projects
- Copy and overwrite feature flag definitions between environments
- Export feature flags treatments to YAML file
- Get list of feature flags in an environment with rollout status
- Report flags with 100% treatment and no changes since a given date
Targeting and segments
- Import thousands of keys to an existing segment
- Delete thousands of keys from a segment
- Copy segment content to another segment
- Add segment to individual targets for a group of feature flags
- Add user keys to individual targets in a flag
- Add targeting rule to an existing feature flag