Skip to content

REST API

Programmatic access to Gatepost.

Authentication

Include your API key in the Authorization header:

Authorization: Bearer gp_live_xxx

Get your API key from the Dashboard → Settings → API Keys.

Base URL

https://api.gatepost.dev/v1

Endpoints

Evaluate a flag

GET /flags/:flagKey

Query parameters:

ParameterTypeDescription
environmentstringEnvironment name (default: "production")
attributesJSONUser 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/flags

Response:

json
[
  {
    "id": "xxx",
    "key": "new-checkout",
    "name": "New Checkout",
    "type": "boolean",
    "enabled": true
  }
]

Create a flag

POST /projects/:projectId/flags

Request body:

json
{
  "key": "new-feature",
  "name": "New Feature",
  "type": "boolean",
  "description": "Description of the flag"
}

Update a flag

PATCH /flags/:flagId

Get segments

GET /projects/:projectId/segments

Create segment

POST /projects/:projectId/segments

Request body:

json
{
  "key": "premium-users",
  "name": "Premium Users",
  "rules": [
    { "type": "attribute", "attribute": "plan", "operator": "equals", "value": "premium" }
  ]
}

Error responses

StatusDescription
400Invalid request
401Invalid or missing API key
403No access to this resource
404Flag not found
429Rate limit exceeded

OpenFeature compatible feature flags