Skip to content
LogoLogo

Workspace schema

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

Queries

workspace

Reads a workspace. Scope: ORGANIZATION_WORKSPACE_READ.

workspace(
  id: ID!
  """Ignored. The workspace's ID identifies its project."""
  projectId: ID!
): Workspace @auth

workspaceExport

Exports a workspace and every entity in it as a JSON bundle that workspaceImport reads. The bundle lists the asset versions its content references; download each file from its downloadUrl. Scope: ORGANIZATION_WORKSPACE_READ.

workspaceExport(input: WorkspaceExportInput!): WorkspaceExportPayload! @auth

Mutations

workspacePublish

Publishes a workspace: makes an immutable version of it and serves that version to visitors. The workspace becomes LIVE, and an archived workspace returns to the default list. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspacePublish(input: WorkspacePublishInput!): WorkspacePublishPayload! @auth

workspaceVersionPublish

Makes a published version the version its project serves. No new version is made and the workspace's draft does not change; the workspace becomes LIVE, and an archived one returns to the default list. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceVersionPublish(input: WorkspaceVersionPublishInput!): WorkspaceVersionPublishPayload! @auth

workspaceCreate

Creates an empty draft workspace in a project. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceCreate(input: WorkspaceCreateInput!): WorkspaceCreatePayload! @auth

workspaceUpdate

Renames a workspace. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceUpdate(input: WorkspaceUpdateInput!): WorkspaceUpdatePayload! @auth

workspaceDuplicate

Copies a workspace and every entity in it, workflows included, into a new draft workspace in the same project. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceDuplicate(input: WorkspaceDuplicateInput!): WorkspaceDuplicatePayload! @auth

workspaceImport

Creates a draft workspace in a project from a bundle that workspaceExport returned. Every entity gets a new ID, and every reference between entities, assets through assetMap included, points at the new IDs. Nothing is created when a userError is returned. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceImport(input: WorkspaceImportInput!): WorkspaceImportPayload! @auth

workspaceArchive

Archives a workspace, which moves it out of the default list. It stays editable. Archiving an archived workspace changes nothing. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceArchive(input: WorkspaceArchiveInput!): WorkspaceArchivePayload! @auth

workspaceUnarchive

Unarchives a workspace, which returns it to DRAFT. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceUnarchive(input: WorkspaceUnarchiveInput!): WorkspaceUnarchivePayload! @auth

workspaceDelete

Deletes a workspace that is not live. Scope: ORGANIZATION_WORKSPACE_UPDATE.

workspaceDelete(input: WorkspaceDeleteInput!): WorkspaceDeletePayload! @auth

Types

WorkspaceStatus

"""
Where a workspace is in its lifecycle. A live workspace cannot be archived or deleted.
"""
enum WorkspaceStatus {
  """Editable, and not served to visitors."""
  DRAFT
  """Published, and owner of the version the project serves."""
  LIVE
  """Out of the default list. `workspaceUnarchive` returns it to `DRAFT`."""
  ARCHIVED
  """
  The copy a publish makes, read through `WorkspaceVersion.snapshotWorkspace` and left out of workspace lists.
  """
  HIDDEN
}

Workspace

"""
One version of a project's configuration: its experiences, feature flags, steps, fields, actions,
conditions, workflows and content. Its connection fields read its current content; publishing it
makes an immutable `WorkspaceVersion`.
"""
type Workspace {
  """The ID of the workspace."""
  id: ID!
  """The workspace's name."""
  name: String!
  """Where the workspace is in its lifecycle."""
  status: WorkspaceStatus!
  """The project the workspace belongs to."""
  project: Project!
  """The ID of the project the workspace belongs to."""
  projectId: ID!
  """The workspace's conditions."""
  conditions(first: Int, after: String, last: Int, before: String): ConditionConnection!
  """The workspace's steps."""
  steps(first: Int, after: String, last: Int, before: String): StepConnection!
  """The workspace's fields."""
  fields(first: Int, after: String, last: Int, before: String): FieldConnection!
  """The workspace's actions."""
  actions(first: Int, after: String, last: Int, before: String): ActionConnection!
  """The workspace's feature flags."""
  features(first: Int, after: String, last: Int, before: String): FeatureConnection!
  """The workspace's experiences, of one type when `type` is set."""
  experiences(type: ExperienceType, first: Int, after: String, last: Int, before: String): ExperienceConnection!
  """The workspace's workflows. `last` and `before` are ignored."""
  workflows(first: Int, after: String, last: Int, before: String): WorkflowConnection!
  """
  The workspace's Content Models, of one category when `category` is set.
  """
  contentModels(category: ContentModelCategory, first: Int, after: String, last: Int, before: String): ContentModelConnection!
  """
  The workspace's Content Blocks, of one category when `category` is set.
  """
  contentBlocks(category: ContentBlockCategory, first: Int, after: String, last: Int, before: String): ContentBlockConnection!
  """
  The workspace's content entries, of one Content Model when `contentModelId` is set.
  """
  contentEntries(contentModelId: ID, first: Int, after: String, last: Int, before: String): ContentEntryConnection!
  """
  The preview token that lets a Delivery API request read the workspace's unpublished content.
  """
  previewToken: String!
  """When the workspace was created."""
  createdAt: DateTime!
  """
  When the version the workspace last made live was published. Null when it has never been published.
  """
  publishedAt: DateTime
  """When an entity in the workspace was last created, changed or deleted."""
  draftChangedAt: DateTime!
  """
  The workspace's most recent version. Null when it has never been published.
  """
  latestVersion: WorkspaceVersion
  """The workspace's versions, newest first."""
  versions(first: Int, after: String, last: Int, before: String): WorkspaceVersionConnection!
}

WorkspaceEdge

"""A workspace in a page of results."""
type WorkspaceEdge {
  """The cursor of this edge."""
  cursor: String!
  """The item."""
  node: Workspace!
}

WorkspaceConnection

"""A page of workspaces."""
type WorkspaceConnection {
  """The edges in this page."""
  edges: [WorkspaceEdge!]!
  """Where this page sits in the list."""
  pageInfo: PageInfo!
  """The number of items across all pages."""
  totalCount: Int!
}

WorkspacePublishInput

"""The input of `workspacePublish`."""
input WorkspacePublishInput {
  """Ignored. The workspace identifies its project."""
  projectId: ID @deprecated(reason: "Derived from workspace; no longer required.")
  """The ID of the workspace to publish."""
  workspaceId: ID!
}

WorkspacePublishPayload

"""The result of `workspacePublish`."""
type WorkspacePublishPayload {
  """
  The published workspace, now `LIVE`. Null when a `userError` was returned.
  """
  workspace: Workspace
  """The problems that stopped the publish. Empty on success."""
  userErrors: [WorkspacePublishUserError!]!
}

WorkspacePublishErrorCode

"""Why `workspacePublish` failed."""
enum WorkspacePublishErrorCode {
  """The workspace or its project does not exist."""
  WORKSPACE_NOT_FOUND
  """The workspace is live and has no unpublished changes."""
  WORKSPACE_ALREADY_LIVE
}

WorkspacePublishUserError

"""A problem that stopped `workspacePublish`."""
type WorkspacePublishUserError {
  """
  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!
  """The error's code."""
  code: WorkspacePublishErrorCode!
}

WorkspaceVersionPublishInput

"""The input of `workspaceVersionPublish`."""
input WorkspaceVersionPublishInput {
  """The ID of the version to serve."""
  workspaceVersionId: ID!
}

WorkspaceVersionPublishPayload

"""The result of `workspaceVersionPublish`."""
type WorkspaceVersionPublishPayload {
  """
  The workspace that owns the version, now `LIVE`. Null when a `userError` was returned.
  """
  workspace: Workspace
  """The problems that stopped the publish. Empty on success."""
  userErrors: [WorkspaceVersionPublishUserError!]!
}

WorkspaceVersionPublishErrorCode

"""Why `workspaceVersionPublish` failed."""
enum WorkspaceVersionPublishErrorCode {
  """The workspace the version was published from has been deleted."""
  WORKSPACE_NOT_FOUND
  """The version does not exist."""
  WORKSPACE_VERSION_NOT_FOUND
  """The project already serves the version."""
  WORKSPACE_VERSION_ALREADY_LIVE
}

WorkspaceVersionPublishUserError

"""A problem that stopped `workspaceVersionPublish`."""
type WorkspaceVersionPublishUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceVersionPublishErrorCode!
}

WorkspaceCreateInput

"""The input of `workspaceCreate`."""
input WorkspaceCreateInput {
  """The ID of the project to create the workspace in."""
  projectId: ID!
  """The workspace's name. Leading and trailing spaces are trimmed."""
  name: String!
}

WorkspaceCreatePayload

"""The result of `workspaceCreate`."""
type WorkspaceCreatePayload {
  """The new workspace, in `DRAFT`. Null when a `userError` was returned."""
  workspace: Workspace
  """The problems that stopped the create. Empty on success."""
  userErrors: [WorkspaceCreateUserError!]!
}

WorkspaceCreateErrorCode

"""Why `workspaceCreate` failed."""
enum WorkspaceCreateErrorCode {
  """The name is blank."""
  NAME_REQUIRED
  """The project does not exist."""
  PROJECT_NOT_FOUND
}

WorkspaceCreateUserError

"""A problem that stopped `workspaceCreate`."""
type WorkspaceCreateUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceCreateErrorCode!
}

WorkspaceUpdateInput

"""The input of `workspaceUpdate`. Every field is required."""
input WorkspaceUpdateInput {
  """The ID of the workspace to rename."""
  workspaceId: ID!
  """The workspace's new name. Leading and trailing spaces are trimmed."""
  name: String!
}

WorkspaceUpdatePayload

"""The result of `workspaceUpdate`."""
type WorkspaceUpdatePayload {
  """The updated workspace. Null when a `userError` was returned."""
  workspace: Workspace
  """The problems that stopped the update. Empty on success."""
  userErrors: [WorkspaceUpdateUserError!]!
}

WorkspaceUpdateErrorCode

"""Why `workspaceUpdate` failed."""
enum WorkspaceUpdateErrorCode {
  """The name is blank."""
  NAME_REQUIRED
  """The workspace does not exist."""
  WORKSPACE_NOT_FOUND
}

WorkspaceUpdateUserError

"""A problem that stopped `workspaceUpdate`."""
type WorkspaceUpdateUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceUpdateErrorCode!
}

WorkspaceDuplicateInput

"""The input of `workspaceDuplicate`."""
input WorkspaceDuplicateInput {
  """The ID of the workspace to copy."""
  sourceWorkspaceId: ID!
  """
  The new workspace's name. When it is null or blank, the source's name followed by ` (Copy)`.
  """
  name: String
}

WorkspaceDuplicatePayload

"""The result of `workspaceDuplicate`."""
type WorkspaceDuplicatePayload {
  """The new workspace, in `DRAFT`. Null when a `userError` was returned."""
  workspace: Workspace
  """The workspace that was copied. Null when a `userError` was returned."""
  sourceWorkspace: Workspace
  """The problems that stopped the copy. Empty on success."""
  userErrors: [WorkspaceDuplicateUserError!]!
}

WorkspaceDuplicateErrorCode

"""Why `workspaceDuplicate` failed."""
enum WorkspaceDuplicateErrorCode {
  """The workspace to copy does not exist."""
  SOURCE_NOT_FOUND
}

WorkspaceDuplicateUserError

"""A problem that stopped `workspaceDuplicate`."""
type WorkspaceDuplicateUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceDuplicateErrorCode!
}

WorkspaceArchiveInput

"""The input of `workspaceArchive`."""
input WorkspaceArchiveInput {
  """The ID of the workspace to archive."""
  workspaceId: ID!
}

WorkspaceArchivePayload

"""The result of `workspaceArchive`."""
type WorkspaceArchivePayload {
  """The archived workspace. Null when a `userError` was returned."""
  workspace: Workspace
  """The problems that stopped the archive. Empty on success."""
  userErrors: [WorkspaceArchiveUserError!]!
}

WorkspaceArchiveErrorCode

"""Why `workspaceArchive` failed."""
enum WorkspaceArchiveErrorCode {
  """The workspace does not exist."""
  WORKSPACE_NOT_FOUND
  """The workspace is live."""
  WORKSPACE_IS_LIVE
}

WorkspaceArchiveUserError

"""A problem that stopped `workspaceArchive`."""
type WorkspaceArchiveUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceArchiveErrorCode!
}

WorkspaceUnarchiveInput

"""The input of `workspaceUnarchive`."""
input WorkspaceUnarchiveInput {
  """The ID of the workspace to unarchive."""
  workspaceId: ID!
}

WorkspaceUnarchivePayload

"""The result of `workspaceUnarchive`."""
type WorkspaceUnarchivePayload {
  """The workspace, now `DRAFT`. Null when a `userError` was returned."""
  workspace: Workspace
  """The problems that stopped the unarchive. Empty on success."""
  userErrors: [WorkspaceUnarchiveUserError!]!
}

WorkspaceUnarchiveErrorCode

"""Why `workspaceUnarchive` failed."""
enum WorkspaceUnarchiveErrorCode {
  """The workspace does not exist."""
  WORKSPACE_NOT_FOUND
  """The workspace is not `ARCHIVED`."""
  WORKSPACE_NOT_ARCHIVED
}

WorkspaceUnarchiveUserError

"""A problem that stopped `workspaceUnarchive`."""
type WorkspaceUnarchiveUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceUnarchiveErrorCode!
}

WorkspaceDeleteInput

"""The input of `workspaceDelete`."""
input WorkspaceDeleteInput {
  """The ID of the workspace to delete."""
  workspaceId: ID!
}

WorkspaceDeletePayload

"""The result of `workspaceDelete`."""
type WorkspaceDeletePayload {
  """The ID of the deleted workspace. Null when a `userError` was returned."""
  deletedWorkspaceId: ID
  """The problems that stopped the delete. Empty on success."""
  userErrors: [WorkspaceDeleteUserError!]!
}

WorkspaceDeleteErrorCode

"""Why `workspaceDelete` failed."""
enum WorkspaceDeleteErrorCode {
  """The workspace does not exist."""
  WORKSPACE_NOT_FOUND
  """The workspace is live."""
  WORKSPACE_IS_LIVE
}

WorkspaceDeleteUserError

"""A problem that stopped `workspaceDelete`."""
type WorkspaceDeleteUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceDeleteErrorCode!
}

WorkspaceExportInput

"""The input of `workspaceExport`."""
input WorkspaceExportInput {
  """
  The ID of the workspace to export. To export exactly what a project serves, pass the ID of the live
  version's `snapshotWorkspace`.
  """
  workspaceId: ID!
}

WorkspaceExportPayload

"""The result of `workspaceExport`."""
type WorkspaceExportPayload {
  """
  The bundle: a JSON document (`formatVersion: 1`) that `workspaceImport` reads. Null when a
  `userError` was returned.
  
  ```json
  {
    "formatVersion": 1,
    "source": { "apiUrl": "...", "projectId": "...", "workspaceId": "...",
                "workspaceVersionId": "..." | null, "exportedAt": "..." },
    "workspace": { "name": "..." },
    "features": [], "featureVariants": [], "steps": [], "fields": [],
    "stepFields": [], "actions": [], "actionFields": [], "conditions": [],
    "experiences": [], "contentModels": [], "contentBlocks": [],
    "contentEntries": [], "workflows": [],
    "assets": [{ "id": "...", "versionId": "...", "fileName": "...",
                 "mimeType": "...", "sizeBytes": 0, "width": null, "height": null,
                 "sha256": "..." | null, "downloadUrl": "..." }]
  }
  ```
  
  Entities use snake_case keys and carry their source `id`, which is a handle inside the bundle
  only. Organization, project, workspace and user IDs, timestamps and deleted entities are left out.
  A workflow carries its `trigger` and its `workflow_json` graph, without its scopes. Every asset
  version the content entries reference is listed once in `assets`; a reference that pins no version
  is pinned to the version the Delivery API serves for it. `source` records where the bundle came
  from.
  """
  bundle: JSON
  """The problems that stopped the export. Empty on success."""
  userErrors: [WorkspaceExportUserError!]!
}

WorkspaceExportErrorCode

"""Why `workspaceExport` failed."""
enum WorkspaceExportErrorCode {
  """The workspace does not exist."""
  WORKSPACE_NOT_FOUND
  """
  A content entry references an asset version that does not exist in the project. The message
  names the entry and the asset.
  """
  ASSET_NOT_FOUND
  """
  An entity does not fit the bundle format, or a content entry holds an asset version where its
  schema has no asset field, which `workspaceImport` cannot remap. The message names the entity
  and the place at fault.
  """
  INVALID_SOURCE_ROW
  """
  An entity references one the workspace does not hold, such as a content entry that embeds a
  deleted Content Block, a flow node whose experience is deleted, or a workflow whose trigger or
  tool argument names a deleted action. One error is returned per reference; its message names the
  entity, its key when it has one, where the reference sits and the ID it references.
  """
  UNRESOLVED_REFERENCE
}

WorkspaceExportUserError

"""A problem that stopped `workspaceExport`."""
type WorkspaceExportUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceExportErrorCode!
}

WorkspaceImportAssetMappingInput

"""
The asset version that stands in for one a bundle references. Upload the file from the bundle's
`downloadUrl` with `assetUploadInit`, passing `sha256` so a file the project holds is reused, and
`assetCommit`, then map the bundle's `versionId` to the result.
"""
input WorkspaceImportAssetMappingInput {
  """The asset version's ID in the bundle (`assets[].versionId`)."""
  sourceVersionId: ID!
  """The ID of the asset in the target project."""
  assetId: ID!
  """
  The ID of the committed version of `assetId` that replaces `sourceVersionId`.
  """
  versionId: ID!
}

WorkspaceImportInput

"""The input of `workspaceImport`."""
input WorkspaceImportInput {
  """
  The ID of the project to create the workspace in. It can belong to another organization than the bundle's source.
  """
  projectId: ID!
  """The new workspace's name. Null for the bundle's `workspace.name`."""
  name: String
  """The bundle `workspaceExport` returned (`formatVersion: 1`)."""
  bundle: JSON!
  """
  The stand-in for every asset version the bundle references. Each must be a committed version of an
  asset in `projectId`.
  """
  assetMap: [WorkspaceImportAssetMappingInput!]
}

WorkspaceImportPayload

"""The result of `workspaceImport`."""
type WorkspaceImportPayload {
  """The new workspace, in `DRAFT`. Null when a `userError` was returned."""
  workspace: Workspace
  """
  The problems that stopped the import. When any is returned, nothing was created.
  """
  userErrors: [WorkspaceImportUserError!]!
}

WorkspaceImportErrorCode

"""Why `workspaceImport` failed."""
enum WorkspaceImportErrorCode {
  """The target project does not exist."""
  PROJECT_NOT_FOUND
  """
  Neither `name` nor the bundle's `workspace.name` holds a non-blank name.
  """
  NAME_REQUIRED
  """The bundle's `formatVersion` is not one this server reads."""
  UNSUPPORTED_FORMAT_VERSION
  """
  The bundle does not match its format: a missing or unknown collection or key, a value of the
  wrong type, a Content Model or Content Block schema that does not parse, a repeated ID, or a
  workflow whose visit cap or loops a workflow save refuses. `field` points into the bundle.
  """
  INVALID_BUNDLE
  """
  An entity references an ID that is not in the bundle. One error is returned per reference; its
  message names the entity, its key when it has one, where the reference sits and the ID it
  references.
  """
  UNRESOLVED_REFERENCE
  """
  An `assetMap` item names an asset version that is not a committed version of an asset in the
  target project, or maps one source version to two targets.
  """
  INVALID_ASSET_MAPPING
  """
  A content entry references an asset version that `assetMap` does not map, or holds one where its
  schema has no asset field.
  """
  UNMAPPED_ASSET
  """
  A workflow's tools need a scope the caller cannot grant. The message names the workflow, each
  tool and the scope it needs.
  """
  WORKFLOW_SCOPES_NOT_HELD
}

WorkspaceImportUserError

"""A problem that stopped `workspaceImport`."""
type WorkspaceImportUserError {
  """
  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!
  """The error's code."""
  code: WorkspaceImportErrorCode!
}