Evaluate Flags
The evaluation context containing user and/or organisation attributes. Targeting rules match against this context.
Request
Response
200 OK
Context Shapes
Single-kind context — use when you only need user attributes:Percentage rollouts require a
key field in the context (typically user.key). Without it, the evaluator cannot deterministically assign users to variations.Authentication
The evaluation endpoint uses your SDK key (not a JWT or admin key). SDK keys start withff_ and are scoped to a specific project and environment.
Pass the key using the x-api-key header:
Error Responses
| Status | Meaning | Common Cause |
|---|---|---|
400 | Bad Request | Malformed JSON or missing required fields |
401 | Unauthorised | Invalid, expired, or revoked SDK key |
429 | Too Many Requests | Rate limit exceeded (check X-RateLimit-Remaining header) |
500 | Internal Server Error | Server-side issue — retry with backoff |
Error response body
Rate Limiting
The evaluation endpoint returns rate limit headers:| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests per window |
X-RateLimit-Remaining | Requests remaining in current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
WebSocket Connection
For real-time flag updates without polling, connect via WebSocket instead of HTTP:WebSocket Benefits
- Instant updates — Flag changes pushed immediately (no cache delay)
- Lower latency — Persistent connection eliminates handshake overhead
- Reduced bandwidth — Only changed flags are sent
- Automatic reconnection — Built-in connection management
HTTP Long-Polling Fallback
If WebSocket isn’t available (firewall restrictions, legacy browsers), the SDK automatically falls back to HTTP long-polling:Caching Behaviour
The server caches flag configuration in Redis with a 10-second TTL. This means:- Flag changes in the dashboard are reflected within 10 seconds on REST endpoint
- WebSocket connections receive changes instantly (no cache delay)
- Under high load, most requests are served from cache without hitting the database
Testing with curl
Testing with the Flagmint SDK Tester
For visual testing without writing code, use the Flagmint SDK Tester — a standalone testing tool built specifically for QA and debugging.What is the SDK Tester?
The SDK Tester connects directly to your Flagmint API using the raw wire protocol (WebSocket or HTTP long-polling). It doesn’t use any Flagmint SDK — this is intentional, so you’re testing the server contract, not the SDK’s interpretation of it.Key Features
- 🔌 Dual Transport Support — Switch between WebSocket and HTTP long-polling
- 🎯 Visual Context Builder — Add/remove context key-value pairs via UI
- 🚩 Live Flag Display — See all flags with real-time updates
- 📡 Protocol Logging — View raw WebSocket messages and connection events
- ⚡ Context Presets — Quick setups for common scenarios (simple user, multi-context, empty)
- 📊 Change History — Track flag value changes over time
Quick Start
Basic Workflow
- Configure Connection — Enter your API URL and SDK key, choose transport (WebSocket or long-polling)
- Set Up Context — Use a preset or manually add context fields (e.g.,
kind: user,key: test-user-123) - Connect & Test — Click “Connect” and “Send Context” to evaluate flags
- Verify Updates — Change a flag in the dashboard and watch it update instantly in the tester
QA Testing Checklist
- ✅ Flag evaluates with correct default value
- ✅ Flag respects user targeting rules
- ✅ Flag respects multi-context targeting
- ✅ Flag updates in real-time when changed in dashboard
- ✅ WebSocket connection is stable (no disconnects)
- ✅ Long-polling fallback works correctly
- ✅ Empty context returns expected defaults
- ✅ Custom context attributes are evaluated correctly
Next Steps
Authentication
SDK keys vs admin keys, scoping, and rotation.
React SDK
Use the SDK instead of raw API calls for caching, real-time updates, and offline support.