Supported evaluation protocols — REST, gRPC, Connect-RPC, OFREP, SSE
Protocols
Flaggr supports multiple evaluation protocols to fit any architecture. The examples below all evaluate the same flag (checkout-v2 for user-123) so you can compare protocols side by side.
REST API
The standard HTTP/JSON API for flag evaluation.
Evaluate a Flag
curl -s -X POST https://flaggr.dev/api/flags/evaluate \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"flagKey": "checkout-v2",
"serviceId": "web-app",
"environment": "production",
"context": {
"targetingKey": "user-123",
"email": "alice@example.com"
},
"defaultValue": false
}' | jqResponse:
{
"flagKey": "checkout-v2",
"value": true,
"reason": "TARGETING_MATCH",
"variant": "enabled"
}Connect-RPC
Type-safe RPC protocol with full protobuf support. Ideal for service-to-service communication. Requests use the Connect-Protocol-Version: 1 header.
Evaluate a Flag
curl -s -X POST https://flaggr.dev/flaggr.v1.EvaluationService/EvaluateFlag \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Connect-Protocol-Version: 1" \
-d '{
"flagKey": "checkout-v2",
"serviceId": "web-app",
"context": {
"targetingKey": "user-123",
"email": "alice@example.com"
}
}' | jqgRPC-Web
Binary gRPC protocol for browser environments. Provides streaming support for real-time flag updates.
const client = await createFlaggrClient({
mode: 'grpc-web',
apiUrl: 'https://flaggr.dev',
serviceId: 'my-service',
})Streaming Updates
gRPC-Web supports server-side streaming for real-time flag changes:
const stream = client.streamFlagUpdates({
flagKeys: ['checkout-v2', 'dark-mode'],
})
for await (const update of stream) {
console.log(`Flag ${update.flagKey} changed to ${update.value}`)
}OFREP (OpenFeature Remote Evaluation Protocol)
Standard OpenFeature remote evaluation protocol. Any OFREP-compatible client works with Flaggr without code changes.
Evaluate a Flag
curl -s -X POST https://flaggr.dev/api/ofrep/v1/evaluate/flags/checkout-v2 \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "X-Service-Id: web-app" \
-d '{
"context": {
"targetingKey": "user-123",
"email": "alice@example.com"
}
}' | jqResponse follows the OFREP specification:
{
"key": "checkout-v2",
"value": true,
"reason": "TARGETING_MATCH",
"variant": "enabled",
"metadata": {}
}SSE (Server-Sent Events)
Real-time flag change notifications via Server-Sent Events. The connection stays open and pushes events as flags are toggled.
# SSE streams stay open — press Ctrl-C to stop
curl -N "https://flaggr.dev/api/flags/stream?serviceId=web-app" \
-H "Authorization: Bearer flg_abc123xxxxxxxxxxxx" \
-H "Accept: text/event-stream"Protocol Comparison
| Feature | REST | Connect | gRPC-Web | OFREP | SSE |
|---|---|---|---|---|---|
| Browser support | Yes | Yes | Yes | Yes | Yes |
| Server support | Yes | Yes | No | Yes | No |
| Streaming | No | No | Yes | No | Yes |
| Type safety | No | Yes | Yes | No | No |
| Protobuf | No | Yes | Yes | No | No |
| Standard | Custom | Connect | gRPC | OpenFeature | W3C |