---
title: Create or update Feature Flag.
slug: amberflo-api/create-or-update-feature-flag
docTags: 
createdAt: 2024-11-07T15:10:16.979Z
---

{
  "id": "rx0hS5W8zeuXkClg8642v",
  "type": "api-oas-v2",
  "data": {
    "method": "POST",
    "url": "https://app.amberflo.io/feature/flag",
    "servers": [
      {
        "url": "https://app.amberflo.io/feature/flag"
      }
    ],
    "name": "Create or update Feature Flag.",
    "description": "",
    "contentType": "application/json",
    "request": {
      "pathParameters": [],
      "headerParameters": [],
      "queryParameters": [],
      "bodyDataParameters": [
        {
          "kind": "optional",
          "name": "body",
          "type": "object",
          "description": "",
          "customType": "metadata.feature_flag.FeatureFlag.in",
          "schema": [
            {
              "name": "id",
              "kind": "required",
              "type": "string",
              "description": "Id of the flag.",
              "example": ""
            },
            {
              "name": "label",
              "kind": "optional",
              "type": "string",
              "description": "Name of the flag.",
              "example": ""
            },
            {
              "name": "description",
              "kind": "optional",
              "type": "string",
              "description": "Description of the flag.",
              "example": ""
            },
            {
              "name": "defaultValue",
              "kind": "optional",
              "type": "object",
              "description": "Default value of the flag.",
              "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.FlagValue.in",
              "customType": "metadata.feature_flag.flag_values.FlagValue.in",
              "schema": [],
              "complexType": "oneOf",
              "complexItems": [
                {
                  "name": "metadata.feature_flag.flag_values.BooleanValue.in",
                  "description": "",
                  "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.BooleanValue.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "required",
                      "type": "string",
                      "description": "Type of the flag.",
                      "example": "",
                      "default": "bool"
                    },
                    {
                      "name": "value",
                      "kind": "required",
                      "type": "boolean",
                      "description": "Value of the flag.",
                      "example": ""
                    }
                  ]
                },
                {
                  "name": "metadata.feature_flag.flag_values.IntegerValue.in",
                  "description": "",
                  "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.IntegerValue.in",
                  "schema": [
                    {
                      "name": "type",
                      "kind": "required",
                      "type": "string",
                      "description": "Type of the flag.",
                      "example": "",
                      "default": "int"
                    },
                    {
                      "name": "value",
                      "kind": "required",
                      "type": "integer<int32>",
                      "description": "Value of the flag.",
                      "example": 0
                    }
                  ]
                }
              ]
            }
          ],
          "modelRef": "#/components/schemas/metadata.feature_flag.FeatureFlag.in",
          "isExpanded": true
        }
      ],
      "formDataParameters": [],
      "oAuthParameters": [
        {
          "id": "apiKey",
          "name": "X-API-KEY",
          "kind": "optional",
          "type": "apiKey",
          "in": "header"
        }
      ]
    },
    "responses": [
      {
        "statusCode": "200",
        "description": "Successful request",
        "jsonExample": "",
        "isExpanded": true,
        "schema": [
          {
            "kind": "optional",
            "type": "object",
            "description": "",
            "customType": "metadata.feature_flag.FeatureFlag.out",
            "schema": [
              {
                "name": "id",
                "kind": "required",
                "type": "string",
                "description": "Id of the flag.",
                "example": ""
              },
              {
                "name": "label",
                "kind": "optional",
                "type": "string",
                "description": "Name of the flag.",
                "example": ""
              },
              {
                "name": "description",
                "kind": "optional",
                "type": "string",
                "description": "Description of the flag.",
                "example": ""
              },
              {
                "name": "defaultValue",
                "kind": "optional",
                "type": "object",
                "description": "Default value of the flag.",
                "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.FlagValue.out",
                "customType": "metadata.feature_flag.flag_values.FlagValue.out",
                "schema": [],
                "complexType": "oneOf",
                "complexItems": [
                  {
                    "name": "metadata.feature_flag.flag_values.BooleanValue.out",
                    "description": "",
                    "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.BooleanValue.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "required",
                        "type": "string",
                        "description": "Type of the flag.",
                        "example": "",
                        "default": "bool"
                      },
                      {
                        "name": "value",
                        "kind": "required",
                        "type": "boolean",
                        "description": "Value of the flag.",
                        "example": ""
                      }
                    ]
                  },
                  {
                    "name": "metadata.feature_flag.flag_values.IntegerValue.out",
                    "description": "",
                    "modelRef": "#/components/schemas/metadata.feature_flag.flag_values.IntegerValue.out",
                    "schema": [
                      {
                        "name": "type",
                        "kind": "required",
                        "type": "string",
                        "description": "Type of the flag.",
                        "example": "",
                        "default": "int"
                      },
                      {
                        "name": "value",
                        "kind": "required",
                        "type": "integer<int32>",
                        "description": "Value of the flag.",
                        "example": 0
                      }
                    ]
                  }
                ]
              }
            ],
            "modelRef": "#/components/schemas/metadata.feature_flag.FeatureFlag.out",
            "isExpanded": true
          }
        ]
      }
    ],
    "examples": {
      "languages": [
        {
          "id": "jn1YVLcXdZnOm8ilCXZBI",
          "language": "curl",
          "label": "cURL",
          "code": "curl --request POST \\\n     --url https://app.amberflo.io/feature/flag \\\n     --header 'accept: application/json' \\\n     --header 'content-type: application/json' \\\n     --data '{\n     \"id\": \"\",\n     \"defaultValue\": {\n     \"type\": \"bool\",\n     \"value\": \"\"\n     }\n     }'"
        },
        {
          "id": "GrY1KYqvAijwTnCKHtGPC",
          "language": "javascript",
          "label": "javascript",
          "code": "var myHeaders = new Headers();\nmyHeaders.append(\"accept\", \"application/json\");\nmyHeaders.append(\"content-type\", \"application/json\");\n\nvar raw = JSON.stringify({\n   \"id\": \"\",\n   \"defaultValue\": {\n      \"type\": \"bool\",\n      \"value\": \"\"\n   }\n});\n\nvar requestOptions = {\n   method: 'POST',\n   headers: myHeaders,\n   body: raw,\n   redirect: 'follow'\n};\n\nfetch(\"https://app.amberflo.io/feature/flag\", requestOptions)\n   .then(response => response.text())\n   .then(result => console.log(result))\n   .catch(error => console.log('error', error));"
        },
        {
          "id": "Hn9zZ_KXw2t6z3VzEgLsi",
          "language": "ruby",
          "label": "Ruby",
          "code": "require \"uri\"\nrequire \"json\"\nrequire \"net/http\"\n\nurl = URI(\"https://app.amberflo.io/feature/flag\")\n\nhttps = Net::HTTP.new(url.host, url.port)\nhttps.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest[\"accept\"] = \"application/json\"\nrequest[\"content-type\"] = \"application/json\"\nrequest.body = JSON.dump({\n   \"id\": \"\",\n   \"defaultValue\": {\n      \"type\": \"bool\",\n      \"value\": \"\"\n   }\n})\n\nresponse = https.request(request)\nputs response.read_body\n"
        },
        {
          "id": "K22gY2f-SHjtiqfQbx-gf",
          "language": "python",
          "label": "Python",
          "code": "import requests\nimport json\n\nurl = \"https://app.amberflo.io/feature/flag\"\n\npayload = json.dumps({\n   \"id\": \"\",\n   \"defaultValue\": {\n      \"type\": \"bool\",\n      \"value\": \"\"\n   }\n})\nheaders = {\n   'accept': 'application/json',\n   'content-type': 'application/json'\n}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)\n"
        }
      ],
      "selectedLanguageId": "jn1YVLcXdZnOm8ilCXZBI"
    },
    "results": {
      "languages": [
        {
          "id": "nl4p0wYIl927mlNOciL8c",
          "language": "200",
          "code": "// Successful request\n{\n  \"id\": \"\",\n  \"label\": \"\",\n  \"description\": \"\",\n  \"defaultValue\": {}\n}"
        }
      ],
      "selectedLanguageId": "nl4p0wYIl927mlNOciL8c"
    }
  },
  "children": [
    {
      "text": ""
    }
  ]
}