---
title: get-a-flag
product: vercel
url: /docs/rest-api/feature-flags/get-a-flag
canonical_url: "https://vercel.com/docs/rest-api/feature-flags/get-a-flag"
last_updated: 2026-09-15
type: reference
prerequisites:
  []
related:
  - /docs/rest-api
summary: Learn about get-a-flag on Vercel.
install_vercel_plugin: npx plugins add vercel/vercel-plugin
---

# Get a flag

```http
GET /v1/projects/{projectIdOrName}/feature-flags/flags/{flagIdOrSlug}
```

Retrieve a specific feature flag by its ID or slug.

## Authentication

**bearerToken**: HTTP bearer

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `projectIdOrName` | string | Yes | The project id or name |
| `flagIdOrSlug` | string | Yes | The flag id or name |


## Query parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `ifMatch` | string | No | Etag to match, can be used interchangeably with the `if-match` header |
| `withMetadata` | boolean | No | Whether to include metadata in the response |
| `teamId` | string | No | The Team identifier to perform the request on behalf of. |
| `slug` | string | No | The Team slug to perform the request on behalf of. |


## Example request

### TypeScript

```typescript
const response = await fetch('https://api.vercel.com/v1/projects/projectIdOrName/feature-flags/flags/flagIdOrSlug?ifMatch=string&withMetadata=true&teamId=string&slug=string', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'Content-Type': 'application/json',
  },
});

const data = await response.json();
console.log(data);
```

### Next.js

```typescript
'use server';

export async function callEndpoint() {
  const response = await fetch('https://api.vercel.com/v1/projects/projectIdOrName/feature-flags/flags/flagIdOrSlug?ifMatch=string&withMetadata=true&teamId=string&slug=string', {
    method: 'GET',
    headers: {
      'Authorization': `Bearer ${process.env.VERCEL_ACCESS_TOKEN}`,
      'Content-Type': 'application/json',
    },
    next: { revalidate: 3600 }
  });

  if (!response.ok) {
    throw new Error('Request failed');
  }

  return response.json();
}
```

### cURL

```bash
curl -X GET 'https://api.vercel.com/v1/projects/projectIdOrName/feature-flags/flags/flagIdOrSlug?ifMatch=string&withMetadata=true&teamId=string&slug=string' \
  -H 'Authorization: Bearer YOUR_ACCESS_TOKEN' \
  -H 'Content-Type: application/json'
```

## Example response

```json
{
  "description": "string",
  "variants": [
    {
      "description": "string",
      "label": "string",
      "value": "string",
      "id": "icfg_1234567890"
    }
  ],
  "id": "icfg_1234567890",
  "environments": "value",
  "kind": "boolean",
  "revision": "123",
  "seed": "123",
  "state": "active",
  "maintainerIds": [],
  "permanent": "false",
  "tags": [],
  "slug": "string",
  "createdAt": "123",
  "updatedAt": "123",
  "updatedBy": "string",
  "createdBy": "string",
  "ownerId": "example_id",
  "projectId": "example_id",
  "typeName": "flag",
  "metadata": {
    "creator": {
      "id": "icfg_1234567890",
      "name": "Example Name"
    }
  }
}
```

## Responses

### 200: No description

Content-Type: `application/json`

```json
{
  "type": "object",
  "required": [
    "createdAt",
    "createdBy",
    "environments",
    "id",
    "kind",
    "ownerId",
    "projectId",
    "revision",
    "seed",
    "slug",
    "state",
    "typeName",
    "updatedAt",
    "variants"
  ],
  "properties": {
    "description": {
      "type": "string"
    },
    "variants": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "id",
          "value"
        ],
        "properties": {
          "description": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "value": {
            "nullable": true
          },
          "id": {
            "type": "string"
          }
        }
      }
    },
    "id": {
      "type": "string"
    },
    "environments": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "required": [
          "active",
          "fallthrough",
          "pausedOutcome",
          "rules"
        ],
        "properties": {
          "reuse": {
            "type": "object",
            "required": [
              "active",
              "environment"
            ]
          },
          "targets": {
            "type": "object"
          },
          "revision": {
            "type": "number"
          },
          "pausedOutcome": {
            "type": "object",
            "required": [
              "type",
              "variantId"
            ]
          },
          "fallthrough": {},
          "active": {
            "type": "boolean",
            "enum": [
              false,
              true
            ]
          },
          "rules": {
            "type": "array"
          }
        }
      }
    },
    "kind": {
      "type": "string",
      "enum": [
        "boolean",
        "json",
        "number",
        "string"
      ]
    },
    "revision": {
      "type": "number"
    },
    "seed": {
      "type": "number"
    },
    "state": {
      "type": "string",
      "enum": [
        "active",
        "archived"
      ]
    },
    "maintainerIds": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "permanent": {
      "type": "boolean",
      "enum": [
        false,
        true
      ]
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "slug": {
      "type": "string"
    },
    "createdAt": {
      "type": "number"
    },
    "updatedAt": {
      "type": "number"
    },
    "updatedBy": {
      "type": "string"
    },
    "createdBy": {
      "type": "string"
    },
    "ownerId": {
      "type": "string"
    },
    "projectId": {
      "type": "string"
    },
    "typeName": {
      "type": "string",
      "enum": [
        "flag"
      ]
    },
    "metadata": {
      "type": "object",
      "properties": {
        "creator": {
          "type": "object",
          "required": [
            "id",
            "name"
          ],
          "properties": {
            "id": {
              "type": "string"
            },
            "name": {
              "type": "string"
            }
          }
        }
      }
    }
  }
}
```

### 304: No description

### 400: One of the provided values in the request query is invalid.

### 401: The request is not authorized.

### 402: The account is missing a payment so payment method must be updated

### 403: You do not have permission to access this resource.

### 404: No description

### 410: No description

---

## Related

- [feature-flags endpoints](/docs/rest-api#feature-flags)

- [REST API overview](/docs/rest-api)

- [OpenAPI spec](https://openapi.vercel.sh/) (machine-readable, all endpoints)

---

[View full sitemap](/docs/sitemap)
