Documentation Index
Fetch the complete documentation index at: https://confidence.spotify.com/llms.txt
Use this file to discover all available pages before exploring further.
Report when your application uses flags by applying them.
See Apply a Flag in the reference for details on why applies matter, when to apply, batching strategies, and best practices.
Before You Begin
Before applying flags, you must:
- Resolve flags to get variant values and a resolve token
- Save the
resolveToken from the resolve response
- Use the flag value in your application
Apply a Single Flag
Report that a flag was applied:
curl -X POST "https://flags.confidence.dev/v1/flags:apply" \
-H "Content-Type: application/json" \
-d '{
"clientSecret": "YOUR_CLIENT_SECRET",
"resolveToken": "<resolve token from resolve call>",
"flags": [
{
"flag": "flags/image-size",
"appliedTime": "2023-03-06T19:45:07.436Z",
"sentTime": "2023-03-06T19:45:08.002Z"
}
]
}'
Apply Multiple Flags
Batch multiple applies together (recommended):
curl -X POST "https://flags.confidence.dev/v1/flags:apply" \
-H "Content-Type: application/json" \
-d '{
"clientSecret": "YOUR_CLIENT_SECRET",
"resolveToken": "<resolve token>",
"flags": [
{
"flag": "flags/image-size",
"appliedTime": "2023-03-06T19:45:07.436Z",
"sentTime": "2023-03-06T19:45:08.002Z"
},
{
"flag": "flags/button-colors",
"appliedTime": "2023-03-06T19:45:09.123Z",
"sentTime": "2023-03-06T19:45:10.002Z"
}
]
}'
Complete Workflow
Here’s the full workflow from resolve to apply:
# Step 1: Resolve flags
RESPONSE=$(curl -X POST "https://flags.confidence.dev/v1/flags:resolve" \
-H "Content-Type: application/json" \
-d '{
"clientSecret": "YOUR_CLIENT_SECRET",
"evaluationContext": {
"user_id": "user123"
}
}')
# Step 2: Extract resolve token
RESOLVE_TOKEN=$(echo $RESPONSE | jq -r '.resolveToken')
# Step 3: Use flag values in your application
# (Your application code here)
# Step 4: Report that flags were applied
curl -X POST "https://flags.confidence.dev/v1/flags:apply" \
-H "Content-Type: application/json" \
-d "{
\"clientSecret\": \"YOUR_CLIENT_SECRET\",
\"resolveToken\": \"$RESOLVE_TOKEN\",
\"flags\": [
{
\"flag\": \"flags/my-flag\",
\"appliedTime\": \"$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")\",
\"sentTime\": \"$(date -u +"%Y-%m-%dT%H:%M:%S.%3NZ")\"
}
]
}"
Next Steps
After applying flags:
- Monitor flag applied data in your data warehouse
- Use the data to analyze experiments
- Review apply patterns to optimize flag usage