> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfycontrol.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Template

> Create a new reusable workflow template

## Overview

Create a new template to store and reuse ComfyUI workflow definitions. Templates allow you to save workflow structures that can be reused across multiple workflow executions.

<Warning>
  The API playground does not support file uploads. Use cURL, Postman, or your application code to test this endpoint.
</Warning>

## Content Type

This endpoint requires `multipart/form-data` content type.

## Request Parameters

<ParamField body="name" type="string" required>
  A descriptive name for your template (1-100 characters).
</ParamField>

<ParamField body="description" type="string" required>
  A description of what this template does (1-500 characters).
</ParamField>

<ParamField body="body" type="file" required>
  A JSON file containing the ComfyUI workflow definition.
</ParamField>

## Response

<ResponseField name="id" type="string" required>
  Unique identifier (UUID) for the template.
</ResponseField>

<ResponseField name="user_id" type="string" required>
  UUID of the user who owns this template.
</ResponseField>

<ResponseField name="name" type="string" required>
  The template's name.
</ResponseField>

<ResponseField name="description" type="string" required>
  The template's description.
</ResponseField>

<ResponseField name="body" type="object" required>
  The ComfyUI workflow definition as a JSON object.
</ResponseField>

<ResponseField name="created_at" type="string" required>
  ISO 8601 timestamp when the template was created.
</ResponseField>

<ResponseField name="updated_at" type="string" required>
  ISO 8601 timestamp when the template was last updated.
</ResponseField>

## Example Response

```json theme={null}
{
  "id": "t1e2m3p4-l5a6-7890-abcd-ef1234567890",
  "user_id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
  "name": "Text to Image - Standard",
  "description": "Basic text-to-image generation with SDXL",
  "body": {
    "nodes": [...],
    "links": [...],
    "config": {...}
  },
  "created_at": "2024-01-15T10:00:00Z",
  "updated_at": "2024-01-15T10:00:00Z"
}
```

## cURL Example

Since the API playground doesn't support file uploads, use this cURL command to test:

```bash theme={null}
curl -X POST https://api.comfycontrol.app/v1/template \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -F "name=My Template Name" \
  -F "description=A description of what this template does" \
  -F "body=@/path/to/workflow.json"
```

Replace:

* `YOUR_API_TOKEN` with your actual API token
* `/path/to/workflow.json` with the path to your ComfyUI workflow JSON file

The `-F` flag automatically handles `multipart/form-data` with proper boundaries.

## Error Responses

<ResponseField name="400" type="error">
  Bad request - validation error in the request.

  Common causes:

  * Missing required fields
  * Name or description too long
  * Invalid JSON in body file
</ResponseField>

<ResponseField name="401" type="error">
  Unauthorized - invalid or missing authentication token.
</ResponseField>

<ResponseField name="403" type="error">
  Forbidden - template limit exceeded for your tier.
</ResponseField>

## Notes

* Templates are personal and not shared with other users
* Use templates to standardize workflows across your organization
* Templates can be used as a starting point for creating workflows
* The body field stores the complete ComfyUI workflow JSON structure
* Templates count toward your tier's template limit
* **Use cURL, Postman, or application code** for testing - the API playground doesn't support file uploads
