Entity Command API
A guide to using the Mindful Entity Command API to modify data.
This API provides a collection of JSON data endpoints to perform specific actions (commands) against Mindful Entity Kinds.
Connecting to the API
This API requires user, machine, or company token authentication.
In addition to the authentication header, make sure to send the namespace header to designate the intended tenant for your request! This API also supports the view
parameter to designate the tenant view. For most use cases, this should be main
.
POST https://api.mindfulcms.com/commands/<entity-kind>/<command-key> HTTP/1.1
Authentication: Bearer <api-token>
Content-Type: application/json
Host: api.mindfulcms.com
X-Namespace: <org-key>/<workspace-key>
{
"command": {
"input": [...]
},
"view": "<view-key>"
}
The shape of the input
param varies based on the command being used, but it will always be an array of input payloads.
Metadata
The current metadata for available commands, entities, and fragments can be retrieved by sending a GET request to the /commands endpoint:
GET https://api.mindfulcms.com/commands HTTP/1.1
Authentication: Bearer <api-token>
Content-Type: application/json
Host: api.mindfulcms.com
X-Namespace: <org-key>/<workspace-key>
Available Entity Kinds
Advertising Company
Advertising Creative
Advertising Email Channel
Advertising Image
Advertising Line Item
Advertising Order
Advertising Post
Advertising Unit
Advertising Website Channel
Email Automation Job
Email Channel
Email Channel Block
Email Channel Deployment
File
Image
Label
Label Option
Magazine Channel
Magazine Channel Issue
Magazine Channel Section
Place or Thing
Post
Post Interaction
Vocab
Vocab Term
Website Channel
Website Channel Topic
Available Commands
Clone
Create
Delete
Delete Connection Edges
Delete Edge
Delete Embed Manies
Delete Embed One
Merge
Modify Connection Edge Prop Value
Modify Edge Prop Value
Modify Embed Many Prop Value
Modify Embed Many Prop Values
Modify Embed One Prop Value
Modify Embed One Prop Values
Modify Multiple Connection Edge Prop Values
Modify Multiple Embed Many Prop Values
Modify Prop Value
Modify Prop Values
Replace Existing Edge
Set New Connection Edges
Set New Edge
Set New Embed Manies
Set New Embed One
Set or Delete Connection Edges
Examples
Create a Company Post
This example creates a new Post, using the "Company" Variant Form, specifying the name field.
const input = [
{
form: "COMPANY",
props: {
name: "ACME Co., Inc.",
},
},
];
const url = 'https://api.mindfulcms.com/commands/post/create';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Modify Product Post: Add Company
This example modifies an existing Product Post to set the company edge.
const input = [
{
node: {
_id: "<product-id>",
form: "PRODUCT",
},
edge: {
name: "company",
value: {
node: {
_id: "<company-id>",
form: "COMPANY",
},
},
},
},
];
const url = 'https://api.mindfulcms.com/commands/post/set-new-edge';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Modify Product Post: Replace Company
This example modifies an existing Product Post to replace the company edge's related node.
const input = [
{
node: {
_id: "<product-id>",
form: "PRODUCT",
},
edge: {
_id: "<existing-company-edge-id>",
name: "company",
value: {
node: {
_id: "<company-id>",
form: "COMPANY",
},
},
},
},
];
const url = 'https://api.mindfulcms.com/commands/post/replace-existing-edge';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Create an Email Channel Deployment
This example creates a new Email Channel Deployment, using the "Omeda" Variant Form, specifying the day, name, and subject line fields, and adding the Email Channel as a related edge.
const input = [
{
"form": "OMEDA",
"edges": {
"emailChannel": {
"node": {
"_id": "67ab672f8576d21b018b456b",
"form": "PRIMARY",
},
},
},
"props": {
"day": "2025-04-08",
"name": "New Campaign - Tuesday, April 8, 2025",
"subjectLine": "Urgent news update: Widget sale!",
},
},
];
const url = 'https://api.mindfulcms.com/commands/email-channel-deployment/create';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Pause an Email Advertising Channel Automation Job
This example modifies the embedded Automation Config of an Advertising Email Channel to pause execution of recurring Email Automation Jobs.
const input = [
{
"node": {
"_id": "<advertising-email-channel-id>"
},
"embed": {
"name": "automationConfig",
"value": {
_id: "<embedded-automation-config-id>",
prop: {
name: "paused",
value: true,
},
},
},
},
];
const url = 'https://api.mindfulcms.com/commands/advertising-email-channel/modify-embed-one-prop-value';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Create a Root Website Channel Topic
This example creates a new Website Channel Topic, using the Root Variant Form, specifying the name and slug fields, and setting the website channel edge.
const input = [
{
"form": "ROOT",
"edges": {
"websiteChannel": {
"node": {
"_id": "<website-channel-id>"
},
},
},
"props": {
"name": "My New Root Topic",
"slug": "my-new-root-topic",
},
},
];
const url = 'https://api.mindfulcms.com/commands/website-channel-topic/create';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
Create a Child Website Channel Topic
This example creates a new Website Channel Topic, using the Child Variant Form, specifying the name and slug fields, and setting the parent edge.
const input = [
{
"form": "CHILD",
"edges": {
"parentTopic": {
"node": {
"_id": "<root-website-channel-topic-id>",
"form": "ROOT",
},
},
},
"props": {
"name": "My New Child Topic",
"slug": "my-new-child-topic",
},
},
];
const url = 'https://api.mindfulcms.com/commands/website-channel-topic/create';
await fetch(url, {
method: 'POST',
headers: {
'authorization': 'Bearer <MY-AUTH-TOKEN>',
'content-type': 'application/json',
'x-namespace': '<account-key>/<workspace-key>',
},
body: JSON.stringify({
command: { input },
view: "main",
}),
});
That's all for now! If you have any specific questions about using the Entity Command API or have suggestions on how this guide can be improved, please let us know via [email protected].
Please feel free to leave feedback on this page and let us know what you think.
Last updated