Skip to content
LogoLogo

Condition schema

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

Queries

condition

Reads a condition. Scope: ORGANIZATION_WORKSPACE_READ.

condition(id: ID!, workspaceId: ID!): Condition @auth

conditions

Lists the conditions in a workspace. search matches a case-insensitive substring of the name; sortKey and reverse set the order. Scope: ORGANIZATION_WORKSPACE_READ.

conditions(first: Int, after: String, last: Int, before: String, workspaceId: ID!, search: String, sortKey: ConditionSortKeys = NAME, reverse: Boolean = false): ConditionConnection! @auth

Mutations

conditionCreate

Creates a condition in a workspace. Scope: ORGANIZATION_WORKSPACE_UPDATE.

conditionCreate(input: ConditionCreateInput!): ConditionCreatePayload! @auth

conditionUpdate

Updates a condition. Scope: ORGANIZATION_WORKSPACE_UPDATE.

conditionUpdate(input: ConditionUpdateInput!): ConditionUpdatePayload! @auth

conditionDelete

Deletes a condition. A condition that an experience or another condition references is not deleted, and comes back as an IN_USE user error. Scope: ORGANIZATION_WORKSPACE_UPDATE.

conditionDelete(input: ConditionDeleteInput!): ConditionDeletePayload! @auth

Types

Condition

"""
A rule that decides whether a visitor sees something, or which branch a flow takes.
"""
type Condition {
  """The ID of the condition."""
  id: ID!
  """The name of the condition."""
  name: String!
  """The stable identifier of the condition, unique within its workspace."""
  key: String!
  """The rule, as a JSON Logic expression (https://jsonlogic.com)."""
  logic: JSON!
  """When the condition was created."""
  createdAt: DateTime!
  """When the condition last changed."""
  updatedAt: DateTime!
  """The workspace the condition belongs to."""
  workspace: Workspace!
  """The ID of the workspace the condition belongs to."""
  workspaceId: ID
}

ConditionConnection

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

ConditionEdge

"""A condition in a page of results."""
type ConditionEdge {
  """The cursor of this edge."""
  cursor: String!
  """The condition."""
  node: Condition!
}

ConditionCreateInput

"""The input of `conditionCreate`."""
input ConditionCreateInput {
  """The ID of the workspace to create the condition in."""
  workspaceId: ID!
  """The name of the condition."""
  name: String!
  """
  The stable identifier of the condition, unique within the workspace. It cannot change later.
  """
  key: String!
  """
  The rule, as a JSON Logic expression in a JSON string. It can call another condition with
  `{ "invoke": [{ "var": "conditions.<key>" }] }`; an unknown key or a cycle is rejected.
  """
  logicString: String!
}

ConditionCreatePayload

"""The result of `conditionCreate`."""
type ConditionCreatePayload {
  """The created condition."""
  condition: Condition
}

ConditionUpdateInput

"""The input of `conditionUpdate`. Omit a field to keep its value."""
input ConditionUpdateInput {
  """The ID of the condition."""
  id: ID!
  """The ID of the workspace the condition belongs to."""
  workspaceId: ID!
  """The name of the condition."""
  name: String
  """
  The rule, as a JSON Logic expression in a JSON string. An unknown condition key or a cycle is rejected.
  """
  logicString: String
}

ConditionUpdatePayload

"""The result of `conditionUpdate`."""
type ConditionUpdatePayload {
  """The updated condition."""
  condition: Condition
}

ConditionDeleteInput

"""The input of `conditionDelete`."""
input ConditionDeleteInput {
  """The ID of the condition."""
  id: ID!
  """The ID of the workspace the condition belongs to."""
  workspaceId: ID!
}

ConditionDeletePayload

"""The result of `conditionDelete`."""
type ConditionDeletePayload {
  """The ID of the deleted condition. Null when `userErrors` is not empty."""
  deletedConditionId: ID
  """The reasons the condition was not deleted. Empty on success."""
  userErrors: [ConditionDeleteUserError!]!
}

ConditionDeleteUserErrorCode

"""The reasons `conditionDelete` refuses a delete."""
enum ConditionDeleteUserErrorCode {
  """An experience or another condition references the condition."""
  IN_USE
}

ConditionDeleteUserError

"""A reason `conditionDelete` did not delete a condition."""
type ConditionDeleteUserError {
  """
  The path to the input field at fault. Null when no single field is at fault.
  """
  field: [String!]
  """A message to show the user."""
  message: String!
  """A machine-readable code."""
  code: ConditionDeleteUserErrorCode!
  """
  The experiences that reference the condition. Null unless `code` is `IN_USE`.
  """
  referencingExperiences: [ReferencingExperience!]
}

ConditionSortKeys

"""The orders `conditions` can sort by. `reverse: true` flips each."""
enum ConditionSortKeys {
  """By name, A to Z."""
  NAME
  """By creation time, oldest first."""
  CREATED_AT
  """By last change, oldest first."""
  UPDATED_AT
}