More in Learn

Managing Flows with the Core API

There are many flow-related operations within the Core API. In order to perform these operations, ensure that you have the proper authentication and user permissions.

Creating a Flow

The following query creates a flow with the name “Translation” and adds three stages to it. For simplicity’s sake, we are only querying the basicError here. You can find the other errors available for this query in the GraphQL docs.

mutation CreateFlow {
createFlow(
identifier: "translation"
input: {
name: "Translation"
type: item
stages: [
{ identifier: "new", name: "New" }
{ identifier: "translated", name: "Translated" }
{ identifier: "approved", name: "Approved" }
]
}
) {
... on Flow {
identifier
stageIdentifiers
}
...on BasicError {
errorName
message
}
}
}

Moving an Item to a Flow Stage

All you need to move an item to a flow stage is the item’s ID, the language, and the stage identifier.

mutation MoveItemToFlowStage {
addItemsToFlowStage(
items: [{ id: "ITEM_ID", language: "en" }]
stageIdentifier: "new"
) {
... on FlowContentList {
content {
stage {
identifier
}
}
}
}
}

Creating a New Flow Stage

To add a new stage to a flow after creating it, you can run the following mutation:

mutation CreateFlowStage {
createFlowStage(
input: { name: "Quality Check", position: 3 }
flowIdentifier: "translation"
identifier: "quality-check"
) {
... on FlowStage {
identifier
}
... on FlowNotFoundError {
errorName
message
}
}
}

Deleting a Flow

To delete a flow, all that needs to be provided is the flow identifier.

mutation DeleteFlow {
deleteFlow(identifier: "FLOW_IDENTIFIER") {
... on DeleteCount {
removed
}
}
}
People showing thumbs up

Need further help?

Join and ask our
slack community.

Join our slack community