Complete developer reference for @vaakflags/sdk and the management REST API. Evaluate flags with sub-millisecond local caching and configure real-time SSE streams.
Universal, zero-dependency SDK for Node.js, Next.js, and client applications.
import { VaakFlagsClient } from '@vaakflags/sdk';
const flags = new VaakFlagsClient({
baseUrl: 'https://flags.vaagatech.com',
environment: 'production', // Dynamic: 'prod', 'staging', 'canary', 'uat', etc.
sdkKey: process.env.VAAKFLAGS_SDK_KEY,
pollingIntervalMs: 30000, // Background refresh fallback
enableRealtimeSSE: true // Instant Server-Sent Events updates
});
await flags.initialize();
// In-memory instant evaluation (<1ms)
const isAiCheckoutEnabled = flags.evaluate('ai-smart-checkout', {
userId: 'usr_8921a',
email: 'director@enterprise.com',
country: 'IN',
tier: 'enterprise',
betaOptIn: true
});
if (isAiCheckoutEnabled) {
renderAiCheckoutPipeline();
} else {
renderStandardCheckout();
}
// Subscribe to real-time flag changes
flags.on('flag-updated', (flagKey, newValue) => {
console.log(`Flag ${flagKey} updated in real-time to:`, newValue);
});
Administrative HTTP endpoints for CI/CD pipelines, control dashboards, and external microservices.
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/v1/flags |
List all feature flags and their current statuses across environments. |
POST |
/api/v1/flags |
Create a new feature flag with rules, variants, and rollouts. |
PUT |
/api/v1/flags/:key/toggle |
Instantly toggle a flag state in a target environment. |
PUT |
/api/v1/flags/:key/rollout |
Update percentage rollout or targeting conditions. |
POST |
/api/v1/evaluate |
Server-side evaluation endpoint for lightweight clients without local rules. |
GET |
/api/v1/stream |
Server-Sent Events (SSE) streaming endpoint for real-time rule synchronization. |
GET |
/api/v1/audit?project= |
Fetch immutable audit records and historical rollback points. |
GET |
/api/v1/flags?project=&env=&search=&folder=&accessLevel=&status=&tag= |
Faceted search by id, key, name, description, tags, folder, access level and status. |
GET |
/api/v1/flags/tree?project=&env= |
Hierarchical folder tree (folderPath) for explorer views. |
POST |
/api/v1/flags/process-schedules |
Execute pending scheduled toggles (optional simulatedNow for testing). |
GET |
/api/v1/flags/:key/circuit-breaker?project=&env= |
Circuit breaker state, failure count and threshold. |
POST |
/api/v1/flags/:key/circuit-breaker/failure |
Record a failure; trips the breaker automatically at the threshold. |
POST |
/api/v1/flags/:key/circuit-breaker/override |
Manual override: FORCE_OPEN, FORCE_CLOSED or RESET. |
POST/PUT /api/v1/flags with accessLevel: "public" returns 400 if any rule references user-context attributes or segment overrides.