Docs

Retrieve a flag

This endpoint retrieves a specific feature flag and returns whether it's enabled or not for a given user

HTTP Request

GET https://api.hipflag.com/v1/flags/{id}

URL Parameters

Parameter Description
id Feature flag ID
user_id User ID

Responses

Code Description
200 Feature flag found
401 Unauthorized
404 Feature flag could not be found
429 Quota limit reached

Examples

Is beta_header enabled for user ID 123?

For example: Is beta header enabled for user with ID 123?

$curl 'https://api.hipflag.com/v1/flags/beta_header?user_id=123' -H 'X-Auth-Public: API_KEY'
{ "flag": { "active": true, "name": "beta_header" } }

Update a flag

This endpoint updates a specific feature flag

HTTP Request

PUT https://api.hipflag.com/v1/flags/{id}

URL Parameters

Parameter Description
id Feature flag ID

Body Parameters

Parameter Type Description
flag[enabled] boolean Feature flag status. A flag can be turned on setting this value to `true`
flag[rollout] integer Feature flag rollout percentage. If the flag is enabled, this is the percentage of users that will have the feature flag enabled. The value must be within 0 and 100. 100 means open to everyone

Responses

Code Description
200 Feature flag updated
400 Bad request
401 Unauthorized
404 Feature flag could not be found
404 Feature flag could not be updated
429 Quota limit reached

Examples

Enable beta_header for the 70% of the users

$curl -XPUT 'https://api.hipflag.com/v1/flags/beta_header' -H 'X-Auth-Secret: API_KEY' -d '{"flag":{"enabled": true, "rollout": 70}}'
{ "flag": { "active": true, "name": "beta_header" } }