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

# Create or edit a template message

> Creates a template message in one of the creator's folders, or edits an existing one. Provide a `folderUuid` from GET /chats/templates/folders. Omit `messageUuid` to create the template (201); provide it to edit that template in place (200). A template must have text or at least one media attachment. An edit replaces the fields you send, so send the full template body rather than only the fields you are changing.

<Info>
  **Required scope**

  * `write:chat` — Create new chats and send messages. This scope is required for any chat-related actions that modify data.
</Info>


## OpenAPI

````yaml /openapi-v1.json post /v1/chats/templates
openapi: 3.1.0
info:
  title: Fanvue API
  version: '0.1'
servers:
  - url: https://api.fanvue.com
security: []
paths:
  /v1/chats/templates:
    post:
      summary: Create or edit a template message
      description: >-
        Creates a template message in one of the creator's folders, or edits an
        existing one. Provide a `folderUuid` from GET /chats/templates/folders.
        Omit `messageUuid` to create the template (201); provide it to edit that
        template in place (200). A template must have text or at least one media
        attachment. An edit replaces the fields you send, so send the full
        template body rather than only the fields you are changing.
      operationId: upsertTemplateMessage
      parameters:
        - $ref: '#/components/parameters/ApiVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                messageUuid:
                  type: string
                  format: uuid
                  description: >-
                    UUID of an existing template to edit. Omit to create a new
                    template; provide it to edit that template in place.
                folderUuid:
                  type: string
                  format: uuid
                  description: >-
                    UUID of the folder to hold the template (see GET
                    /chats/templates/folders)
                text:
                  type: string
                  description: Message text content
                price:
                  anyOf:
                    - type: number
                      enum:
                        - 0
                    - type: number
                      minimum: 300
                      maximum: 250000
                    - type: 'null'
                  description: Message price in cents (0 or null for free messages)
                mediaUuids:
                  type: array
                  items:
                    type: string
                    format: uuid
                  description: Media UUIDs to attach to the template, in display order
                mediaPreviewUuid:
                  type: string
                  format: uuid
                  description: Media UUID to use as the paywall preview
                name:
                  type: string
                  description: Optional template name
              required:
                - folderUuid
      responses:
        '200':
          description: Template message updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    type: string
                    format: uuid
                    description: Template message UUID
                  name:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Template name as given on create, or null when the
                      template is unnamed
                  text:
                    type:
                      - string
                      - 'null'
                    description: Message text content
                  price:
                    type:
                      - number
                      - 'null'
                    description: Message price in cents (null for free messages)
                  mediaUuids:
                    type: array
                    items:
                      type: string
                      format: uuid
                    description: Array of media UUIDs attached to the message
                  mediaPreviewUuid:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: >-
                      Media UUID used as the paywall preview (null when the
                      template has none)
                  folderUuid:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: UUID of the folder containing this template
                  folderName:
                    type:
                      - string
                      - 'null'
                    description: Name of the folder containing this template
                required:
                  - uuid
                  - name
                  - text
                  - price
                  - mediaUuids
                  - mediaPreviewUuid
                  - folderUuid
                  - folderName
              example:
                uuid: 123e4567-e89b-12d3-a456-426614174003
                name: Welcome gift
                text: Welcome! Here's a little something to say thanks 💖
                price: 500
                folderUuid: b0a1c2d3-e4f5-6789-abcd-ef0123456789
                folderName: Welcome Messages
                mediaUuids:
                  - 7c9e6679-7425-40de-944b-e07fc1f90ae7
                mediaPreviewUuid: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
        '201':
          description: Template message created
          content:
            application/json:
              schema:
                type: object
                properties:
                  uuid:
                    type: string
                    format: uuid
                    description: Template message UUID
                  name:
                    type:
                      - string
                      - 'null'
                    description: >-
                      Template name as given on create, or null when the
                      template is unnamed
                  text:
                    type:
                      - string
                      - 'null'
                    description: Message text content
                  price:
                    type:
                      - number
                      - 'null'
                    description: Message price in cents (null for free messages)
                  mediaUuids:
                    type: array
                    items:
                      type: string
                      format: uuid
                    description: Array of media UUIDs attached to the message
                  mediaPreviewUuid:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: >-
                      Media UUID used as the paywall preview (null when the
                      template has none)
                  folderUuid:
                    type:
                      - string
                      - 'null'
                    format: uuid
                    description: UUID of the folder containing this template
                  folderName:
                    type:
                      - string
                      - 'null'
                    description: Name of the folder containing this template
                required:
                  - uuid
                  - name
                  - text
                  - price
                  - mediaUuids
                  - mediaPreviewUuid
                  - folderUuid
                  - folderName
              example:
                uuid: 123e4567-e89b-12d3-a456-426614174003
                name: Welcome gift
                text: Welcome! Here's a little something to say thanks 💖
                price: 500
                folderUuid: b0a1c2d3-e4f5-6789-abcd-ef0123456789
                folderName: Welcome Messages
                mediaUuids:
                  - 7c9e6679-7425-40de-944b-e07fc1f90ae7
                mediaPreviewUuid: 6ba7b810-9dad-11d1-80b4-00c04fd430c8
        '400':
          description: Bad Request - API version not supported OR validation failed
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/UnsupportedVersionError'
                  - $ref: '#/components/schemas/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedResponse'
        '403':
          $ref: '#/components/responses/UnauthorizedResponse'
        '404':
          description: Folder or template message not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                required:
                  - message
        '410':
          $ref: '#/components/responses/SunsetVersionResponse'
        '429':
          $ref: '#/components/responses/RateLimitResponse'
      security:
        - BearerAuth:
            - write:chat
components:
  parameters:
    ApiVersionHeader:
      name: X-Fanvue-API-Version
      in: header
      required: true
      schema:
        type: string
        default: '2025-06-26'
        example: '2025-06-26'
      description: API version to use for the request
  schemas:
    UnsupportedVersionError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error
        - message
      description: API version not supported
    ValidationError:
      type: object
      properties:
        errors:
          type: array
          items:
            type: string
      required:
        - errors
      description: Request validation failed
  responses:
    UnauthorizedResponse:
      description: Unauthorized Response
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            required:
              - error
    SunsetVersionResponse:
      description: API version no longer supported (sunset)
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
              message:
                type: string
              nextVersion:
                type: string
            required:
              - error
              - message
    RateLimitResponse:
      description: Too many requests - rate limit exceeded
      headers:
        Retry-After:
          description: Number of seconds to wait before retrying the request
          schema:
            type: integer
        X-RateLimit-Limit:
          description: The maximum number of requests allowed in the current window
          schema:
            type: integer
        X-RateLimit-Remaining:
          description: The number of requests remaining in the current window
          schema:
            type: integer
        X-RateLimit-Reset:
          description: The Unix timestamp (seconds) when the rate limit window resets
          schema:
            type: integer
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
            required:
              - error
  securitySchemes:
    BearerAuth:
      type: oauth2
      description: >-
        OAuth 2.0 access token, presented as a JWT bearer token in the
        `Authorization` header. Obtain a token via the authorization-code flow;
        the scopes granted to the token determine which operations it may call.
      flows:
        authorizationCode:
          authorizationUrl: https://auth.fanvue.com/oauth2/auth
          tokenUrl: https://auth.fanvue.com/oauth2/token
          refreshUrl: https://auth.fanvue.com/oauth2/token
          scopes:
            read:self: >-
              Access your own user profile information, including basic account
              details and settings.
            read:chat: >-
              Read chat conversations, messages, and chat-related data. This
              includes viewing chat lists and message history.
            write:chat: >-
              Create new chats and send messages. This scope is required for any
              chat-related actions that modify data.
            read:experience: >-
              Exchange a fan's experience token for the resolved experience and
              the fan's identity, so an embedded fan-facing experience can
              render the right content.
            write:experience: >-
              Request that the creator publish or unpublish a fan-facing
              experience. The app mints a request token; the creator confirms
              and Fanvue performs the change.
            read:fan: Access fan-related data and information within the platform.
            read:post: Read posts, including post details, comments, likes, and tips.
            write:post: Create, edit, and manage posts and content on behalf of users.
            read:media: Access media files, images, videos, and other content assets.
            write:media: >-
              Upload, modify, and manage media files and content assets. Also
              required for vault folder management.
            read:creator: >-
              Access creator profiles, content, and creator-specific
              information.
            write:creator: Modify creator profiles, settings, and creator-specific data.
            read:insights: >-
              Access analytics, metrics, and insights data for performance
              tracking.
            read:tracking_links: >-
              Read tracking links and the users associated with them, including
              per-user tracking metadata.
            write:tracking_links: Create and delete tracking links.
            read:agency: Read agency information, including the agency's team members.
            write:agency: >-
              Manage agency team members and invites, including inviting new
              team members and creators.

````