For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
  • Get Started
    • Introduction
    • Quickstart
    • Authentication
  • API Reference
      • GETList Templates
      • POSTCreate Template
      • GETGet Template
      • DELDelete Template
      • PATCHUpdate Template
      • POSTClone Template
      • POSTFavorite Template
      • DELUnfavorite Template
  • Python SDK
    • Install
    • Usage
    • Errors
  • CLI
    • Overview
LogoLogo
API Referencetemplates

Update Template

PATCH
/api/v1/templates/:template_id
PATCH
/api/v1/templates/:template_id
$curl -X PATCH https://api.onepin.ai/api/v1/templates/template_id \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{}'
1{
2 "data": {
3 "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
4 "name": "Social Media Content Workflow",
5 "definition": {
6 "graph": {
7 "nodes": [
8 {
9 "id": "1e7d9f3a-4c2b-4f3a-9a1b-2d3e4f5a6b7c",
10 "type": "source_script",
11 "position": {
12 "x": 100.5,
13 "y": 200.75
14 },
15 "config": {},
16 "config_version": 1
17 }
18 ],
19 "edges": [
20 {
21 "id": "4b825dc6-8a1a-4f3a-9a1b-2d3e4f5a6b7d",
22 "source": "1e7d9f3a-4c2b-4f3a-9a1b-2d3e4f5a6b7c",
23 "sourcePort": "output",
24 "target": "2f7d9f3a-4c2b-4f3a-9a1b-2d3e4f5a6b7e",
25 "targetPort": "input"
26 }
27 ]
28 },
29 "execution": {
30 "steps": [
31 "5c7d9f3a-4c2b-4f3a-9a1b-2d3e4f5a6b7f"
32 ],
33 "params": {}
34 }
35 },
36 "is_starter": true,
37 "is_public": true,
38 "uses_count": 42,
39 "created_at": "2024-01-15T09:30:00Z",
40 "updated_at": "2024-04-20T14:45:00Z",
41 "description": "A template for automating social media content creation and scheduling.",
42 "category": "media",
43 "is_favorite": false,
44 "created_by": "9f8c7d6e-5b4a-3c2d-1e0f-9a8b7c6d5e4f"
45 },
46 "meta": {
47 "request_id": "7a8b9c0d-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
48 "timestamp": "2024-04-20T14:45:00Z"
49 }
50}

Update a template. Owner only; starter templates are read-only.

definition is full-replace (matches WorkflowUpdate — the FE sends the entire graph back on save). Other fields are partial via exclude_unset.

Was this page helpful?
Previous

Clone Template

Next
Built with

Authentication

AuthorizationBearer
Clerk JWT token

Path parameters

template_idstringRequiredformat: "uuid"

Headers

X-Workspace-Idstring or nullOptional

Request

This endpoint expects an object.
namestring or nullOptional1-200 characters
descriptionstring or nullOptional<=2000 characters
categoryenum or nullOptional
Allowed values:
definitionobject or nullOptional

Full-replace on PATCH. Omit to keep the stored value. Explicit null is rejected — there is no ‘empty graph’ use-case worth the ambiguity. The union with null here only makes omission easy for FE clients; see reject_null_definition for the runtime guard.

Response

Successful Response
dataobject

Response shape. workspace_id is intentionally omitted so the gallery endpoint (which returns rows from any workspace) does not leak tenant ownership IDs across tenants. created_by is retained as author provenance for public/starter rows.

definition is the serialized WorkflowDefinition JSONB (same shape as Workflow.definition) — a template is a reusable workflow snapshot.

metaobject

Errors

422
Unprocessable Entity Error