Flags & Types
Gatepost supports four flag types for different use cases.
Boolean
The most common type. Use for simple on/off features.
typescript
const enabled = await client.getBooleanValue("new-checkout", false);String
Use for text values like themes, labels, or configuration strings.
typescript
const theme = await client.getStringValue("theme", "light");
// Example values: "light", "dark", "auto"Number
Use for numeric thresholds or limits.
typescript
const maxRetries = await client.getNumberValue("max-retries", 3);
// Example values: 0, 1, 5, 10JSON
Use for complex configuration objects.
typescript
const config = await client.getObjectValue("feature-flags", {});
// Example: { "enabled": true, "options": { "timeout": 5000 } }Multi-variant flags
For string and number types, you can use variants instead of simple defaults:
typescript
// Returns one of "a", "b", or "c" based on targeting rules
const variant = await client.getStringValue("experiment-group", "a");Creating flags
Create flags via the dashboard or API:
bash
curl -X POST https://api.gatepost.dev/v1/flags \
-H "Authorization: Bearer gp_live_xxx" \
-H "Content-Type: application/json" \
-d '{
"key": "new-checkout",
"name": "New Checkout Flow",
"type": "boolean"
}'