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

Create Template

POST
/api/v1/templates
POST
/api/v1/templates
$curl -X POST https://api.onepin.ai/api/v1/templates \
> -H "Authorization: Bearer <token>" \
> -H "Content-Type: application/json" \
> -d '{
> "name": "Social Media Content Workflow"
>}'
1{
2 "data": {
3 "id": "d290f1ee-6c54-4b01-90e6-d701748f0851",
4 "name": "Social Media Content Workflow",
5 "definition": {
6 "graph": {
7 "nodes": [
8 {
9 "id": "a3bb189e-8bf9-3888-9912-ace4e6543002",
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": "b1c2d3e4-f567-890a-bcde-f1234567890a",
22 "source": "a3bb189e-8bf9-3888-9912-ace4e6543002",
23 "sourcePort": "output",
24 "target": "c4d5e6f7-1234-5678-9abc-def012345678",
25 "targetPort": "input"
26 }
27 ]
28 },
29 "execution": {
30 "steps": [
31 "a3bb189e-8bf9-3888-9912-ace4e6543002"
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-01-15T09:30:00Z",
41 "description": "A workflow template designed for automating social media content creation and scheduling.",
42 "category": "media",
43 "is_favorite": false,
44 "created_by": "f47ac10b-58cc-4372-a567-0e02b2c3d479"
45 },
46 "meta": {
47 "request_id": "7f9c2ba4-3d1e-4f6a-9a2b-1c2d3e4f5678",
48 "timestamp": "2024-01-15T09:30:00Z"
49 }
50}
Create a new workflow template in the current workspace. The caller supplies a full `WorkflowDefinition` (graph + execution). Save-time validation (`validate_definition_save`) mirrors the `/api/v1/workflows` contract — duplicate node/edge IDs, port mismatches, and other structural errors fail at write time rather than surfacing when a caller later clones the template into a workflow.
Was this page helpful?
Previous

Get Template

Next
Built with

Create a new workflow template in the current workspace.

The caller supplies a full WorkflowDefinition (graph + execution). Save-time validation (validate_definition_save) mirrors the /api/v1/workflows contract — duplicate node/edge IDs, port mismatches, and other structural errors fail at write time rather than surfacing when a caller later clones the template into a workflow.

Authentication

AuthorizationBearer
Clerk JWT token

Headers

X-Workspace-Idstring or nullOptional

Request

This endpoint expects an object.
namestringRequired1-200 characters
descriptionstring or nullOptional<=2000 characters
categoryenum or nullOptional
Allowed values:
definitionobjectOptional

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