# Create functional template

- Operation ID: `create-functional-template`
- HTTP method: `POST`
- Path: `/template-backend/template/functional`
- [Human-readable API reference](https://hub.synerise.com/api-reference/campaigns#tag/Templates/operation/create-functional-template)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /template-backend/template/functional:
    post:
      deprecated: true
      summary: Create functional template
      operationId: create-functional-template
      tags:
        - Templates
      description: |
        <span style="color:red">This method is deprecated. It will be disabled on November 22, 2026.</span><br />Create a new functional template. Functional templates are used for cases not covered by the [Create template endpoint](#operation/create-template), such as a password change page.

        ---

        **API consumer:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **User role permission required:** `templates: create`
      requestBody:
        description: Functional template to create
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - directory
                - content
                - functionType
              properties:
                name:
                  type: string
                  description: Template name
                  example: name
                  default: null
                content:
                  type: string
                  description: Template content
                  example: <html><h1>Content</h1></html>
                functionType:
                  type: string
                  description: Function type
                  example: Password Change
                directory:
                  type: string
                  format: uuid
                  description: UUID of the directory where the template will be saved
                  example: e0326a2d-7697-4ae9-b490-31f97041adcb
      responses:
        "200":
          description: Created template
          content:
            application/json:
              schema:
                type: object
                required:
                  - id
                  - hashId
                  - businessProfileId
                  - type
                  - subtype
                  - functionType
                  - thumbnailUrl
                  - createdAt
                  - createdBy
                properties:
                  id:
                    type: integer
                    format: int64
                    description: Template ID
                  hashId:
                    type: string
                    description: Template hashId (UUID)
                    example: e0326a2d-7697-4ae9-b490-31f97041adcb
                  businessProfileId:
                    type: integer
                    description: Workspace ID
                    example: 594
                  type:
                    type: string
                    description: Template type
                    example: EMAIL
                    default: null
                    nullable: true
                    enum:
                      - SMS
                      - MOBILE_PUSH
                      - WEB_PUSH
                      - DYNAMIC_CONTENT
                      - LANDING_PAGE
                      - EMAIL
                      - SOCIAL_MEDIA
                      - IN_APP
                      - null
                  subtype:
                    type: string
                    description: |
                      Template subtype. Currently accepted subtypes are
                      - `BANNER` (can be used with mobile push)
                      - `TOP_BAR`, `BOTTOM_BAR`, `MODAL` (can be used with in app notifications)
                      - `null`.
                    example: BANNER
                    nullable: true
                    default: null
                    enum:
                      - BANNER
                      - TOP_BAR
                      - BOTTOM_BAR
                      - MODAL
                      - null
                  functionType:
                    nullable: true
                    type: string
                    description: Function type
                    example: Password Change
                  thumbnailUrl:
                    type: string
                    description: URL of the template's thumbnail
                    example: https://foo.bar
                  createdAt:
                    type: string
                    description: Time of creation
                    format: date-time
                    example: 2019-03-21T12:31:26Z
                  createdBy:
                    type: integer
                    format: int64
                    description: Author ID
                    example: 123
      security:
        - JWT: []
      x-snr-doc-urls:
        - /api-reference/campaigns#tag/Templates/operation/create-functional-template
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/template-backend/template/functional \
              --header 'Authorization: Bearer REPLACE_BEARER_TOKEN' \
              --header 'content-type: application/json' \
              --data '{"name":"name","content":"<html><h1>Content</h1></html>","functionType":"Password Change","directory":"e0326a2d-7697-4ae9-b490-31f97041adcb"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"name\":\"name\",\"content\":\"<html><h1>Content</h1></html>\",\"functionType\":\"Password Change\",\"directory\":\"e0326a2d-7697-4ae9-b490-31f97041adcb\"}"

            headers = {
                'Authorization': "Bearer REPLACE_BEARER_TOKEN",
                'content-type': "application/json"
                }

            conn.request("POST", "/template-backend/template/functional", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "name": "name",
              "content": "<html><h1>Content</h1></html>",
              "functionType": "Password Change",
              "directory": "e0326a2d-7697-4ae9-b490-31f97041adcb"
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/template-backend/template/functional");
            xhr.setRequestHeader("Authorization", "Bearer REPLACE_BEARER_TOKEN");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/template-backend/template/functional",
              "headers": {
                "Authorization": "Bearer REPLACE_BEARER_TOKEN",
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({
              name: 'name',
              content: '<html><h1>Content</h1></html>',
              functionType: 'Password Change',
              directory: 'e0326a2d-7697-4ae9-b490-31f97041adcb'
            }));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/template-backend/template/functional');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'Authorization' => 'Bearer REPLACE_BEARER_TOKEN',
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"name":"name","content":"<html><h1>Content</h1></html>","functionType":"Password Change","directory":"e0326a2d-7697-4ae9-b490-31f97041adcb"}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/template-backend/template/functional")
              .header("Authorization", "Bearer REPLACE_BEARER_TOKEN")
              .header("content-type", "application/json")
              .body("{\"name\":\"name\",\"content\":\"<html><h1>Content</h1></html>\",\"functionType\":\"Password Change\",\"directory\":\"e0326a2d-7697-4ae9-b490-31f97041adcb\"}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Templates
components:
  securitySchemes:
    JWT:
      type: http
      scheme: bearer
      description: |-
        JWT Bearer token. The header looks like this: `Bearer {JWT}`

        Remember to include the space between 'Bearer' and the token.

        Generate a token via the **Authorization** endpoints.
```
