Skip to content

FeatureFlag

A FeatureFlag toggles a feature of an application: its id is the flag's key, yours (for example new-checkout), and environments says, per environment, whether it is enabled, for what percentage of users, and for which user keys always. Apps evaluate it with the documented rule, so every client gives a user the same answer; GraphQL's featureFlagsFor evaluates it too. See Configuration and feature flags.

JSON Schema ยท ABAC object type FeatureFlag

Example

Create one with POST /featureflags:

{
  "id": "new-checkout",
  "application": "web-shop",
  "owner": "checkout team",
  "expires": "2027-06-30",
  "environments": {
    "staging": {
      "enabled": true
    },
    "production": {
      "enabled": true,
      "rolloutPercentage": 10,
      "allow": [
        "user-1"
      ]
    }
  }
}

Fields

Required: id, application.

Field Type Required Description
at_type FeatureFlag JSON-LD @type, the object's type name.
at_id URL The object's ObjectsGrid URL, https://apis.objectsgrid.com/<path>/<id>, its JSON-LD @id: what References to it hold. Assigned by ObjectsGrid.
id string Yes The FeatureFlag's id, chosen by you
identifier string The object's id, as Schema.org identifier. Assigned by ObjectsGrid.
url URL The object's own URL, https://apis.objectsgrid.com/<path>/<id>. Assigned by ObjectsGrid.
application string Yes The application the flag belongs to, e.g. web-shop
description string What the flag switches
environments object Per environment name (e.g. production): whether it is enabled, for what percentage of users, and for which user keys always
defaultEnabled boolean Whether the flag is on in an environment it doesn't name; false when not given
owner string Who to ask about the flag
expires date When the flag should be removed
tags list of Tag Tags your ABAC policy decides on. Created empty when not sent, kept by a PUT that leaves them out, cleared by null or [].
meta ObjectMeta Read-only metadata: version, type, creation and last update.

REST API

Base URL https://apis.objectsgrid.com. Every request sends the X-ObjectsGrid-AccessPoint and Authorization: Bearer <access token> headers; see the REST API guide.

Operation Request
Create POST /featureflags
List and search GET /featureflags
Create up to 100 at once POST /featureflags/batch
Retrieve GET /featureflags/{id}
Replace PUT /featureflags/{id}
Update some fields PATCH /featureflags/{id}
Delete DELETE /featureflags/{id}

FeatureFlag objects have no JSON-LD document: asked for one (Accept: application/ld+json), GET answers 406.

The OpenAPI contract, with every parameter and response: FeatureFlags (JSON).

GraphQL

Endpoint POST https://apis.objectsgrid.com/graphql; see the GraphQL guide.

Operation Field
Query featureFlag(id: ID!, version: String): FeatureFlag
Query featureFlags(where: FeatureFlagWhereInput, orderBy: [FeatureFlagOrderByInput!], first: Int, after: String): FeatureFlagConnection!
Query featureFlagsGroupBy(by: [FeatureFlagGroupByField!]!, where: FeatureFlagWhereInput, having: FeatureFlagHavingInput, orderBy: [FeatureFlagGroupByOrderByInput!], first: Int, after: String): FeatureFlagGroupByConnection!
Mutation createFeatureFlag(input: CreateFeatureFlagInput!): FeatureFlag!
Mutation updateFeatureFlag(input: UpdateFeatureFlagInput!, expectedVersion: String): FeatureFlag!
Mutation deleteFeatureFlag(id: ID!, expectedVersion: String): Boolean!

Webhook events

Subscribe to these events in your webhook configuration to be called when a FeatureFlag changes:

FeatureFlagCreated, FeatureFlagUpdated, FeatureFlagPatched, FeatureFlagDeleted.