Feature flag manifests in App Lifecycle Manager let you create and export flags in
bulk using local JSON files that conform to the
[open-source OpenFeature flag manifest schema](https://openfeature.dev/docs/tutorials/open-feature-cli/#flag-manifest-structure).
You can push new definitions to the App Lifecycle Manager management plane or
pull existing flags for OpenFeature code generation.

## Prerequisites

Before you begin, ensure you have:

1. A `gcloud` environment configured to manage App Lifecycle Manager resources.
2. Completed the [Deploy feature flags quickstart](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-console-quickstart.md.txt) or the [Deploy with the gcloud CLI quickstart](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-quickstart.md.txt).

## Create flags from a manifest

The `push` command lets you create multiple flags at once by providing a local
JSON manifest file.

1. Create a file named `my_flags.json` with your flag definitions.
   This file serves as the local source of truth for your manifest.

   Example `my_flags.json`:

   ```json
   {
     "flags": {
       "my-flag": {
         "defaultValue": "foo-bar",
         "description": "A description of the flag.",
         "flagType": "string"
       }
     }
   }
   ```
   1. Run the `push` command specifying your manifest file and the targeted `UnitKind`.

   ```bash
   gcloud beta app-lifecycle-manager flags push \
       --file="my_flags.json" \
       --location="global" \
       --unit-kind="UNIT_KIND_NAME"
   ```

   > [!NOTE]
   > **Note:** The `push` command is additive--this means it can create flags, but won't update or delete existing flags in the management plane.

## Create a manifest from existing flag configurations

The `pull` command fetches existing flag configurations from the
App Lifecycle Manager API and generates a local JSON manifest file. This lets
you maintain a local record of your flags or prepare them for use with
OpenFeature codegen tools.

1. Run the `pull` command specifying your chosen output path.

   ```bash
    gcloud beta app-lifecycle-manager flags pull \
        --location="global" \
        --output-file="manifest.json" \
        --unit-kind="UNIT_KIND_NAME" \
        --overwrite-output-file
   ```
2. If you are using type-safe flag accessors, run the OpenFeature CLI codegen
   utility against the new `manifest.json` to update your application's
   type-safe flag accessors. This ensures the manifests match the keys and
   types in the management plane.

## What's next

- Learn about [Complex Targeting with CEL](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-targeting.md.txt).
- Learn about [Multi-Tenant Architecture](https://docs.cloud.google.com/app-lifecycle-manager/flags/flags-multi-tenant.md.txt).