> For the complete documentation index, see [llms.txt](https://flowmate.gitbook.io/flowmate-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://flowmate.gitbook.io/flowmate-documentation/api-reference/templates.md).

# Templates

## Retrieve all flow templates

> This will only return Flow Templates that are either directly associated with the user, or that are associated with a tenant that the user is also a member of. Requires the 'flowTemplates.read' permissions.

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"templates"}],"security":[],"paths":{"/templates":{"get":{"summary":"Retrieve all flow templates","deprecated":false,"description":"This will only return Flow Templates that are either directly associated with the user, or that are associated with a tenant that the user is also a member of. Requires the 'flowTemplates.read' permissions.","operationId":"getFlowTemplates","tags":["templates"],"parameters":[{"name":"page[size]","in":"query","description":"Number of flow templates per page returned. Default is 10.","required":false,"schema":{"type":"integer"}},{"name":"page[number]","in":"query","description":"Number of the page to be returned. Default is 1.","required":false,"schema":{"type":"integer"}},{"name":"filter[status]","in":"query","description":"Filter results by flow status. Published = 1. Draft = 0","required":false,"schema":{"type":"integer"}},{"name":"filter[user]","in":"query","description":"Filter by user. Works for admin or users with same tenant.","required":false,"schema":{"type":"string"}},{"name":"sort","in":"query","description":"Sort the result by one property. Supported: createdAt, updatedAt and name. Prefix field name with - for reversed sort order (DESC) i.e. sort=-updatedAt. Default sorting is by id ASC","required":false,"schema":{"type":"string"}},{"name":"search","in":"query","description":"Search flows by a word or a phrase contained in the template description OR in the template name (case-insensitive). Behavior is similar to operator LIKE in SQL but case insensitive.","required":false,"schema":{"type":"string"}},{"name":"tags","in":"query","description":"Returns templates that have any of the supplied tags. Pass as comma-separated values. Untagged templates are always returned.","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"A list of flow templates.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/FlowTemplate"}},"meta":{"$ref":"#/components/schemas/Meta"}}}}},"headers":{}}}}}},"components":{"schemas":{"FlowTemplate":{"allOf":[{"$ref":"#/components/schemas/MutableFlowTemplate"},{"type":"object","required":["id","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"status":{"type":"string","description":"Flow status, set automatically in response to start/stop commands","enum":["published","draft"]},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","description":"Timestamp of flow creation","format":"date-time"},"updatedAt":{"type":"string","description":"Timestamp of most recent flow update","format":"date-time"}}}]},"MutableFlowTemplate":{"type":"object","required":["name","graph","type"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"graph":{"$ref":"#/components/schemas/FlowGraph"},"type":{"type":"string","description":"Flow type","enum":["ordinary","realtime"]},"cron":{"type":"string","description":"A cron string describing the interval at which this flow is run. If unset, the flow uses webhooks instead"},"owners":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}}}},"FlowGraph":{"type":"object","properties":{"nodes":{"type":"array","description":"An array of all components involved in this flow","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","description":"ID of this node, which will be referenced by edges"},"componentId":{"type":"string","description":"The component repository id of the component (e.g. adapter/transformer) to be used in this step."},"credentials_id":{"type":"string","description":"A secret service id of a secret containing credentials for this node."},"function":{"type":"string","description":"The function that the component will be executing."},"name":{"type":"string","description":"Descriptive name of this node"},"description":{"type":"string"},"fields":{"type":"object","description":"Optional arguments passed on to the component","properties":{}}}}},"edges":{"type":"array","description":"An array of edges linking nodes together, determining the order in which nodes are activated","items":{"type":"object","required":["source","target"],"properties":{"id":{"type":"string"},"config":{"type":"object","properties":{"condition":{"type":"string"},"mapper":{"type":"object","properties":{}}}},"source":{"type":"string","description":"The source node of this edge, referring to the id field of a node"},"target":{"type":"string","description":"The target node of this edge, referring to the id field of a node"}}}}}},"Owner":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","description":"External id of the owner"},"type":{"type":"string","description":"Type to discriminate between user or tenant"}}},"Meta":{"type":"object","properties":{"page":{"type":"integer","description":"Current page (1-based numbering)"},"perPage":{"type":"integer","description":"Number of objects per page"},"total":{"type":"integer","description":"Total number of objects"},"totalPages":{"type":"integer","description":"Total number of pages"}}}}}}
```

## Find Flow Template by ID

> Returns a single Flow Template by its ID, if the user is authorized to see it. This requires the 'flowTemplates.read' permission

```json
{"openapi":"3.0.1","info":{"title":"Default module","version":"1.0.0"},"tags":[{"name":"templates"}],"security":[],"paths":{"/templates/{id}":{"get":{"summary":"Find Flow Template by ID","deprecated":false,"description":"Returns a single Flow Template by its ID, if the user is authorized to see it. This requires the 'flowTemplates.read' permission","operationId":"getFlowTemplateById","tags":["templates"],"parameters":[{"name":"id","in":"path","description":"ID of flow template to return","required":true,"schema":{"type":"string","format":"string"}}],"responses":{"200":{"description":"Returns the flow template","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/FlowTemplate"},"meta":{"type":"object","properties":{}}}}}},"headers":{}},"404":{"description":"Template not found","content":{"application/json":{"schema":{"type":"object","properties":{}}}},"headers":{}}}}}},"components":{"schemas":{"FlowTemplate":{"allOf":[{"$ref":"#/components/schemas/MutableFlowTemplate"},{"type":"object","required":["id","createdAt","updatedAt"],"properties":{"id":{"type":"string"},"status":{"type":"string","description":"Flow status, set automatically in response to start/stop commands","enum":["published","draft"]},"tags":{"type":"array","items":{"type":"string"}},"createdAt":{"type":"string","description":"Timestamp of flow creation","format":"date-time"},"updatedAt":{"type":"string","description":"Timestamp of most recent flow update","format":"date-time"}}}]},"MutableFlowTemplate":{"type":"object","required":["name","graph","type"],"properties":{"name":{"type":"string"},"description":{"type":"string"},"graph":{"$ref":"#/components/schemas/FlowGraph"},"type":{"type":"string","description":"Flow type","enum":["ordinary","realtime"]},"cron":{"type":"string","description":"A cron string describing the interval at which this flow is run. If unset, the flow uses webhooks instead"},"owners":{"type":"array","items":{"$ref":"#/components/schemas/Owner"}}}},"FlowGraph":{"type":"object","properties":{"nodes":{"type":"array","description":"An array of all components involved in this flow","items":{"type":"object","required":["id"],"properties":{"id":{"type":"string","description":"ID of this node, which will be referenced by edges"},"componentId":{"type":"string","description":"The component repository id of the component (e.g. adapter/transformer) to be used in this step."},"credentials_id":{"type":"string","description":"A secret service id of a secret containing credentials for this node."},"function":{"type":"string","description":"The function that the component will be executing."},"name":{"type":"string","description":"Descriptive name of this node"},"description":{"type":"string"},"fields":{"type":"object","description":"Optional arguments passed on to the component","properties":{}}}}},"edges":{"type":"array","description":"An array of edges linking nodes together, determining the order in which nodes are activated","items":{"type":"object","required":["source","target"],"properties":{"id":{"type":"string"},"config":{"type":"object","properties":{"condition":{"type":"string"},"mapper":{"type":"object","properties":{}}}},"source":{"type":"string","description":"The source node of this edge, referring to the id field of a node"},"target":{"type":"string","description":"The target node of this edge, referring to the id field of a node"}}}}}},"Owner":{"type":"object","required":["id","type"],"properties":{"id":{"type":"string","description":"External id of the owner"},"type":{"type":"string","description":"Type to discriminate between user or tenant"}}}}}}
```
