Skip to content
LogoLogo

Field schema

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

Queries

field

Reads a field. Scope: ORGANIZATION_WORKSPACE_READ.

field(id: ID!, workspaceId: ID!): Field @auth

fields

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

fields(
  workspaceId: ID!
  first: Int
  after: String
  last: Int
  before: String
  search: String
  sortKey: FieldSortKeys = NAME
  reverse: Boolean = false
  """
  Only the fields on this step. `totalCount` then counts that step's fields.
  """
  stepId: ID
): FieldConnection! @auth

Mutations

fieldCreate

Creates a field in a workspace. Scope: ORGANIZATION_WORKSPACE_UPDATE.

fieldCreate(input: FieldCreateInput!): FieldCreatePayload! @auth

fieldUpdate

Updates a field. Scope: ORGANIZATION_WORKSPACE_UPDATE.

fieldUpdate(input: FieldUpdateInput!): FieldUpdatePayload! @auth

fieldDelete

Deletes a field. A field that is on a step, or that is the success or failure field of an action, is not deleted, and comes back as an IN_USE user error. Scope: ORGANIZATION_WORKSPACE_UPDATE.

fieldDelete(input: FieldDeleteInput!): FieldDeletePayload! @auth

Types

FieldType

"""The kinds of value a field captures."""
enum FieldType {
  """Text."""
  TEXT
  """A number."""
  NUMBER
  """True or false, as a checkbox or toggle."""
  BOOLEAN
  """A JSON value."""
  OBJECT
}

Field

"""
A data input inside a step, such as a name, an email address or a choice. A field belongs to the
workspace and can sit on more than one step.
"""
type Field {
  """The ID of the field."""
  id: ID!
  """The machine-readable name of the field."""
  name: String!
  """The stable identifier of the field, unique within its workspace."""
  key: String!
  """The label shown next to the input."""
  label: String!
  """The kind of value the field captures."""
  type: FieldType!
  """Whether the field accepts more than one value."""
  multiple: Boolean!
  """Whether the visitor must answer the field."""
  required: Boolean!
  """The validation rules, as JSON. Null when none are set."""
  validation: JSON
  """
  The choices of a field with a fixed set of choices. Null when the field has none.
  """
  options: [FieldOption!]
  """
  A JSON Logic rule that decides whether the field renders. Null when none is set.
  """
  condition: JSON
  """The value the field starts with. Null when none is set."""
  defaultValue: JSON
  """The text shown in the empty input. Null when none is set."""
  placeholder: String
  """A description shown with the label. Null when none is set."""
  description: String
  """A hint shown below the field. Null when none is set."""
  helpText: String
  """Whether the answer is left out of analytics."""
  doNotTrack: Boolean!
  """Whether the SDK keeps the answer out of browser storage."""
  doNotStore: Boolean!
  """The steps the field is on."""
  steps: StepConnection!
  """The workspace the field belongs to."""
  workspace: Workspace!
  """The ID of the workspace the field belongs to."""
  workspaceId: ID!
  """When the field was created."""
  createdAt: DateTime!
  """When the field last changed."""
  updatedAt: DateTime!
}

FieldOption

"""One choice in a field that has a fixed set of choices."""
type FieldOption {
  """The ID of the option."""
  id: ID!
  """The label shown for the option."""
  label: String!
  """A description shown with the label. Null when none is set."""
  description: String
  """The value the field captures when the visitor picks the option."""
  value: JSON!
  """
  A JSON Logic rule that decides whether the option renders. Null when none is set.
  """
  condition: JSON
}

FieldEdge

"""A field in a page of results."""
type FieldEdge {
  """The cursor of this edge."""
  cursor: String!
  """The field."""
  node: Field!
}

FieldConnection

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

FieldCreateInput

"""The input of `fieldCreate`."""
input FieldCreateInput {
  """The ID of the workspace to create the field in."""
  workspaceId: ID!
  """The machine-readable name of the field."""
  name: String!
  """
  The stable identifier of the field, unique within the workspace. It cannot change later.
  """
  key: String!
  """The label shown next to the input."""
  label: String!
  """The kind of value the field captures."""
  type: FieldType!
  """Whether the field accepts more than one value."""
  multiple: Boolean
  """Whether the visitor must answer the field."""
  required: Boolean
  """The validation rules, as a JSON string. Invalid JSON is rejected."""
  validationString: String
  """The value the field starts with."""
  defaultValue: JSON
  """The choices, as a JSON array. An option without an `id` gets one."""
  options: JSON
  """A JSON Logic rule that decides whether the field renders."""
  condition: JSON
  """The text shown in the empty input."""
  placeholder: String
  """A description shown with the label."""
  description: String
  """A hint shown below the field."""
  helpText: String
  """Whether the answer is left out of analytics. Defaults to `true`."""
  doNotTrack: Boolean
  """
  Whether the SDK keeps the answer out of browser storage. Defaults to `true`.
  """
  doNotStore: Boolean
}

FieldCreatePayload

"""The result of `fieldCreate`."""
type FieldCreatePayload {
  """The created field."""
  field: Field
}

FieldUpdateInput

"""
The input of `fieldUpdate`. Omit a field to keep its value. `type` is required.
"""
input FieldUpdateInput {
  """The ID of the field."""
  id: ID!
  """The ID of the workspace the field belongs to."""
  workspaceId: ID!
  """The machine-readable name of the field."""
  name: String
  """The label shown next to the input."""
  label: String
  """
  The kind of value the field captures. Required: send the current type to keep it.
  """
  type: FieldType!
  """Whether the field accepts more than one value."""
  multiple: Boolean
  """Whether the visitor must answer the field."""
  required: Boolean
  """The validation rules, as a JSON string. Invalid JSON is rejected."""
  validationString: String
  """The value the field starts with."""
  defaultValue: JSON
  """
  The choices, as a JSON array. Replaces the current choices; an option without an `id` gets one.
  """
  options: JSON
  """A JSON Logic rule that decides whether the field renders."""
  condition: JSON
  """The text shown in the empty input."""
  placeholder: String
  """A description shown with the label."""
  description: String
  """A hint shown below the field."""
  helpText: String
  """Whether the answer is left out of analytics."""
  doNotTrack: Boolean
  """Whether the SDK keeps the answer out of browser storage."""
  doNotStore: Boolean
}

FieldUpdatePayload

"""The result of `fieldUpdate`."""
type FieldUpdatePayload {
  """The updated field."""
  field: Field
}

FieldDeleteInput

"""The input of `fieldDelete`."""
input FieldDeleteInput {
  """The ID of the field."""
  id: ID!
  """The ID of the workspace the field belongs to."""
  workspaceId: ID!
}

FieldDeletePayload

"""The result of `fieldDelete`."""
type FieldDeletePayload {
  """The ID of the deleted field. Null when `userErrors` is not empty."""
  deletedFieldId: ID
  """The reasons the field was not deleted. Empty on success."""
  userErrors: [FieldDeleteUserError!]!
}

FieldDeleteUserErrorCode

"""The reasons `fieldDelete` refuses a delete."""
enum FieldDeleteUserErrorCode {
  """
  The field is on a step, or is the success or failure field of an action.
  """
  IN_USE
}

FieldDeleteUserError

"""A reason `fieldDelete` did not delete a field."""
type FieldDeleteUserError {
  """
  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: FieldDeleteUserErrorCode!
  """The steps the field is on. Null unless `code` is `IN_USE`."""
  referencingSteps: [ReferencingStep!]
  """
  The actions whose success or failure field the field is. Null unless `code` is `IN_USE`.
  """
  referencingActions: [ReferencingAction!]
}

ReferencingStep

"""A step that a field is on, and so blocks the field's delete."""
type ReferencingStep {
  """The ID of the step."""
  id: ID!
  """The name of the step."""
  name: String!
}

ReferencingAction

"""
An action whose success or failure field a field is, and so blocks the field's delete.
"""
type ReferencingAction {
  """The ID of the action."""
  id: ID!
  """The name of the action."""
  name: String!
}

FieldSortKeys

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