# Templates

Operations related to form templates

## GET /api/template

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{}},"paths":{"/api/template":{"get":{"operationId":"TemplateController_getAllTemplates","parameters":[{"name":"page","required":false,"in":"query","description":"Page number (default: 1)","schema":{"type":"number"}},{"name":"perPage","required":false,"in":"query","description":"Items per page (default: 100)","schema":{"type":"number"}}],"responses":{"200":{"description":"Returns a paginated list of templates"}},"tags":["Templates"]}}}}
```

## POST /api/template

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"CreateTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template"},"description":{"type":"string","description":"The description of the template"},"version":{"type":"number","description":"The version of the template"},"schema":{"type":"object","description":"The schema of the template"},"aiGenerated":{"type":"boolean","description":"Wheter the template was generated using AI"},"vendorSchemaName":{"type":"string","description":"The vendor schema name"},"vendorSchemaVersion":{"type":"number","description":"The vendor schema version"},"vendorSchema":{"type":"object","description":"The vendor schema"},"dereferencedVendorSchema":{"type":"object","description":"The dereferenced vendor schema with resolved $ref references"},"emailAlias":{"type":"string","description":"The email alias"},"state":{"type":"string","description":"The state of the template","enum":["draft","published"],"default":"published"}},"required":["name","version"]}}},"paths":{"/api/template":{"post":{"operationId":"TemplateController_createTemplate","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateTemplateDto"}}}},"responses":{"201":{"description":"Creates a new template"}},"tags":["Templates"]}}}}
```

## GET /api/template/{id}

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{}},"paths":{"/api/template/{id}":{"get":{"operationId":"TemplateController_getTemplateById","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"200":{"description":""}},"tags":["Templates"]}}}}
```

## PUT /api/template/{id}

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"UpdateTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template"},"description":{"type":"string","description":"The description of the template"},"version":{"type":"number","description":"The version of the template"},"schema":{"type":"object","description":"The schema of the template"},"vendorSchemaName":{"type":"string","description":"The vendor schema name"},"vendorSchemaVersion":{"type":"number","description":"The vendor schema version"},"vendorSchema":{"type":"object","description":"The vendor schema"},"dereferencedVendorSchema":{"type":"object","description":"The dereferenced vendor schema with resolved $ref references"},"emailAlias":{"type":"string","description":"The email alias"},"extractionStrategyId":{"type":"string","description":"The uuid of extraction strategy template uses."},"state":{"type":"string","description":"The state of the template","enum":["draft","published"],"default":"published"},"parsingInstructions":{"type":"object","description":"the parsing instructions for a template"}}}}},"paths":{"/api/template/{id}":{"put":{"operationId":"TemplateController_updateTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateDto"}}}},"responses":{"200":{"description":"Updates an existing template"},"413":{"description":"Payload too large"}},"tags":["Templates"]}}}}
```

## DELETE /api/template/{id}

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{}},"paths":{"/api/template/{id}":{"delete":{"operationId":"TemplateController_deleteTemplate","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}}],"responses":{"204":{"description":"Soft deletes an existing template"}},"tags":["Templates"]}}}}
```

## PATCH /api/template/{id}

> Update template

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"UpdateTemplateDto":{"type":"object","properties":{"name":{"type":"string","description":"The name of the template"},"description":{"type":"string","description":"The description of the template"},"version":{"type":"number","description":"The version of the template"},"schema":{"type":"object","description":"The schema of the template"},"vendorSchemaName":{"type":"string","description":"The vendor schema name"},"vendorSchemaVersion":{"type":"number","description":"The vendor schema version"},"vendorSchema":{"type":"object","description":"The vendor schema"},"dereferencedVendorSchema":{"type":"object","description":"The dereferenced vendor schema with resolved $ref references"},"emailAlias":{"type":"string","description":"The email alias"},"extractionStrategyId":{"type":"string","description":"The uuid of extraction strategy template uses."},"state":{"type":"string","description":"The state of the template","enum":["draft","published"],"default":"published"},"parsingInstructions":{"type":"object","description":"the parsing instructions for a template"}}}}},"paths":{"/api/template/{id}":{"patch":{"operationId":"TemplateController_patchTemplate","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateDto"}}}},"responses":{"200":{"description":"The template has been successfully updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateTemplateDto"}}}}},"summary":"Update template","tags":["Templates"]}}}}
```

## GET /api/template/{id}/submissions

>

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{}},"paths":{"/api/template/{id}/submissions":{"get":{"operationId":"TemplateController_getTemplateSubmissions","parameters":[{"name":"id","required":true,"in":"path","schema":{"type":"number"}},{"name":"page","required":false,"in":"query","description":"Page number (default: 1)","schema":{"type":"number"}},{"name":"perPage","required":false,"in":"query","description":"Items per page (default: 10)","schema":{"type":"number"}}],"responses":{"200":{"description":"Returns a paginated list of submissions for the specified template"}},"tags":["Templates"]}}}}
```

## POST /api/template/import-from-ledger

> Import schema from Ledger

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"ImportFromLedgerDto":{"type":"object","properties":{"schema":{"type":"object","description":"The updated schema from Ledger"},"vendorSchemaName":{"type":"string","description":"The vendor schema name"},"vendor_schema_name":{"type":"string","description":"The vendor schema name (alternative)"},"vendorSchemaVersion":{"type":"number","description":"The vendor schema version"},"vendor_schema_version":{"type":"number","description":"The vendor schema version (alternative)"},"vendorSchema":{"type":"object","description":"The vendor schema"},"vendor_schema":{"type":"object","description":"The vendor schema (alternative snake_case)"},"dereferencedVendorSchema":{"type":"object","description":"The dereferenced vendor schema with resolved $ref references"}}}}},"paths":{"/api/template/import-from-ledger":{"post":{"operationId":"TemplateController_importSchemaFromLedger","parameters":[],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFromLedgerDto"}}}},"responses":{"201":{"description":"transforms Ledger schema into a formflow template"}},"summary":"Import schema from Ledger","tags":["Templates"]}}}}
```

## POST /api/template/{id}/duplicate

> Duplicate an existing template

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{}},"paths":{"/api/template/{id}/duplicate":{"post":{"operationId":"TemplateController_duplicateTemplate","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID to duplicate","schema":{"type":"number"}}],"responses":{"201":{"description":"Creates a duplicate of the existing template with all AI hints preserved"}},"summary":"Duplicate an existing template","tags":["Templates"]}}}}
```

## POST /api/template/{id}/update-from-ledger

> Import updated schema from Ledger

```json
{"openapi":"3.0.0","info":{"title":"Formflow API","version":"1.0"},"tags":[{"name":"Templates","description":"Operations related to form templates"}],"security":[{"access-token":[]}],"components":{"securitySchemes":{},"schemas":{"ImportFromLedgerDto":{"type":"object","properties":{"schema":{"type":"object","description":"The updated schema from Ledger"},"vendorSchemaName":{"type":"string","description":"The vendor schema name"},"vendor_schema_name":{"type":"string","description":"The vendor schema name (alternative)"},"vendorSchemaVersion":{"type":"number","description":"The vendor schema version"},"vendor_schema_version":{"type":"number","description":"The vendor schema version (alternative)"},"vendorSchema":{"type":"object","description":"The vendor schema"},"vendor_schema":{"type":"object","description":"The vendor schema (alternative snake_case)"},"dereferencedVendorSchema":{"type":"object","description":"The dereferenced vendor schema with resolved $ref references"}}}}},"paths":{"/api/template/{id}/update-from-ledger":{"post":{"operationId":"TemplateController_importFromLedger","parameters":[{"name":"id","required":true,"in":"path","description":"Template ID to update from Ledger","schema":{"type":"number"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ImportFromLedgerDto"}}}},"responses":{"201":{"description":"Creates a new template with updated schema from Ledger while preserving AI hints"}},"summary":"Import updated schema from Ledger","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://docs.ai.insly.com/nora/api-documentation/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.
