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

# Save a flow of the Templates folder as a template

> Saves the flow as a template filed under `categories`, as the editor's "Save as Template" does: the template takes the flow's id, name, description and steps. A flow whose template exists (or was deleted) refreshes it from the flow and restores it (200, `result` updated); a new one is 201. Only a flow in Agent Studio's Templates folder can be saved (403 otherwise): build it there with POST /v1/automations/flows {"folder": ...} and test it first. To change a template's steps, name or description, change its flow and save it again. Templates are managed from Agent Studio's Templates folder: only a workspace that has it can save, change or delete them (403 elsewhere), and changes reach every workspace.



## OpenAPI

````yaml /api/statisfy-api.openapi.json post /v1/automations/templates
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/automations/templates:
    post:
      tags:
        - automations
      summary: Save a flow of the Templates folder as a template
      description: >-
        Saves the flow as a template filed under `categories`, as the editor's
        "Save as Template" does: the template takes the flow's id, name,
        description and steps. A flow whose template exists (or was deleted)
        refreshes it from the flow and restores it (200, `result` updated); a
        new one is 201. Only a flow in Agent Studio's Templates folder can be
        saved (403 otherwise): build it there with POST /v1/automations/flows
        {"folder": ...} and test it first. To change a template's steps, name or
        description, change its flow and save it again. Templates are managed
        from Agent Studio's Templates folder: only a workspace that has it can
        save, change or delete them (403 elsewhere), and changes reach every
        workspace.
      operationId: automations_publish_template
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                categories:
                  description: >-
                    The categories the dialog files it under (1 to 20, each up
                    to 100 characters); they replace its current ones
                  items:
                    maxLength: 100
                    minLength: 1
                    type: string
                  maxItems: 20
                  minItems: 1
                  title: Categories
                  type: array
                flow_id:
                  description: >-
                    The flow to save as a template: one in Agent Studio's
                    Templates folder
                  title: Flow Id
                  type: string
              required:
                - flow_id
                - categories
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishedTemplate'
          description: Successful Response
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublishedTemplate'
          description: Created
      security:
        - HTTPBearer: []
components:
  schemas:
    PublishedTemplate:
      properties:
        categories:
          description: The categories the dialog files it under
          items:
            type: string
          title: Categories
          type: array
        components:
          description: >-
            The component type of each of its steps (its trigger among them), in
            the order saved
          items:
            type: string
          title: Components
          type: array
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        id:
          title: Id
          type: string
        name:
          title: Name
          type: string
        result:
          description: >-
            created: a new template; updated: the flow's template refreshed (and
            restored if it was deleted)
          enum:
            - created
            - updated
          title: Result
          type: string
        steps:
          items:
            $ref: '#/components/schemas/Step'
          title: Steps
          type: array
        to_fill:
          description: >-
            Required inputs the template leaves empty: fill them in the flow
            made from it before turning it on
          items:
            $ref: '#/components/schemas/InputToFill'
          title: To Fill
          type: array
        trigger:
          anyOf:
            - $ref: '#/components/schemas/Trigger'
            - type: 'null'
          description: What starts a flow made from it; null if it has no trigger
        updated_at:
          anyOf:
            - type: string
            - type: 'null'
          description: When Statisfy last saved it, ISO 8601 UTC
          title: Updated At
      required:
        - id
        - name
        - description
        - categories
        - trigger
        - components
        - updated_at
        - steps
        - to_fill
        - result
      title: PublishedTemplate
      type: object
    Step:
      properties:
        id:
          title: Id
          type: string
        name:
          description: Its name in the flow builder
          title: Name
          type: string
        next:
          description: The ids of the steps it leads to
          items:
            type: string
          title: Next
          type: array
        settings:
          additionalProperties: true
          description: >-
            What the step points at, by type: agent → agent_id (GET /v1/agents);
            send_email → template_id (GET /v1/templates); send_survey →
            survey_id (GET /v1/surveys); update_field → object and fields (keys
            from GET /v1/fields); create_project → project_template_id (GET
            /v1/project_templates); wait → duration {value, unit}; http_request
            → method and host; slack_message → channel. Empty for any other step
          title: Settings
          type: object
        type:
          enum:
            - trigger
            - condition
            - ai
            - agent
            - send_email
            - send_survey
            - slack_message
            - teams_message
            - read_records
            - update_field
            - create_task
            - create_project
            - create_opportunity
            - create_case
            - add_comment
            - approval
            - wait
            - http_request
            - transform
            - output
            - other
          title: Type
          type: string
      required:
        - id
        - type
        - name
        - next
        - settings
      title: Step
      type: object
    InputToFill:
      properties:
        input:
          description: The input's name in the editor
          title: Input
          type: string
        label:
          description: Its label in the editor
          title: Label
          type: string
        step:
          description: The step's id in `steps`
          title: Step
          type: string
      required:
        - step
        - input
        - label
      title: InputToFill
      type: object
    Trigger:
      properties:
        object:
          anyOf:
            - enum:
                - account
                - contact
                - opportunity
                - project
                - task
                - user
                - activity
                - meeting
              type: string
            - type: 'null'
          description: The record it runs on; null for a schedule or warehouse data
          title: Object
        type:
          description: What starts the flow
          enum:
            - schedule
            - segment
            - field_change
            - new_activity
            - meeting_processed
            - upcoming_meeting
            - warehouse_data
          title: Type
          type: string
      required:
        - type
        - object
      title: Trigger
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.