目的
このガイドでは、Automation API を使用してフィーチャーフラグのライフサイクルを管理する方法を説明します。 最初のフラグを構成するには、次の手順を実行します。- 新しいフィーチャーフラグを作成するエンドポイントを使用して、フィーチャーフラグを作成します。
- フィーチャーフラグ構成を更新するエンドポイントを使用して、開発環境にロールアウトルールを追加します。
- ID で単一のルールを更新するエンドポイントを使用して、ロールアウトルールを更新します。
要件
前提条件
Automation API を使用する前に、以下の情報が利用可能であることを確認してください。アクセストークン
Automation API には アクセストークン が必要です。トークンの取得方法については、アクセストークンの取得の指示に従ってください。siteCode
siteCode は、左下の Admin > Projects に移動して確認できます。

1. フィーチャーフラグを作成する
たとえば、test_variable という変数を持つ test_feature_flag_post というフィーチャーフラグを作成します。
このリクエストでは environmentConfigurations を指定していないため、システムは development、staging、production の各環境の構成を自動的に生成します。
エンドポイント:
POST https://api.kameleoon.com/feature-flags
curl -L -X POST 'https://api.kameleoon.com/feature-flags' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{
"featureKey": "test_feature_flag_post",
"name": "test_feature_flag_post",
"siteCode": "pzllysfw2f",
"description": "",
"tags": [],
"variables": [
{
"key": "test_variable",
"type": "STRING",
"value": "test"
}
],
"variations": [
{
"name": "On",
"key": "on",
"variables": [
{
"key": "test_variable",
"type": "STRING",
"value": "test"
}
]
},
{
"name": "Off",
"key": "off",
"variables": [
{
"key": "test_variable",
"type": "STRING",
"value": "test"
}
]
}
],
"attributionWindow": 604800000,
"archived": false
}
'
{
"id": 13134,
"siteCode": "pzllysfw2f",
"featureKey": "test_feature_flag_post",
"name": "test_feature_flag_post",
"description": "",
"tags": [],
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
],
"variations": [
{
"name": "On",
"key": "on",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
},
{
"name": "Off",
"key": "off",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
}
],
"secondaryGoalIds": [],
"attributionWindow": 604800000,
"health": "HEALTHY",
"dateCreated": "2025-12-17T10:42:14",
"dateModified": "2025-12-17T10:42:14",
"dateContentModified": "2025-12-17T10:42:14",
"environmentConfigurations": [
{
"environmentKey": "production",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "staging",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "development",
"featureEnabled": true,
"defaultVariationKey": "on",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
}
],
"createdById": 34255,
"archived": false
}
2. フィーチャーフラグを更新する
次の構成でdevelopment 環境に TARGETED_DELIVERY ロールアウトルールを追加するために、フィーチャーフラグを更新します。


PATCH https://api.kameleoon.com/feature-flags/:siteCode/:featureKey
curl -L -X PATCH 'https://api.kameleoon.com/feature-flags/pzllysfw2f/test_feature_flag_post' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{
"environmentConfigurations": [
{
"environmentKey": "development",
"featureEnabled": true,
"defaultVariationKey": "on",
"rolloutRules": [
{
"name": "test rollout rule",
"type": "TARGETED_DELIVERY",
"variations": [],
"trafficAllocations": [
{
"variationKey": "on",
"exposition": 59.0
}
],
"reallocationTimestamp": null,
"release": {
"releaseFrom": "2025-12-11T11:58:01",
"releaseTo": "2025-12-13T11:58:01",
"timeZone": "Europe/Paris"
},
"state": "ACTIVE",
"rollbackConditions": [
{
"target": "RULE",
"criteria": "CONVERSION_RATE",
"comparisonOperator": "GREATER_THAN",
"matchValue": 20.0,
"goalId": 400899,
"visitors": 2,
"recipients": []
}
],
"segmentId": 403694,
"exposition": 59,
"variationKey": "on"
}
],
"integrations": {
"deliveryRules": [],
"experimentRules": []
}
}
]
}'
{
"id": 13134,
"siteCode": "pzllysfw2f",
"featureKey": "test_feature_flag_post",
"name": "test_feature_flag_post",
"description": "",
"tags": [],
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
],
"variations": [
{
"name": "On",
"key": "on",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
},
{
"name": "Off",
"key": "off",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
}
],
"secondaryGoalIds": [],
"attributionWindow": 604800000,
"health": "HEALTHY",
"dateCreated": "2025-12-17T10:42:14",
"dateModified": "2025-12-17T10:42:14",
"dateContentModified": "2025-12-17T10:42:14",
"environmentConfigurations": [
{
"environmentKey": "production",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "staging",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "development",
"featureEnabled": true,
"defaultVariationKey": "on",
"rolloutRules": [
{
"id": 20557,
"name": "test rollout rule",
"type": "TARGETED_DELIVERY",
"experimentId": 354972,
"variations": [],
"trafficAllocations": [{ "variationKey": "on", "exposition": 59.0 }],
"reallocationTimestamp": null,
"release": {
"releaseFrom": "2025-12-11T11:58:01",
"releaseTo": "2025-12-13T11:58:01",
"timeZone": "Europe/Paris"
},
"status": "PAUSED",
"state": "ACTIVE",
"rollbackConditions": [
{
"id": 648,
"target": "RULE",
"criteria": "CONVERSION_RATE",
"comparisonOperator": "GREATER_THAN",
"matchValue": 20.0,
"goalId": 400899,
"visitors": 2,
"recipients": []
}
],
"segmentId": 403694,
"exposition": 59,
"variationKey": "on"
}
],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
}
],
"createdById": 34255,
"archived": false
}
3. ロールアウトルールを更新する
最後に、ロールアウトルール ID20557 の rollbackConditions の matchValue を 25 に変更します。
エンドポイント:
PATCH https://api.kameleoon.com/feature-flags/rules/:ruleId
curl -L -X PATCH 'https://api.kameleoon.com/rules/20557' \
-H 'Content-Type: application/json' \
-H 'Accept: */*' \
-H 'Authorization: Bearer <ACCESS_TOKEN>' \
--data-raw '{
"rollbackConditions": [
{
"id": 648,
"target": "RULE",
"criteria": "CONVERSION_RATE",
"comparisonOperator": "GREATER_THAN",
"matchValue": 25.0,
"goalId": 400899,
"visitors": 2,
"recipients": []
}
]
}'
{
"id": 13134,
"siteCode": "pzllysfw2f",
"featureKey": "test_feature_flag_post",
"name": "test_feature_flag_post",
"description": "",
"tags": [],
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
],
"variations": [
{
"name": "On",
"key": "on",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
},
{
"name": "Off",
"key": "off",
"variables": [
{ "key": "test_variable", "type": "STRING", "value": "test" }
]
}
],
"secondaryGoalIds": [],
"attributionWindow": 604800000,
"health": "HEALTHY",
"dateCreated": "2025-12-17T10:42:14",
"dateModified": "2025-12-17T10:42:14",
"dateContentModified": "2025-12-17T10:42:14",
"environmentConfigurations": [
{
"environmentKey": "production",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "staging",
"featureEnabled": false,
"defaultVariationKey": "off",
"rolloutRules": [],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
},
{
"environmentKey": "development",
"featureEnabled": true,
"defaultVariationKey": "on",
"rolloutRules": [
{
"id": 20557,
"name": "test rollout rule",
"type": "TARGETED_DELIVERY",
"experimentId": 354972,
"variations": [],
"trafficAllocations": [{ "variationKey": "on", "exposition": 59.0 }],
"reallocationTimestamp": null,
"release": {
"releaseFrom": "2025-12-11T11:58:01",
"releaseTo": "2025-12-13T11:58:01",
"timeZone": "Europe/Paris"
},
"status": "PAUSED",
"state": "ACTIVE",
"rollbackConditions": [
{
"id": 648,
"target": "RULE",
"criteria": "CONVERSION_RATE",
"comparisonOperator": "GREATER_THAN",
"matchValue": 25.0,
"goalId": 400899,
"visitors": 2,
"recipients": []
}
],
"segmentId": 403694,
"exposition": 59,
"variationKey": "on"
}
],
"integrations": { "deliveryRules": [], "experimentRules": [] },
"dateModified": "2025-12-17T10:42:14"
}
],
"createdById": 34255,
"archived": false
}