Trillet AI logo

Save Node Flow Draft

Autosave work in progress to the graph's draft. Never validates.

PATCHhttps://api.trillet.ai/v2/api/node-graphs/{id}/draft

Stores a draft of the graph without touching the live version. It is built for continuous saving while the graph is incomplete, so it never validates: anything you send is stored, even a graph that cannot be published. Validation happens in Validate and Publish.

The draft is replaced by what you send. Send every draft field you want to keep, because fields left out of this request are dropped from the draft and fall back to the live values. The draft does not change what calls run. Publish promotes it to live, and DELETE /v2/api/node-graphs/{id}/draft discards it.

Headers

x-workspace-idstringrequired

Workspace identifier for the API.

Path Parameters

idstringrequired

The graph _id.

Request Body

Any of name, description, startNodeId, variables, globals, router, nodes, edges and dataSources, as described in Graph fields. Other fields are ignored. A knowledge base you add must belong to your workspace.

Errors

StatusBodyWhen
400{"code": "WORKSPACE_ID_REQUIRED"}No x-workspace-id
400{"code": "KNOWLEDGE_BASE_NOT_IN_WORKSPACE", "params": {"knowledgeBaseIds": [...]}}A knowledge base you add is not in your workspace
404{"code": "NODE_GRAPH_NOT_FOUND"}No graph with that ID in the workspace
500{"code": "NODE_GRAPH_DRAFT_SAVE_FAILED"}Unexpected server error

Response Fields

hasDraftboolean

Always true after a successful save.

lastDraftSavedAtstring

When the draft was saved.

curl -X PATCH "https://api.trillet.ai/v2/api/node-graphs/{id}/draft" \
  -H "x-api-key: YOUR_API_KEY" \
  -H "x-workspace-id: YOUR_WORKSPACE_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "startNodeId": "start",
    "nodes": [
      {
        "nodeId": "start",
        "type": "conversation",
        "name": "Greeting",
        "config": { "objective": "Greet the caller and ask how you can help today." }
      }
    ],
    "edges": []
  }'
{
  "hasDraft": true,
  "lastDraftSavedAt": "2025-01-03T11:25:00Z"
}

Last updated on