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

# Update a template

> Patches the template's core fields. Passing `roles`, `questions`, or `mergeFields` replaces those collections wholesale; omit them to leave the existing set alone.



## OpenAPI

````yaml /api-reference/openapi.json patch /api/v1/templates/{templateId}
openapi: 3.0.3
info:
  title: FlowSign API
  version: 1.0.0
  description: >-
    Public v1 API for FlowSign. Every endpoint is authenticated with a Bearer
    API key (prefix `fsk_`). Errors use `{ error, details? }`; success responses
    wrap payload data as `{ data }`.


    An organisation is divided into workspaces. A key belongs to the
    organisation and acts in one workspace per request: pass `X-Workspace-Id`
    (see `GET /api/v1/workspaces`) or omit it to act in the default workspace.
    Packages, templates, contacts and members are scoped to the workspace the
    call acts in.
servers:
  - url: https://my.flowsign.app
    description: Production
security:
  - ApiKey: []
paths:
  /api/v1/templates/{templateId}:
    patch:
      tags:
        - Templates
      summary: Update a template
      description: >-
        Patches the template's core fields. Passing `roles`, `questions`, or
        `mergeFields` replaces those collections wholesale; omit them to leave
        the existing set alone.
      operationId: patchTemplatesByTemplateId
      parameters:
        - schema:
            type: string
          required: true
          name: templateId
          in: path
        - schema:
            type: string
            description: >-
              The workspace to act in, from `GET /api/v1/workspaces`. Omit to
              act in the organisation's default workspace. A workspace the key's
              user cannot act in is treated as omitted.
          required: false
          name: x-workspace-id
          in: header
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  minLength: 1
                description:
                  type: string
                status:
                  type: string
                  enum:
                    - DRAFT
                    - ACTIVE
                    - ARCHIVED
                tags:
                  type: array
                  items:
                    type: string
                reminderDaysAfterSend:
                  type: integer
                  minimum: 0
                expirationDays:
                  type: integer
                  minimum: 0
                expiryWarningDays:
                  type: integer
                  minimum: 0
                emailSubject:
                  type: string
                emailMessage:
                  type: string
                lockDocuments:
                  type: boolean
                lockRoles:
                  type: boolean
                lockFields:
                  type: boolean
                signingMode:
                  type: string
                  enum:
                    - PARALLEL
                    - SEQUENTIAL
                    - WORKFLOW
                brandColor:
                  type: string
                roles:
                  type: array
                  items:
                    type: object
                    properties:
                      name:
                        type: string
                        minLength: 1
                      actionType:
                        type: string
                        enum:
                          - SIGNER
                          - VIEWER
                          - CC
                      order:
                        type: integer
                        minimum: 0
                    required:
                      - name
                      - order
                questions:
                  type: array
                  items:
                    type: object
                    properties:
                      question:
                        type: string
                        minLength: 1
                      type:
                        type: string
                        enum:
                          - TOGGLE
                          - CHOICE
                      order:
                        type: integer
                        minimum: 0
                      dependsOnQuestionIndex:
                        type: integer
                        minimum: 0
                      dependsOnOptionIndex:
                        type: integer
                        minimum: 0
                      options:
                        type: array
                        items:
                          type: object
                          properties:
                            label:
                              type: string
                              minLength: 1
                            order:
                              type: integer
                              minimum: 0
                            isDefault:
                              type: boolean
                            actions:
                              type: array
                              items:
                                type: object
                                properties:
                                  type:
                                    type: string
                                    enum:
                                      - INCLUDE_DOCUMENT
                                      - EXCLUDE_DOCUMENT
                                      - SHOW_FIELD
                                      - HIDE_FIELD
                                  targetDocumentId:
                                    type: string
                                    nullable: true
                                  targetFieldId:
                                    type: string
                                    nullable: true
                                required:
                                  - type
                            regionEffects:
                              type: array
                              items:
                                type: object
                                properties:
                                  regionId:
                                    type: string
                                  action:
                                    type: string
                                    enum:
                                      - SHOW
                                      - HIDE
                                      - SWAP_TO_VARIANT
                                  variantId:
                                    type: string
                                    nullable: true
                                required:
                                  - regionId
                                  - action
                            variableBindings:
                              type: array
                              items:
                                type: object
                                properties:
                                  mergeFieldKey:
                                    type: string
                                  value:
                                    type: string
                                required:
                                  - mergeFieldKey
                                  - value
                          required:
                            - label
                            - order
                    required:
                      - question
                      - order
                mergeFields:
                  type: array
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        minLength: 1
                      label:
                        type: string
                        minLength: 1
                      description:
                        type: string
                      source:
                        type: string
                      defaultValue:
                        type: string
                      isRequired:
                        type: boolean
                      order:
                        type: integer
                        minimum: 0
                    required:
                      - key
                      - label
                      - order
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      templateId:
                        type: string
                      warnings:
                        type: array
                        items:
                          type: string
                    required:
                      - templateId
                required:
                  - data
        '401':
          description: Missing or invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: Caller's plan does not include this feature (publicApi / webhooks)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: API key present but caller lacks the required permission
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Request failed schema validation; details keyed by field
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: Rate limit exceeded; see `Retry-After`
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      type: object
      properties:
        error:
          type: string
        details:
          type: object
          additionalProperties:
            type: array
            items:
              type: string
      required:
        - error
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: fsk_*

````