Skip to content
LogoLogo

Feature schema

See Management API schema for every domain, the endpoint and authentication.

Queries

feature

Reads a feature flag by its ID and workspace. Scope: ORGANIZATION_WORKSPACE_READ.

feature(input: FeatureInput!): Feature @auth

features

Lists the feature flags in a workspace. search matches a case-insensitive substring of the name; enabled keeps only the flags that are on (true) or off (false); sortKey and reverse set the order. Scope: ORGANIZATION_WORKSPACE_READ.

features(workspaceId: ID!, first: Int, after: String, last: Int, before: String, search: String, enabled: Boolean, sortKey: FeatureSortKeys = NAME, reverse: Boolean = false): FeatureConnection! @auth

Mutations

featureCreate

Creates a feature flag in a workspace. Scope: ORGANIZATION_WORKSPACE_UPDATE.

featureCreate(input: FeatureCreateInput!): FeatureCreatePayload! @auth

featureUpdate

Updates a feature flag. Scope: ORGANIZATION_WORKSPACE_UPDATE.

featureUpdate(input: FeatureUpdateInput!): FeatureUpdatePayload! @auth

featureDelete

Deletes a feature flag. Scope: ORGANIZATION_WORKSPACE_UPDATE.

featureDelete(input: FeatureDeleteInput!): FeatureDeletePayload! @auth

Types

FeatureValueType

"""What a feature flag's arms serve. Fixed when the feature is created."""
enum FeatureValueType {
  """
  Two arms. The visitor's site receives `true` or `false`, split by `weight`.
  """
  BOOLEAN
  """
  Author-defined arms. The visitor's site receives a string, or `false` in control.
  """
  TEXT
}

FeatureVariant

"""
One arm of a feature flag. Every feature has a control arm keyed `false` that serves `false`; a
`BOOLEAN` feature has exactly one more, keyed `true` and derived from `weight`.
"""
type FeatureVariant {
  """
  The stable identifier of the arm, unique within the feature. The visitor's browser, reports and
  preview overrides name the arm by it, and allocation orders arms by it, so `name`, `value` and
  `weight` change without moving a visitor between arms. `true` and `false` are reserved.
  """
  key: String!
  """The label of the arm in the dashboard and in reports."""
  name: String!
  """
  What the visitor's site receives: a string, or `false` for the control arm.
  """
  value: JSON!
  """
  The arm's share of traffic relative to the other arms, as a whole number: `1, 1, 1` and
  `10, 10, 10` are the same even split. Stored reduced by the greatest common divisor.
  """
  weight: Int!
}

Feature

"""
A feature flag: a control that decides which visitors see a change, for an A/B test or a staged release.
"""
type Feature {
  """The ID of the feature."""
  id: ID!
  """
  The stable identifier of the feature, unique within its workspace, such as `homepage-banner-v2`.
  """
  key: String!
  """The name of the feature."""
  name: String!
  """A description of the feature. Null when none is set."""
  description: String
  """
  Whether the feature is on. When false, it is off for every visitor, whatever `weight` says.
  """
  enabled: Boolean!
  """
  The percentage of visitors outside the control arm, from 0 to 100. A `BOOLEAN` feature allocates
  from it; a `TEXT` feature derives it from the arm weights.
  """
  weight: Int!
  """What the feature's arms serve."""
  valueType: FeatureValueType!
  """
  The arms of the feature: at least two, with the control arm keyed `false` last. A `BOOLEAN`
  feature's pair is derived from `weight`, so every value type has the same shape.
  """
  variants: [FeatureVariant!]!
  """
  A number that forms part of the SDK cache key. It increases only when `featureUpdate` sets `incrementVersion`.
  """
  version: Int!
  """The workspace the feature belongs to."""
  workspace: Workspace!
  """When the feature was created."""
  createdAt: DateTime!
  """When the feature last changed."""
  updatedAt: DateTime!
}

FeatureEdge

"""A feature in a page of results."""
type FeatureEdge {
  """The cursor of this edge."""
  cursor: String!
  """The feature."""
  node: Feature!
}

FeatureConnection

"""A page of features."""
type FeatureConnection {
  """The edges in this page."""
  edges: [FeatureEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The number of features across all pages, ignoring `search`."""
  totalCount: Int!
}

FeatureInput

"""The input of `feature`."""
input FeatureInput {
  """The ID of the feature."""
  id: ID!
  """The ID of the workspace the feature belongs to."""
  workspaceId: ID!
}

FeatureVariantInput

"""
One arm of a feature flag, as input. Submit the control arm keyed `false` with value `false`, last.
"""
input FeatureVariantInput {
  """The stable identifier of the arm. Derived from `name` when omitted."""
  key: String
  """The label of the arm."""
  name: String!
  """
  What the visitor's site receives: a string, or `false` for the control arm.
  """
  value: JSON!
  """
  The arm's share of traffic relative to the other arms. Reduced by the greatest common divisor on save.
  """
  weight: Int!
}

FeatureCreateInput

"""The input of `featureCreate`."""
input FeatureCreateInput {
  """The ID of the workspace to create the feature in."""
  workspaceId: ID!
  """Ignored. The feature belongs to the workspace's organization."""
  organizationId: ID!
  """The name of the feature. At least 3 characters."""
  name: String!
  """
  The stable identifier of the feature, unique within the workspace: lowercase letters, digits and
  hyphens. Derived from `name` when omitted. It cannot change later.
  """
  key: String
  """A description of the feature. At most 500 characters."""
  description: String
  """Whether the feature is on. Defaults to `false`."""
  enabled: Boolean
  """
  The percentage of visitors outside the control arm, from 0 to 100. Defaults to `0`. Rejected for
  a `TEXT` feature, which derives it from `variants`.
  """
  weight: Int
  """
  What the feature's arms serve. Defaults to `BOOLEAN`. It cannot change later.
  """
  valueType: FeatureValueType
  """
  The full set of arms, control last. Required for a `TEXT` feature and rejected for a `BOOLEAN` one.
  """
  variants: [FeatureVariantInput!]
}

FeatureCreatePayload

"""The result of `featureCreate`."""
type FeatureCreatePayload {
  """The created feature."""
  feature: Feature
}

FeatureUpdateInput

"""The input of `featureUpdate`. Omit a field to keep its value."""
input FeatureUpdateInput {
  """The ID of the feature."""
  id: ID!
  """The ID of the workspace the feature belongs to."""
  workspaceId: ID!
  """The name of the feature. At least 3 characters."""
  name: String
  """A description of the feature. At most 500 characters."""
  description: String
  """Whether the feature is on."""
  enabled: Boolean
  """
  The percentage of visitors outside the control arm, from 0 to 100. Rejected for a `TEXT`
  feature, which derives it from `variants`.
  """
  weight: Int
  """
  The full set of arms, control last. Replaces every arm. Rejected for a `BOOLEAN` feature.
  """
  variants: [FeatureVariantInput!]
  """Whether to increase `version`. Defaults to `false`."""
  incrementVersion: Boolean
}

FeatureUpdatePayload

"""The result of `featureUpdate`."""
type FeatureUpdatePayload {
  """The updated feature."""
  feature: Feature
}

FeatureDeleteInput

"""The input of `featureDelete`."""
input FeatureDeleteInput {
  """The ID of the feature."""
  id: ID!
  """The ID of the workspace the feature belongs to."""
  workspaceId: ID!
}

FeatureDeletePayload

"""The result of `featureDelete`."""
type FeatureDeletePayload {
  """The ID of the deleted feature."""
  deletedFeatureId: ID
}

FeatureSortKeys

"""The orders `features` can sort by. `reverse: true` flips each."""
enum FeatureSortKeys {
  """By name, A to Z."""
  NAME
  """By creation time, oldest first."""
  CREATED_AT
  """By last change, oldest first."""
  UPDATED_AT
  """By status, enabled first, then by name."""
  ENABLED
}