Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Workflow

Create a new workflow

Body parameters

id string Optional

RFC 4122 UUID of workflow expressed in URL-safe base64 format

Example: "uJzC2b6YQg-DW2A5edpQYQ"
type string Required

Must be exactly "workflow".

attributes.name string Required

The name of the workflow

Example: "Approval by editors required"
attributes.stages Required

The stages of the workflow

Type: Array<object>
Example: [{ id: "waiting_for_review", name: "Waiting for review", initial: true }]
id string Required

ID of the stage

Example: "waiting_for_review"
name string Required

Name of the stage

Example: "Waiting for review"
description string, null Optional

Description of the stage

Example: "Editor has finished writing and is waiting for approval from a supervisor"
initial boolean Optional

Whether this is the initial stage or not

attributes.api_key string Required

Workflow API key

Example: "approval_by_editors"

Returns

Returns a resource object of type workflow.

Examples

POST https://site-api.datocms.com/workflows HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "workflow",
"attributes": {
"name": "Approval by editors required",
"stages": [
{
"id": "waiting_for_review",
"name": "Waiting for review",
"initial": true
}
],
"api_key": "approval_by_editors"
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/workflows' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"workflow","attributes":{"name":"Approval by editors required","stages":[{"id":"waiting_for_review","name":"Waiting for review","initial":true}],"api_key":"approval_by_editors"}}}'
await fetch("https://site-api.datocms.com/workflows", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
type: "workflow",
attributes: {
name: "Approval by editors required",
stages: [
{
id: "waiting_for_review",
name: "Waiting for review",
initial: true,
},
],
api_key: "approval_by_editors",
},
},
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "workflow",
"id": "uJzC2b6YQg-DW2A5edpQYQ",
"attributes": {
"name": "Approval by editors required",
"stages": [
{
"id": "waiting_for_review",
"name": "Waiting for review",
"initial": true
}
],
"api_key": "approval_by_editors"
}
}
}