OFREP API
Use Flipswitch with any language via the OpenFeature Remote Evaluation Protocol
Flipswitch natively implements the OpenFeature Remote Evaluation Protocol (OFREP). You can call the OFREP endpoints directly via HTTP, useful for scripting, testing, or any language.
Single Flag Evaluation
curl -X POST https://api.flipswitch.io/ofrep/v1/evaluate/flags/dark-mode \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"context": {
"targetingKey": "user-123",
"email": "user@example.com"
}
}'Response:
{
"key": "dark-mode",
"value": true,
"variant": "enabled",
"reason": "TARGETING_MATCH"
}Bulk Evaluation
curl -X POST https://api.flipswitch.io/ofrep/v1/evaluate/flags \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"context": {"targetingKey": "user-123"}}'Response:
{
"flags": [
{"key": "dark-mode", "value": true, "variant": "enabled", "reason": "TARGETING_MATCH"},
{"key": "max-items", "value": 50, "variant": "high", "reason": "DEFAULT"}
]
}ETag Support
Use ETags for efficient caching:
# First request returns ETag header
curl -X POST https://api.flipswitch.io/ofrep/v1/evaluate/flags \
-H "X-API-Key: YOUR_API_KEY" \
-d '{"context": {"targetingKey": "user-123"}}'
# Response includes: ETag: "abc123"
# Subsequent requests with If-None-Match
curl -X POST https://api.flipswitch.io/ofrep/v1/evaluate/flags \
-H "X-API-Key: YOUR_API_KEY" \
-H 'If-None-Match: "abc123"' \
-d '{"context": {"targetingKey": "user-123"}}'
# Returns 304 Not Modified if unchangedFor the full protocol specification, see the OFREP spec on GitHub.