---
title: Get Flag Status
slug: feature-experimentation/api/get-flag-status
docTags: 
createdAt: 2026-10-13T18:16:15.508Z
---

{
  "id": "IjrsRr7mdETJMn2gQGj0Y",
  "type": "api-oas-v2",
  "data": {
    "method": "GET",
    "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status",
    "servers": [
      {
        "url": "https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status"
      }
    ],
    "name": "Get Flag Status",
    "description": "<p>Fetch the status of a Flag by key.\nReturns status and days_since_last_modified.</p>",
    "contentType": "application/json",
    "request": {
      "pathParameters": [
        {
          "kind": "required",
          "name": "project_id",
          "type": "integer",
          "example": 12345,
          "description": "The project identifier"
        },
        {
          "kind": "required",
          "name": "flag_key",
          "type": "string",
          "example": "recurring_deposit",
          "description": "The Flag identifier"
        }
      ],
      "headerParameters": [
        {
          "name": "accept",
          "type": "string",
          "kind": "optional",
          "description": "Generated from available response content types",
          "enum": [
            "application/json"
          ],
          "default": "application/json"
        }
      ],
      "queryParameters": [],
      "bodyDataParameters": [],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "apiKey",
          "kind": "optional",
          "type": "http",
          "scheme": "bearer"
        },
        {
          "id": "OAuth2",
          "name": "OAuth2",
          "kind": "optional",
          "type": "oauth2",
          "description": "Write applications that authenticate with the REST API via OAuth 2.0.",
          "oauth2Flows": {
            "authorizationCode": {
              "authorizationUrl": "https://app.optimizely.com/oauth2/authorize",
              "tokenUrl": "https://app.optimizely.com/oauth2/token",
              "scopes": {
                "all": "Grants all access"
              }
            }
          },
          "requiredScopes": [
            "read",
            "write"
          ]
        }
      ],
      "cookieParameters": []
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful retrieval of flag status",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "example": "{\"days_since_last_modified\":9,\"status\":\"live\"}",
            "description": "Lightweight flag status information",
            "customType": "FlagStatus",
            "schema": [
              {
                "name": "days_since_last_modified",
                "kind": "required",
                "type": "integer",
                "description": "Number of days since the flag was last modified",
                "example": 9
              },
              {
                "name": "status",
                "kind": "required",
                "type": "string<draft | testing | live | paused | stale | archived>",
                "description": "Current status of the flag",
                "example": "live",
                "enum": [
                  "draft",
                  "testing",
                  "live",
                  "paused",
                  "stale",
                  "archived"
                ]
              }
            ],
            "modelRef": "#/components/schemas/FlagStatus",
            "isExpanded": true
          }
        ]
      },
      {
        "statusCode": "401",
        "description": "Invalid credentials",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "403",
        "description": "Do not have permission to perform the operation",
        "jsonExample": "",
        "isExpanded": true
      },
      {
        "statusCode": "404",
        "description": "Not found. No content",
        "jsonExample": "",
        "isExpanded": true
      }
    ],
    "hasXCodeSamples": false,
    "examples": {
      "languages": [
        {
          "id": "IxEjuScK2VFxAqgpuDcP_",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request GET \\\n     --url https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status \\\n     --header 'accept: application/json'"
        },
        {
          "id": "e39YO3G2KG5yD1Nn80rVu",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar requestOptions = {\n   method: 'GET',\n   headers: myHeaders,\n   redirect: 'follow'\n};\n\nfetch(\"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "KjV7SMqOgmXpgwjtYNk-S",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Get.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "QqbhK1JOcIl_29bN5dPwC",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://api.optimizely.com/flags/v1//projects/{project_id}/flags/{flag_key}/status\"\n\npayload = {}\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"GET\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "IxEjuScK2VFxAqgpuDcP_"
    },
    "results": {
      "languages": [
        {
          "id": "dJenugqiLuIaV2oW4yCSC",
          "language": "200",
          "code": "// Successful retrieval of flag status\n{\n  \"days_since_last_modified\": 9,\n  \"status\": \"live\"\n}"
        },
        {
          "id": "mrqa6gNywY2JQvG7nbUBU",
          "language": "401",
          "code": "// Invalid credentials\n"
        },
        {
          "id": "4vR2MswF0LiC39iAsByCN",
          "language": "403",
          "code": "// Do not have permission to perform the operation\n"
        },
        {
          "id": "nJ6t1h0e90zTBUTqgAZ27",
          "language": "404",
          "code": "// Not found. No content\n"
        }
      ],
      "selectedLanguageId": "dJenugqiLuIaV2oW4yCSC"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}