Workflow API endpoints are currently in alpha and are subject to change.
List workflows
Retrieve a paginated list of workflows, most recently updated first.
List workflows API reference
const response = await fetch("https://app.loops.so/api/v1/workflows?perPage=20", {
method: "GET",
headers: {
"Authorization": "Bearer <your-api-key>",
},
});
const { data, pagination } = await response.json();
const workflowId = data[0]?.id;
const nextCursor = pagination.nextCursor;
Get a workflow
Fetch a simplified workflow graph with node types, connections, and selected
display fields.
Save rootNodeId and the keys in nodes. Use them to request full node
details with Get workflow node.
Get workflow API reference
const response = await fetch(
`https://app.loops.so/api/v1/workflows/${workflowId}`,
{
method: "GET",
headers: {
"Authorization": "Bearer <your-api-key>",
},
},
);
const workflow = await response.json();
const rootNodeId = workflow.rootNodeId;
const nodes = workflow.nodes;
const firstNode = nodes[rootNodeId];
const nextNodeIds = firstNode?.nextNodeIds ?? [];
Get workflow node details
Use the simplified workflow graph to pick a nodeId, then fetch the full node
configuration.
Get workflow node API reference
const nodeId = rootNodeId;
const response = await fetch(
`https://app.loops.so/api/v1/workflows/${workflowId}/nodes/${nodeId}`,
{
method: "GET",
headers: {
"Authorization": "Bearer <your-api-key>",
},
},
);
const node = await response.json();
if (node.typeName === "EventTrigger") {
console.log(node.eventName, node.reEligible);
}
if (node.typeName === "SendEmailAction") {
console.log(node.subject);
}
Walk connected nodes
After fetching a node, follow nextNodeIds to load the next steps in the
workflow.
async function getWorkflowNodes(workflowId, nodeIds) {
const nodes = await Promise.all(
nodeIds.map(async (nodeId) => {
const response = await fetch(
`https://app.loops.so/api/v1/workflows/${workflowId}/nodes/${nodeId}`,
{
method: "GET",
headers: {
"Authorization": "Bearer <your-api-key>",
},
},
);
return response.json();
}),
);
return nodes;
}
const connectedNodes = await getWorkflowNodes(workflowId, nextNodeIds);