> ## Documentation Index
> Fetch the complete documentation index at: https://documentation.clubedge.live/llms.txt
> Use this file to discover all available pages before exploring further.

# Getting started

> Create an environment, ship a flag, and evaluate it in your app — start to finish in five steps.

This walkthrough takes you from a blank account to a live, evaluated flag in your app, using the same seeded flag from [Overview](/feature-flags/overview): `new_dashboard`. Each step shows the exact request and response so you can follow along with `curl` or jump straight to the SDK snippet you'll actually ship.

<Note>
  Already have an environment and SDK key? Skip ahead to [Step 4: evaluate it in code](#4-evaluate-it-in-code), or go directly to the [Node.js SDK guide](/feature-flags/sdk/node) or [Evaluation API reference](/feature-flags/reference/evaluation-api) for your stack.
</Note>

## Before you start

You'll need your account's access token to call the API steps below.

<Tip>
  Steps 1–3 can also be done straight from the dashboard UI — **Environments → New environment** and **Flags → New flag** — if you'd rather skip the API calls entirely. The API versions below are there for when you want to script or automate this.
</Tip>

## Ship a flag end to end

<Steps>
  <Step title="Create an environment">
    An environment scopes everything else — flags, rollouts, and one SDK key. Create one per stage of your pipeline (`development`, `staging`, `production`).

    ```http Request theme={null}
    POST /environments
    Authorization: Bearer YOUR_ACCESS_TOKEN
    Content-Type: application/json

    {
      "product": "workspace",
      "name": "production"
    }
    ```

    ```json Response theme={null}
    {
      "id": "env_4f7a1c2b",
      "name": "production",
      "sdkKey": "ffk_1a2b3c4d5e6f"
    }
    ```

    <Tip>
      `sdkKey` is only ever returned in full on creation. Copy it into your secrets manager now — it's the same value you'll reference as `FEATURE_FLAGS_SDK_KEY` in Step 4 and in the [Overview](/feature-flags/overview) examples.
    </Tip>
  </Step>

  <Step title="Create a flag">
    A flag is just a typed key until it's attached to an environment. Seeded examples in this repo use `snake_case`.

    ```http Request theme={null}
    POST /flags
    Authorization: Bearer YOUR_ACCESS_TOKEN
    Content-Type: application/json

    {
      "key": "new_dashboard",
      "name": "New Dashboard",
      "type": "boolean"
    }
    ```

    ```json Response theme={null}
    {
      "id": "flg_9f8e7d6c",
      "key": "new_dashboard",
      "type": "boolean"
    }
    ```

    <Note>
      Flag keys are case-sensitive and must match exactly wherever they're evaluated — `new_dashboard`, not `New_Dashboard` or `newDashboard`. Same rule as in [Overview](/feature-flags/overview).
    </Note>
  </Step>

  <Step title="Enable the flag for the environment">
    Creating a flag and enabling it are separate steps on purpose — you can create the key well ahead of a launch and flip it on later with no code change.

    ```http Request theme={null}
    PUT /flags/{flagId}/environments/{environmentId}
    Authorization: Bearer YOUR_ACCESS_TOKEN
    Content-Type: application/json

    {
      "isEnabled": true
    }
    ```

    Returns `204 No Content` on success. If you get a 404, double-check `flagId` and `environmentId` are from the same product — see [Admin workflow](/feature-flags/admin-workflow) for how flags and environments attach.
  </Step>

  <Step title="Evaluate it in code">
    Pick whichever of these matches how you're testing right now — a raw HTTP call, the Node.js SDK, or the React hook. All three ask the same question: is `new_dashboard` on for this user?

    <CodeGroup>
      ```bash cURL theme={null}
      curl -X POST https://flags.clubedge.live/sdk/v1/evaluate \
        -H "Authorization: Bearer ffk_1a2b3c4d5e6f" \
        -H "Content-Type: application/json" \
        -d '{
          "sdkKey": "ffk_1a2b3c4d5e6f",
          "flagKey": "new_dashboard",
          "context": { "userId": "user-123", "country": "US" }
        }'
      ```

      ```javascript Node.js theme={null}
      import { FeatureFlagsClient } from "@clubedge/feature-flags-node";

      const client = new FeatureFlagsClient({
        sdkKey: process.env.FEATURE_FLAGS_SDK_KEY,
      });

      const dashboardEnabled = await client.isEnabled("new_dashboard", {
        userId: "user-123",
        country: "US",
      });
      ```

      ```jsx React theme={null}
      import { useFeatureFlag } from "@clubedge/feature-flags-react";

      function Dashboard() {
        const dashboardEnabled = useFeatureFlag("new_dashboard", {
          userId: "user-123",
          country: "US",
        });

        return dashboardEnabled ? <NewDashboard /> : <LegacyDashboard />;
      }
      ```
    </CodeGroup>

    <Note>
      The SDK (`@clubedge/feature-flags-node`) calls `GET /sdk/v1/config` and evaluates locally — it does <em>not</em> call `POST /sdk/v1/evaluate` at runtime. The Direct HTTP endpoint above is for non-JS environments or when you need server-side evaluation with per-request context.
    </Note>
  </Step>

  <Step title="Confirm it worked">
    `dashboardEnabled` should be `true`. If it isn't, work through the table below before assuming the SDK is broken — the most common cause is a dashboard-side attachment issue, not a code issue.
  </Step>
</Steps>

## If the flag doesn't turn on

| Symptom                                                                  | Likely cause                                                                                     | Fix                                                                              |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------- |
| `isEnabled()` / `useFeatureFlag()` returns the default value, not `true` | Flag exists but isn't attached to the environment behind your SDK key                            | Attach it — see [Admin workflow](/feature-flags/admin-workflow)                  |
| `401` / `403` on `POST /environments` or `POST /flags`                   | Missing, expired, or wrong token — or an SDK key was used instead of your account's access token | Use your account's access token, or skip the API and do it from the dashboard UI |
| Flag "not found" at evaluation time                                      | Typo or case mismatch in the flag key                                                            | Re-check the exact spelling — flag keys are case-sensitive                       |
| Right value in one environment, wrong in another                         | Each environment has its own enabled/disabled state and its own SDK key                          | Confirm the SDK key in use matches the environment you just edited               |
