REST API
Programmatic access to Gatepost.
Authentication
Include your API key in the Authorization header:
Authorization: Bearer gp_live_xxxGet your API key from the Dashboard → Settings → API Keys.
Base URL
https://api.gatepost.dev/v1Endpoints
Evaluate a flag
GET /flags/:flagKeyQuery parameters:
| Parameter | Type | Description |
|---|---|---|
environment | string | Environment name (default: "production") |
attributes | JSON | User attributes as JSON string |
Example:
bash
curl "https://api.gatepost.dev/v1/flags/new-checkout?environment=production" \
-H "Authorization: Bearer gp_live_xxx"Response:
json
{
"key": "new-checkout",
"type": "boolean",
"value": true,
"reason": "targeting"
}Get all flags
GET /projects/:projectId/flagsResponse:
json
[
{
"id": "xxx",
"key": "new-checkout",
"name": "New Checkout",
"type": "boolean",
"enabled": true
}
]Create a flag
POST /projects/:projectId/flagsRequest body:
json
{
"key": "new-feature",
"name": "New Feature",
"type": "boolean",
"description": "Description of the flag"
}Update a flag
PATCH /flags/:flagIdGet segments
GET /projects/:projectId/segmentsCreate segment
POST /projects/:projectId/segmentsRequest body:
json
{
"key": "premium-users",
"name": "Premium Users",
"rules": [
{ "type": "attribute", "attribute": "plan", "operator": "equals", "value": "premium" }
]
}Error responses
| Status | Description |
|---|---|
| 400 | Invalid request |
| 401 | Invalid or missing API key |
| 403 | No access to this resource |
| 404 | Flag not found |
| 429 | Rate limit exceeded |