# Templates

Custom content templates (Workbench)

## List custom templates

> List all custom templates for the team. Requires Business plan or higher.

```json
{"openapi":"3.1.0","info":{"title":"Cuppa API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Custom content templates (Workbench)"}],"servers":[{"url":"https://api.cuppa.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"TemplateListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"site_id":{"type":"string","format":"uuid","nullable":true},"variables":{"type":"object","additionalProperties":{"type":"string"}},"include_faq":{"type":"boolean"},"include_key_takeaways":{"type":"boolean"},"include_ai_images":{"type":"boolean"},"enable_knowledge":{"type":"boolean"},"enable_perplexity":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}}}},"paths":{"/v1/templates":{"get":{"summary":"List custom templates","description":"List all custom templates for the team. Requires Business plan or higher.","parameters":[{"in":"query","name":"page","schema":{"type":"integer"},"description":"Page number for pagination"},{"in":"query","name":"site_id","schema":{"type":"string","format":"uuid"},"description":"Filter by site ID"}],"responses":{"200":{"description":"A list of custom templates","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateListItem"}}}}}},"tags":["Templates"]}}}}
```

## Create a custom template

> Create a new custom template. Requires Business plan or higher.

```json
{"openapi":"3.1.0","info":{"title":"Cuppa API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Custom content templates (Workbench)"}],"servers":[{"url":"https://api.cuppa.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"TemplateDetail":{"allOf":[{"$ref":"#/components/schemas/TemplateListItem"},{"type":"object","properties":{"system_prompt":{"type":"string"},"user_prompt":{"type":"string"},"ideal_output":{"type":"string","nullable":true},"knowledge_sources":{"type":"array","items":{"type":"integer"}},"include_toc":{"type":"boolean"},"enable_serp":{"type":"boolean"},"ai_image_style":{"type":"string","nullable":true},"ai_image_model":{"type":"string","nullable":true},"ai_image_count_body":{"type":"integer"}}}]},"TemplateListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"site_id":{"type":"string","format":"uuid","nullable":true},"variables":{"type":"object","additionalProperties":{"type":"string"}},"include_faq":{"type":"boolean"},"include_key_takeaways":{"type":"boolean"},"include_ai_images":{"type":"boolean"},"enable_knowledge":{"type":"boolean"},"enable_perplexity":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}}}},"paths":{"/v1/templates":{"post":{"summary":"Create a custom template","description":"Create a new custom template. Requires Business plan or higher.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["name","system_prompt","user_prompt"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"site_id":{"type":"string","format":"uuid"},"system_prompt":{"type":"string"},"user_prompt":{"type":"string"},"ideal_output":{"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"}},"enable_knowledge":{"type":"boolean","default":false},"enable_serp":{"type":"boolean","default":false},"enable_perplexity":{"type":"boolean","default":false},"include_faq":{"type":"boolean","default":false},"include_key_takeaways":{"type":"boolean","default":false},"include_toc":{"type":"boolean","default":false}}}}}},"responses":{"201":{"description":"Template created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetail"}}}}},"tags":["Templates"]}}}}
```

## Get a custom template

> Get template details including prompts and configuration.

```json
{"openapi":"3.1.0","info":{"title":"Cuppa API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Custom content templates (Workbench)"}],"servers":[{"url":"https://api.cuppa.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"TemplateDetail":{"allOf":[{"$ref":"#/components/schemas/TemplateListItem"},{"type":"object","properties":{"system_prompt":{"type":"string"},"user_prompt":{"type":"string"},"ideal_output":{"type":"string","nullable":true},"knowledge_sources":{"type":"array","items":{"type":"integer"}},"include_toc":{"type":"boolean"},"enable_serp":{"type":"boolean"},"ai_image_style":{"type":"string","nullable":true},"ai_image_model":{"type":"string","nullable":true},"ai_image_count_body":{"type":"integer"}}}]},"TemplateListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"site_id":{"type":"string","format":"uuid","nullable":true},"variables":{"type":"object","additionalProperties":{"type":"string"}},"include_faq":{"type":"boolean"},"include_key_takeaways":{"type":"boolean"},"include_ai_images":{"type":"boolean"},"enable_knowledge":{"type":"boolean"},"enable_perplexity":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}}}},"paths":{"/v1/templates/{id}":{"get":{"summary":"Get a custom template","description":"Get template details including prompts and configuration.","responses":{"200":{"description":"Template detail","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetail"}}}}},"tags":["Templates"]}}}}
```

## Update a custom template

> Update an existing custom template. Only provided fields are updated.

```json
{"openapi":"3.1.0","info":{"title":"Cuppa API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Custom content templates (Workbench)"}],"servers":[{"url":"https://api.cuppa.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}},"schemas":{"TemplateDetail":{"allOf":[{"$ref":"#/components/schemas/TemplateListItem"},{"type":"object","properties":{"system_prompt":{"type":"string"},"user_prompt":{"type":"string"},"ideal_output":{"type":"string","nullable":true},"knowledge_sources":{"type":"array","items":{"type":"integer"}},"include_toc":{"type":"boolean"},"enable_serp":{"type":"boolean"},"ai_image_style":{"type":"string","nullable":true},"ai_image_model":{"type":"string","nullable":true},"ai_image_count_body":{"type":"integer"}}}]},"TemplateListItem":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"description":{"type":"string","nullable":true},"site_id":{"type":"string","format":"uuid","nullable":true},"variables":{"type":"object","additionalProperties":{"type":"string"}},"include_faq":{"type":"boolean"},"include_key_takeaways":{"type":"boolean"},"include_ai_images":{"type":"boolean"},"enable_knowledge":{"type":"boolean"},"enable_perplexity":{"type":"boolean"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time","nullable":true}}}}},"paths":{"/v1/templates/{id}":{"put":{"summary":"Update a custom template","description":"Update an existing custom template. Only provided fields are updated.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string"},"description":{"type":"string"},"system_prompt":{"type":"string"},"user_prompt":{"type":"string"},"ideal_output":{"type":"string"},"variables":{"type":"object","additionalProperties":{"type":"string"}},"enable_knowledge":{"type":"boolean"},"enable_serp":{"type":"boolean"},"enable_perplexity":{"type":"boolean"},"include_faq":{"type":"boolean"},"include_key_takeaways":{"type":"boolean"},"include_toc":{"type":"boolean"}}}}}},"responses":{"200":{"description":"Template updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetail"}}}}},"tags":["Templates"]}}}}
```

## DELETE /v1/templates/{id}

> Delete a custom template

```json
{"openapi":"3.1.0","info":{"title":"Cuppa API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Custom content templates (Workbench)"}],"servers":[{"url":"https://api.cuppa.ai"}],"security":[{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-KEY"}}},"paths":{"/v1/templates/{id}":{"delete":{"summary":"Delete a custom template","responses":{"204":{"description":"Template deleted"}},"tags":["Templates"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://learn.cuppa.ai/rest-api/templates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
