For clean Markdown of any page, append .md to the page URL. For a complete documentation index, see https://developers.hellosign.com/api/template/llms.txt. For full documentation content, see https://developers.hellosign.com/api/template/llms-full.txt.

# Create Template

POST https://api.hellosign.com/v3/template/create
Content-Type: application/json

Creates a template that can be used in future signature requests.

If `client_id` is provided, the template will be created as an embedded template. Embedded templates can be used for embedded signature requests and can be edited later by generating a new `edit_url` with [/embedded/edit_url/{template_id}](/api/reference/operation/embeddedEditUrl/).

Template creation may complete asynchronously after the initial request is accepted. It is recommended that a callback be implemented to listen for the callback event. A `template_created` event indicates the template is ready to use, while a `template_error` event indicates there was a problem while creating the template. If a callback handler has been configured and the event has not been received within 60 minutes of making the call, check the status of the request in the API dashboard and retry the request if necessary.

Reference: https://developers.hellosign.com/api/template/create

## SDK Code Examples

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$field_options = (new Dropbox\Sign\Model\SubFieldOptions())
    ->setDateFormat(Dropbox\Sign\Model\SubFieldOptions::DATE_FORMAT_DD_MM_YYYY);

$signer_roles_1 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Client")
    ->setOrder(0);

$signer_roles_2 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Witness")
    ->setOrder(1);

$signer_roles = [
    $signer_roles_1,
    $signer_roles_2,
];

$form_fields_per_document_1 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentText())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_1")
    ->setType("text")
    ->setRequired(true)
    ->setSigner("1")
    ->setWidth(100)
    ->setHeight(16)
    ->setX(112)
    ->setY(328)
    ->setName("")
    ->setPage(1)
    ->setPlaceholder("")
    ->setValidationType(Dropbox\Sign\Model\SubFormFieldsPerDocumentText::VALIDATION_TYPE_NUMBERS_ONLY);

$form_fields_per_document_2 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentSignature())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_2")
    ->setType("signature")
    ->setRequired(true)
    ->setSigner("0")
    ->setWidth(120)
    ->setHeight(30)
    ->setX(530)
    ->setY(415)
    ->setName("")
    ->setPage(1);

$form_fields_per_document = [
    $form_fields_per_document_1,
    $form_fields_per_document_2,
];

$merge_fields_1 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Full Name")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_TEXT);

$merge_fields_2 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Is Registered?")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_CHECKBOX);

$merge_fields = [
    $merge_fields_1,
    $merge_fields_2,
];

$template_create_request = (new Dropbox\Sign\Model\TemplateCreateRequest())
    ->setClientId("37dee8d8440c66d54cfa05d92c160882")
    ->setMessage("For your approval")
    ->setSubject("Please sign this document")
    ->setTestMode(true)
    ->setTitle("Test Template")
    ->setCcRoles([
        "Manager",
    ])
    ->setFiles([
    ])
    ->setFieldOptions($field_options)
    ->setSignerRoles($signer_roles)
    ->setFormFieldsPerDocument($form_fields_per_document)
    ->setMergeFields($merge_fields);

try {
    $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateCreate(
        template_create_request: $template_create_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class TemplateCreateExample
{
    public static void Run()
    {
        var config = new Configuration();
        config.Username = "YOUR_API_KEY";
        // config.AccessToken = "YOUR_ACCESS_TOKEN";

        var fieldOptions = new SubFieldOptions(
            dateFormat: SubFieldOptions.DateFormatEnum.DD_MM_YYYY
        );

        var signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

        var signerRoles2 = new SubTemplateRole(
            name: "Witness",
            order: 1
        );

        var signerRoles = new List<SubTemplateRole>
        {
            signerRoles1,
            signerRoles2,
        };

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText(
            documentIndex: 0,
            apiId: "uniqueIdHere_1",
            type: "text",
            required: true,
            signer: "1",
            width: 100,
            height: 16,
            x: 112,
            y: 328,
            name: "",
            page: 1,
            placeholder: "",
            validationType: SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly
        );

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature(
            documentIndex: 0,
            apiId: "uniqueIdHere_2",
            type: "signature",
            required: true,
            signer: "0",
            width: 120,
            height: 30,
            x: 530,
            y: 415,
            name: "",
            page: 1
        );

        var formFieldsPerDocument = new List<SubFormFieldsPerDocumentBase>
        {
            formFieldsPerDocument1,
            formFieldsPerDocument2,
        };

        var mergeFields1 = new SubMergeField(
            name: "Full Name",
            type: SubMergeField.TypeEnum.Text
        );

        var mergeFields2 = new SubMergeField(
            name: "Is Registered?",
            type: SubMergeField.TypeEnum.Checkbox
        );

        var mergeFields = new List<SubMergeField>
        {
            mergeFields1,
            mergeFields2,
        };

        var templateCreateRequest = new TemplateCreateRequest(
            clientId: "37dee8d8440c66d54cfa05d92c160882",
            message: "For your approval",
            subject: "Please sign this document",
            testMode: true,
            title: "Test Template",
            ccRoles: [
                "Manager",
            ],
            files: new List<Stream>
            {
                new FileStream(
                    path: "./example_signature_request.pdf",
                    mode: FileMode.Open
                ),
            },
            fieldOptions: fieldOptions,
            signerRoles: signerRoles,
            formFieldsPerDocument: formFieldsPerDocument,
            mergeFields: mergeFields
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreate(
                templateCreateRequest: templateCreateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.TemplateApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const fieldOptions: models.SubFieldOptions = {
  dateFormat: models.SubFieldOptions.DateFormatEnum.DdMmYyyy,
};

const signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

const signerRoles2: models.SubTemplateRole = {
  name: "Witness",
  order: 1,
};

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const formFieldsPerDocument1: models.SubFormFieldsPerDocumentText = {
  documentIndex: 0,
  apiId: "uniqueIdHere_1",
  type: "text",
  required: true,
  signer: "1",
  width: 100,
  height: 16,
  x: 112,
  y: 328,
  name: "",
  page: 1,
  placeholder: "",
  validationType: models.SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly,
};

const formFieldsPerDocument2: models.SubFormFieldsPerDocumentSignature = {
  documentIndex: 0,
  apiId: "uniqueIdHere_2",
  type: "signature",
  required: true,
  signer: "0",
  width: 120,
  height: 30,
  x: 530,
  y: 415,
  name: "",
  page: 1,
};

const formFieldsPerDocument = [
  formFieldsPerDocument1,
  formFieldsPerDocument2,
];

const mergeFields1: models.SubMergeField = {
  name: "Full Name",
  type: models.SubMergeField.TypeEnum.Text,
};

const mergeFields2: models.SubMergeField = {
  name: "Is Registered?",
  type: models.SubMergeField.TypeEnum.Checkbox,
};

const mergeFields = [
  mergeFields1,
  mergeFields2,
];

const templateCreateRequest: models.TemplateCreateRequest = {
  clientId: "37dee8d8440c66d54cfa05d92c160882",
  message: "For your approval",
  subject: "Please sign this document",
  testMode: true,
  title: "Test Template",
  ccRoles: [
    "Manager",
  ],
  files: [
    fs.createReadStream("./example_signature_request.pdf"),
  ],
  fieldOptions: fieldOptions,
  signerRoles: signerRoles,
  formFieldsPerDocument: formFieldsPerDocument,
  mergeFields: mergeFields,
};

apiCaller.templateCreate(
  templateCreateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TemplateCreateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();
        ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
        // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

        var fieldOptions = new SubFieldOptions();
        fieldOptions.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);

        var signerRoles1 = new SubTemplateRole();
        signerRoles1.name("Client");
        signerRoles1.order(0);

        var signerRoles2 = new SubTemplateRole();
        signerRoles2.name("Witness");
        signerRoles2.order(1);

        var signerRoles = new ArrayList<SubTemplateRole>(List.of (
            signerRoles1,
            signerRoles2
        ));

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText();
        formFieldsPerDocument1.documentIndex(0);
        formFieldsPerDocument1.apiId("uniqueIdHere_1");
        formFieldsPerDocument1.type("text");
        formFieldsPerDocument1.required(true);
        formFieldsPerDocument1.signer("1");
        formFieldsPerDocument1.width(100);
        formFieldsPerDocument1.height(16);
        formFieldsPerDocument1.x(112);
        formFieldsPerDocument1.y(328);
        formFieldsPerDocument1.name("");
        formFieldsPerDocument1.page(1);
        formFieldsPerDocument1.placeholder("");
        formFieldsPerDocument1.validationType(SubFormFieldsPerDocumentText.ValidationTypeEnum.NUMBERS_ONLY);

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature();
        formFieldsPerDocument2.documentIndex(0);
        formFieldsPerDocument2.apiId("uniqueIdHere_2");
        formFieldsPerDocument2.type("signature");
        formFieldsPerDocument2.required(true);
        formFieldsPerDocument2.signer("0");
        formFieldsPerDocument2.width(120);
        formFieldsPerDocument2.height(30);
        formFieldsPerDocument2.x(530);
        formFieldsPerDocument2.y(415);
        formFieldsPerDocument2.name("");
        formFieldsPerDocument2.page(1);

        var formFieldsPerDocument = new ArrayList<SubFormFieldsPerDocumentBase>(List.of (
            formFieldsPerDocument1,
            formFieldsPerDocument2
        ));

        var mergeFields1 = new SubMergeField();
        mergeFields1.name("Full Name");
        mergeFields1.type(SubMergeField.TypeEnum.TEXT);

        var mergeFields2 = new SubMergeField();
        mergeFields2.name("Is Registered?");
        mergeFields2.type(SubMergeField.TypeEnum.CHECKBOX);

        var mergeFields = new ArrayList<SubMergeField>(List.of (
            mergeFields1,
            mergeFields2
        ));

        var templateCreateRequest = new TemplateCreateRequest();
        templateCreateRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateRequest.message("For your approval");
        templateCreateRequest.subject("Please sign this document");
        templateCreateRequest.testMode(true);
        templateCreateRequest.title("Test Template");
        templateCreateRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateRequest.fieldOptions(fieldOptions);
        templateCreateRequest.signerRoles(signerRoles);
        templateCreateRequest.formFieldsPerDocument(formFieldsPerDocument);
        templateCreateRequest.mergeFields(mergeFields);

        try
        {
            var response = new TemplateApi(config).templateCreate(
                templateCreateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
    config.username = "YOUR_API_KEY"
    # config.access_token = "YOUR_ACCESS_TOKEN"
end

field_options = Dropbox::Sign::SubFieldOptions.new
field_options.date_format = "DD - MM - YYYY"

signer_roles_1 = Dropbox::Sign::SubTemplateRole.new
signer_roles_1.name = "Client"
signer_roles_1.order = 0

signer_roles_2 = Dropbox::Sign::SubTemplateRole.new
signer_roles_2.name = "Witness"
signer_roles_2.order = 1

signer_roles = [
    signer_roles_1,
    signer_roles_2,
]

form_fields_per_document_1 = Dropbox::Sign::SubFormFieldsPerDocumentText.new
form_fields_per_document_1.document_index = 0
form_fields_per_document_1.api_id = "uniqueIdHere_1"
form_fields_per_document_1.type = "text"
form_fields_per_document_1.required = true
form_fields_per_document_1.signer = "1"
form_fields_per_document_1.width = 100
form_fields_per_document_1.height = 16
form_fields_per_document_1.x = 112
form_fields_per_document_1.y = 328
form_fields_per_document_1.name = ""
form_fields_per_document_1.page = 1
form_fields_per_document_1.placeholder = ""
form_fields_per_document_1.validation_type = "numbers_only"

form_fields_per_document_2 = Dropbox::Sign::SubFormFieldsPerDocumentSignature.new
form_fields_per_document_2.document_index = 0
form_fields_per_document_2.api_id = "uniqueIdHere_2"
form_fields_per_document_2.type = "signature"
form_fields_per_document_2.required = true
form_fields_per_document_2.signer = "0"
form_fields_per_document_2.width = 120
form_fields_per_document_2.height = 30
form_fields_per_document_2.x = 530
form_fields_per_document_2.y = 415
form_fields_per_document_2.name = ""
form_fields_per_document_2.page = 1

form_fields_per_document = [
    form_fields_per_document_1,
    form_fields_per_document_2,
]

merge_fields_1 = Dropbox::Sign::SubMergeField.new
merge_fields_1.name = "Full Name"
merge_fields_1.type = "text"

merge_fields_2 = Dropbox::Sign::SubMergeField.new
merge_fields_2.name = "Is Registered?"
merge_fields_2.type = "checkbox"

merge_fields = [
    merge_fields_1,
    merge_fields_2,
]

template_create_request = Dropbox::Sign::TemplateCreateRequest.new
template_create_request.client_id = "37dee8d8440c66d54cfa05d92c160882"
template_create_request.message = "For your approval"
template_create_request.subject = "Please sign this document"
template_create_request.test_mode = true
template_create_request.title = "Test Template"
template_create_request.cc_roles = [
    "Manager",
]
template_create_request.files = [
    File.new("./example_signature_request.pdf", "r"),
]
template_create_request.field_options = field_options
template_create_request.signer_roles = signer_roles
template_create_request.form_fields_per_document = form_fields_per_document
template_create_request.merge_fields = merge_fields

begin
    response = Dropbox::Sign::TemplateApi.new.template_create(
        template_create_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
    username="YOUR_API_KEY",
    # access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    signer_roles_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    signer_roles_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    signer_roles = [
        signer_roles_1,
        signer_roles_2,
    ]

    form_fields_per_document_1 = models.SubFormFieldsPerDocumentText(
        document_index=0,
        api_id="uniqueIdHere_1",
        type="text",
        required=True,
        signer="1",
        width=100,
        height=16,
        x=112,
        y=328,
        name="",
        page=1,
        placeholder="",
        validation_type="numbers_only",
    )

    form_fields_per_document_2 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="uniqueIdHere_2",
        type="signature",
        required=True,
        signer="0",
        width=120,
        height=30,
        x=530,
        y=415,
        name="",
        page=1,
    )

    form_fields_per_document = [
        form_fields_per_document_1,
        form_fields_per_document_2,
    ]

    merge_fields_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_fields_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    merge_fields = [
        merge_fields_1,
        merge_fields_2,
    ]

    template_create_request = models.TemplateCreateRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        message="For your approval",
        subject="Please sign this document",
        test_mode=True,
        title="Test Template",
        cc_roles=[
            "Manager",
        ],
        files=[
            open("./example_signature_request.pdf", "rb").read(),
        ],
        field_options=field_options,
        signer_roles=signer_roles,
        form_fields_per_document=form_fields_per_document,
        merge_fields=merge_fields,
    )

    try:
        response = api.TemplateApi(api_client).template_create(
            template_create_request=template_create_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create: %s\n" % e)

```

```go Create Template
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hellosign.com/v3/template/create"

	req, _ := http.NewRequest("POST", url, nil)

	req.SetBasicAuth("<apiKey>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Create Template
import Foundation

let credentials = Data("<apiKey>:".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$field_options = (new Dropbox\Sign\Model\SubFieldOptions())
    ->setDateFormat(Dropbox\Sign\Model\SubFieldOptions::DATE_FORMAT_DD_MM_YYYY);

$signer_roles_1 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Client")
    ->setOrder(0);

$signer_roles_2 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Witness")
    ->setOrder(1);

$signer_roles = [
    $signer_roles_1,
    $signer_roles_2,
];

$form_fields_per_document_1 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentText())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_1")
    ->setType("text")
    ->setRequired(true)
    ->setSigner("1")
    ->setWidth(100)
    ->setHeight(16)
    ->setX(112)
    ->setY(328)
    ->setName("")
    ->setPage(1)
    ->setPlaceholder("")
    ->setValidationType(Dropbox\Sign\Model\SubFormFieldsPerDocumentText::VALIDATION_TYPE_NUMBERS_ONLY);

$form_fields_per_document_2 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentSignature())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_2")
    ->setType("signature")
    ->setRequired(true)
    ->setSigner("0")
    ->setWidth(120)
    ->setHeight(30)
    ->setX(530)
    ->setY(415)
    ->setName("")
    ->setPage(1);

$form_fields_per_document = [
    $form_fields_per_document_1,
    $form_fields_per_document_2,
];

$merge_fields_1 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Full Name")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_TEXT);

$merge_fields_2 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Is Registered?")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_CHECKBOX);

$merge_fields = [
    $merge_fields_1,
    $merge_fields_2,
];

$template_create_request = (new Dropbox\Sign\Model\TemplateCreateRequest())
    ->setClientId("37dee8d8440c66d54cfa05d92c160882")
    ->setMessage("For your approval")
    ->setSubject("Please sign this document")
    ->setTestMode(true)
    ->setTitle("Test Template")
    ->setCcRoles([
        "Manager",
    ])
    ->setFiles([
    ])
    ->setFieldOptions($field_options)
    ->setSignerRoles($signer_roles)
    ->setFormFieldsPerDocument($form_fields_per_document)
    ->setMergeFields($merge_fields);

try {
    $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateCreate(
        template_create_request: $template_create_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class TemplateCreateExample
{
    public static void Run()
    {
        var config = new Configuration();
        config.Username = "YOUR_API_KEY";
        // config.AccessToken = "YOUR_ACCESS_TOKEN";

        var fieldOptions = new SubFieldOptions(
            dateFormat: SubFieldOptions.DateFormatEnum.DD_MM_YYYY
        );

        var signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

        var signerRoles2 = new SubTemplateRole(
            name: "Witness",
            order: 1
        );

        var signerRoles = new List<SubTemplateRole>
        {
            signerRoles1,
            signerRoles2,
        };

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText(
            documentIndex: 0,
            apiId: "uniqueIdHere_1",
            type: "text",
            required: true,
            signer: "1",
            width: 100,
            height: 16,
            x: 112,
            y: 328,
            name: "",
            page: 1,
            placeholder: "",
            validationType: SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly
        );

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature(
            documentIndex: 0,
            apiId: "uniqueIdHere_2",
            type: "signature",
            required: true,
            signer: "0",
            width: 120,
            height: 30,
            x: 530,
            y: 415,
            name: "",
            page: 1
        );

        var formFieldsPerDocument = new List<SubFormFieldsPerDocumentBase>
        {
            formFieldsPerDocument1,
            formFieldsPerDocument2,
        };

        var mergeFields1 = new SubMergeField(
            name: "Full Name",
            type: SubMergeField.TypeEnum.Text
        );

        var mergeFields2 = new SubMergeField(
            name: "Is Registered?",
            type: SubMergeField.TypeEnum.Checkbox
        );

        var mergeFields = new List<SubMergeField>
        {
            mergeFields1,
            mergeFields2,
        };

        var templateCreateRequest = new TemplateCreateRequest(
            clientId: "37dee8d8440c66d54cfa05d92c160882",
            message: "For your approval",
            subject: "Please sign this document",
            testMode: true,
            title: "Test Template",
            ccRoles: [
                "Manager",
            ],
            files: new List<Stream>
            {
                new FileStream(
                    path: "./example_signature_request.pdf",
                    mode: FileMode.Open
                ),
            },
            fieldOptions: fieldOptions,
            signerRoles: signerRoles,
            formFieldsPerDocument: formFieldsPerDocument,
            mergeFields: mergeFields
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreate(
                templateCreateRequest: templateCreateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.TemplateApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const fieldOptions: models.SubFieldOptions = {
  dateFormat: models.SubFieldOptions.DateFormatEnum.DdMmYyyy,
};

const signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

const signerRoles2: models.SubTemplateRole = {
  name: "Witness",
  order: 1,
};

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const formFieldsPerDocument1: models.SubFormFieldsPerDocumentText = {
  documentIndex: 0,
  apiId: "uniqueIdHere_1",
  type: "text",
  required: true,
  signer: "1",
  width: 100,
  height: 16,
  x: 112,
  y: 328,
  name: "",
  page: 1,
  placeholder: "",
  validationType: models.SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly,
};

const formFieldsPerDocument2: models.SubFormFieldsPerDocumentSignature = {
  documentIndex: 0,
  apiId: "uniqueIdHere_2",
  type: "signature",
  required: true,
  signer: "0",
  width: 120,
  height: 30,
  x: 530,
  y: 415,
  name: "",
  page: 1,
};

const formFieldsPerDocument = [
  formFieldsPerDocument1,
  formFieldsPerDocument2,
];

const mergeFields1: models.SubMergeField = {
  name: "Full Name",
  type: models.SubMergeField.TypeEnum.Text,
};

const mergeFields2: models.SubMergeField = {
  name: "Is Registered?",
  type: models.SubMergeField.TypeEnum.Checkbox,
};

const mergeFields = [
  mergeFields1,
  mergeFields2,
];

const templateCreateRequest: models.TemplateCreateRequest = {
  clientId: "37dee8d8440c66d54cfa05d92c160882",
  message: "For your approval",
  subject: "Please sign this document",
  testMode: true,
  title: "Test Template",
  ccRoles: [
    "Manager",
  ],
  files: [
    fs.createReadStream("./example_signature_request.pdf"),
  ],
  fieldOptions: fieldOptions,
  signerRoles: signerRoles,
  formFieldsPerDocument: formFieldsPerDocument,
  mergeFields: mergeFields,
};

apiCaller.templateCreate(
  templateCreateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TemplateCreateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();
        ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
        // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

        var fieldOptions = new SubFieldOptions();
        fieldOptions.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);

        var signerRoles1 = new SubTemplateRole();
        signerRoles1.name("Client");
        signerRoles1.order(0);

        var signerRoles2 = new SubTemplateRole();
        signerRoles2.name("Witness");
        signerRoles2.order(1);

        var signerRoles = new ArrayList<SubTemplateRole>(List.of (
            signerRoles1,
            signerRoles2
        ));

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText();
        formFieldsPerDocument1.documentIndex(0);
        formFieldsPerDocument1.apiId("uniqueIdHere_1");
        formFieldsPerDocument1.type("text");
        formFieldsPerDocument1.required(true);
        formFieldsPerDocument1.signer("1");
        formFieldsPerDocument1.width(100);
        formFieldsPerDocument1.height(16);
        formFieldsPerDocument1.x(112);
        formFieldsPerDocument1.y(328);
        formFieldsPerDocument1.name("");
        formFieldsPerDocument1.page(1);
        formFieldsPerDocument1.placeholder("");
        formFieldsPerDocument1.validationType(SubFormFieldsPerDocumentText.ValidationTypeEnum.NUMBERS_ONLY);

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature();
        formFieldsPerDocument2.documentIndex(0);
        formFieldsPerDocument2.apiId("uniqueIdHere_2");
        formFieldsPerDocument2.type("signature");
        formFieldsPerDocument2.required(true);
        formFieldsPerDocument2.signer("0");
        formFieldsPerDocument2.width(120);
        formFieldsPerDocument2.height(30);
        formFieldsPerDocument2.x(530);
        formFieldsPerDocument2.y(415);
        formFieldsPerDocument2.name("");
        formFieldsPerDocument2.page(1);

        var formFieldsPerDocument = new ArrayList<SubFormFieldsPerDocumentBase>(List.of (
            formFieldsPerDocument1,
            formFieldsPerDocument2
        ));

        var mergeFields1 = new SubMergeField();
        mergeFields1.name("Full Name");
        mergeFields1.type(SubMergeField.TypeEnum.TEXT);

        var mergeFields2 = new SubMergeField();
        mergeFields2.name("Is Registered?");
        mergeFields2.type(SubMergeField.TypeEnum.CHECKBOX);

        var mergeFields = new ArrayList<SubMergeField>(List.of (
            mergeFields1,
            mergeFields2
        ));

        var templateCreateRequest = new TemplateCreateRequest();
        templateCreateRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateRequest.message("For your approval");
        templateCreateRequest.subject("Please sign this document");
        templateCreateRequest.testMode(true);
        templateCreateRequest.title("Test Template");
        templateCreateRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateRequest.fieldOptions(fieldOptions);
        templateCreateRequest.signerRoles(signerRoles);
        templateCreateRequest.formFieldsPerDocument(formFieldsPerDocument);
        templateCreateRequest.mergeFields(mergeFields);

        try
        {
            var response = new TemplateApi(config).templateCreate(
                templateCreateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
    config.username = "YOUR_API_KEY"
    # config.access_token = "YOUR_ACCESS_TOKEN"
end

field_options = Dropbox::Sign::SubFieldOptions.new
field_options.date_format = "DD - MM - YYYY"

signer_roles_1 = Dropbox::Sign::SubTemplateRole.new
signer_roles_1.name = "Client"
signer_roles_1.order = 0

signer_roles_2 = Dropbox::Sign::SubTemplateRole.new
signer_roles_2.name = "Witness"
signer_roles_2.order = 1

signer_roles = [
    signer_roles_1,
    signer_roles_2,
]

form_fields_per_document_1 = Dropbox::Sign::SubFormFieldsPerDocumentText.new
form_fields_per_document_1.document_index = 0
form_fields_per_document_1.api_id = "uniqueIdHere_1"
form_fields_per_document_1.type = "text"
form_fields_per_document_1.required = true
form_fields_per_document_1.signer = "1"
form_fields_per_document_1.width = 100
form_fields_per_document_1.height = 16
form_fields_per_document_1.x = 112
form_fields_per_document_1.y = 328
form_fields_per_document_1.name = ""
form_fields_per_document_1.page = 1
form_fields_per_document_1.placeholder = ""
form_fields_per_document_1.validation_type = "numbers_only"

form_fields_per_document_2 = Dropbox::Sign::SubFormFieldsPerDocumentSignature.new
form_fields_per_document_2.document_index = 0
form_fields_per_document_2.api_id = "uniqueIdHere_2"
form_fields_per_document_2.type = "signature"
form_fields_per_document_2.required = true
form_fields_per_document_2.signer = "0"
form_fields_per_document_2.width = 120
form_fields_per_document_2.height = 30
form_fields_per_document_2.x = 530
form_fields_per_document_2.y = 415
form_fields_per_document_2.name = ""
form_fields_per_document_2.page = 1

form_fields_per_document = [
    form_fields_per_document_1,
    form_fields_per_document_2,
]

merge_fields_1 = Dropbox::Sign::SubMergeField.new
merge_fields_1.name = "Full Name"
merge_fields_1.type = "text"

merge_fields_2 = Dropbox::Sign::SubMergeField.new
merge_fields_2.name = "Is Registered?"
merge_fields_2.type = "checkbox"

merge_fields = [
    merge_fields_1,
    merge_fields_2,
]

template_create_request = Dropbox::Sign::TemplateCreateRequest.new
template_create_request.client_id = "37dee8d8440c66d54cfa05d92c160882"
template_create_request.message = "For your approval"
template_create_request.subject = "Please sign this document"
template_create_request.test_mode = true
template_create_request.title = "Test Template"
template_create_request.cc_roles = [
    "Manager",
]
template_create_request.files = [
    File.new("./example_signature_request.pdf", "r"),
]
template_create_request.field_options = field_options
template_create_request.signer_roles = signer_roles
template_create_request.form_fields_per_document = form_fields_per_document
template_create_request.merge_fields = merge_fields

begin
    response = Dropbox::Sign::TemplateApi.new.template_create(
        template_create_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
    username="YOUR_API_KEY",
    # access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    signer_roles_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    signer_roles_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    signer_roles = [
        signer_roles_1,
        signer_roles_2,
    ]

    form_fields_per_document_1 = models.SubFormFieldsPerDocumentText(
        document_index=0,
        api_id="uniqueIdHere_1",
        type="text",
        required=True,
        signer="1",
        width=100,
        height=16,
        x=112,
        y=328,
        name="",
        page=1,
        placeholder="",
        validation_type="numbers_only",
    )

    form_fields_per_document_2 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="uniqueIdHere_2",
        type="signature",
        required=True,
        signer="0",
        width=120,
        height=30,
        x=530,
        y=415,
        name="",
        page=1,
    )

    form_fields_per_document = [
        form_fields_per_document_1,
        form_fields_per_document_2,
    ]

    merge_fields_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_fields_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    merge_fields = [
        merge_fields_1,
        merge_fields_2,
    ]

    template_create_request = models.TemplateCreateRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        message="For your approval",
        subject="Please sign this document",
        test_mode=True,
        title="Test Template",
        cc_roles=[
            "Manager",
        ],
        files=[
            open("./example_signature_request.pdf", "rb").read(),
        ],
        field_options=field_options,
        signer_roles=signer_roles,
        form_fields_per_document=form_fields_per_document,
        merge_fields=merge_fields,
    )

    try:
        response = api.TemplateApi(api_client).template_create(
            template_create_request=template_create_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create: %s\n" % e)

```

```go Default Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hellosign.com/v3/template/create"

	payload := strings.NewReader("{\n  \"form_fields_per_document\": [\n    {\n      \"type\": \"text\",\n      \"api_id\": \"uniqueIdHere_1\",\n      \"document_index\": 0,\n      \"height\": 16,\n      \"required\": true,\n      \"signer\": \"1\",\n      \"width\": 100,\n      \"x\": 112,\n      \"y\": 328,\n      \"name\": \"\",\n      \"page\": 1,\n      \"placeholder\": \"\",\n      \"validation_type\": \"numbers_only\"\n    },\n    {\n      \"type\": \"signature\",\n      \"api_id\": \"uniqueIdHere_2\",\n      \"document_index\": 0,\n      \"height\": 30,\n      \"required\": true,\n      \"signer\": \"0\",\n      \"width\": 120,\n      \"x\": 530,\n      \"y\": 415,\n      \"name\": \"\",\n      \"page\": 1\n    }\n  ],\n  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"field_options\": {\n    \"date_format\": \"DD - MM - YYYY\"\n  },\n  \"merge_fields\": [\n    {\n      \"name\": \"Full Name\",\n      \"type\": \"text\"\n    },\n    {\n      \"name\": \"Is Registered?\",\n      \"type\": \"checkbox\"\n    }\n  ],\n  \"message\": \"For your approval\",\n  \"subject\": \"Please sign this document\",\n  \"test_mode\": true,\n  \"title\": \"Test Template\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<apiKey>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Default Example
import Foundation

let credentials = Data("<apiKey>:".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "form_fields_per_document": [
    [
      "type": "text",
      "api_id": "uniqueIdHere_1",
      "document_index": 0,
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "api_id": "uniqueIdHere_2",
      "document_index": 0,
      "height": 30,
      "required": true,
      "signer": "0",
      "width": 120,
      "x": 530,
      "y": 415,
      "name": "",
      "page": 1
    ]
  ],
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "field_options": ["date_format": "DD - MM - YYYY"],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$field_options = (new Dropbox\Sign\Model\SubFieldOptions())
    ->setDateFormat(Dropbox\Sign\Model\SubFieldOptions::DATE_FORMAT_DD_MM_YYYY);

$signer_roles_1 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Client")
    ->setOrder(0);

$signer_roles_2 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Witness")
    ->setOrder(1);

$signer_roles = [
    $signer_roles_1,
    $signer_roles_2,
];

$form_fields_per_document_1 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentText())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_1")
    ->setType("text")
    ->setRequired(true)
    ->setSigner("1")
    ->setWidth(100)
    ->setHeight(16)
    ->setX(112)
    ->setY(328)
    ->setName("")
    ->setPage(1)
    ->setPlaceholder("")
    ->setValidationType(Dropbox\Sign\Model\SubFormFieldsPerDocumentText::VALIDATION_TYPE_NUMBERS_ONLY);

$form_fields_per_document_2 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentSignature())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_2")
    ->setType("signature")
    ->setRequired(true)
    ->setSigner("0")
    ->setWidth(120)
    ->setHeight(30)
    ->setX(530)
    ->setY(415)
    ->setName("")
    ->setPage(1);

$form_fields_per_document = [
    $form_fields_per_document_1,
    $form_fields_per_document_2,
];

$merge_fields_1 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Full Name")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_TEXT);

$merge_fields_2 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Is Registered?")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_CHECKBOX);

$merge_fields = [
    $merge_fields_1,
    $merge_fields_2,
];

$template_create_request = (new Dropbox\Sign\Model\TemplateCreateRequest())
    ->setClientId("37dee8d8440c66d54cfa05d92c160882")
    ->setMessage("For your approval")
    ->setSubject("Please sign this document")
    ->setTestMode(true)
    ->setTitle("Test Template")
    ->setCcRoles([
        "Manager",
    ])
    ->setFiles([
    ])
    ->setFieldOptions($field_options)
    ->setSignerRoles($signer_roles)
    ->setFormFieldsPerDocument($form_fields_per_document)
    ->setMergeFields($merge_fields);

try {
    $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateCreate(
        template_create_request: $template_create_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class TemplateCreateExample
{
    public static void Run()
    {
        var config = new Configuration();
        config.Username = "YOUR_API_KEY";
        // config.AccessToken = "YOUR_ACCESS_TOKEN";

        var fieldOptions = new SubFieldOptions(
            dateFormat: SubFieldOptions.DateFormatEnum.DD_MM_YYYY
        );

        var signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

        var signerRoles2 = new SubTemplateRole(
            name: "Witness",
            order: 1
        );

        var signerRoles = new List<SubTemplateRole>
        {
            signerRoles1,
            signerRoles2,
        };

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText(
            documentIndex: 0,
            apiId: "uniqueIdHere_1",
            type: "text",
            required: true,
            signer: "1",
            width: 100,
            height: 16,
            x: 112,
            y: 328,
            name: "",
            page: 1,
            placeholder: "",
            validationType: SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly
        );

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature(
            documentIndex: 0,
            apiId: "uniqueIdHere_2",
            type: "signature",
            required: true,
            signer: "0",
            width: 120,
            height: 30,
            x: 530,
            y: 415,
            name: "",
            page: 1
        );

        var formFieldsPerDocument = new List<SubFormFieldsPerDocumentBase>
        {
            formFieldsPerDocument1,
            formFieldsPerDocument2,
        };

        var mergeFields1 = new SubMergeField(
            name: "Full Name",
            type: SubMergeField.TypeEnum.Text
        );

        var mergeFields2 = new SubMergeField(
            name: "Is Registered?",
            type: SubMergeField.TypeEnum.Checkbox
        );

        var mergeFields = new List<SubMergeField>
        {
            mergeFields1,
            mergeFields2,
        };

        var templateCreateRequest = new TemplateCreateRequest(
            clientId: "37dee8d8440c66d54cfa05d92c160882",
            message: "For your approval",
            subject: "Please sign this document",
            testMode: true,
            title: "Test Template",
            ccRoles: [
                "Manager",
            ],
            files: new List<Stream>
            {
                new FileStream(
                    path: "./example_signature_request.pdf",
                    mode: FileMode.Open
                ),
            },
            fieldOptions: fieldOptions,
            signerRoles: signerRoles,
            formFieldsPerDocument: formFieldsPerDocument,
            mergeFields: mergeFields
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreate(
                templateCreateRequest: templateCreateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.TemplateApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const fieldOptions: models.SubFieldOptions = {
  dateFormat: models.SubFieldOptions.DateFormatEnum.DdMmYyyy,
};

const signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

const signerRoles2: models.SubTemplateRole = {
  name: "Witness",
  order: 1,
};

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const formFieldsPerDocument1: models.SubFormFieldsPerDocumentText = {
  documentIndex: 0,
  apiId: "uniqueIdHere_1",
  type: "text",
  required: true,
  signer: "1",
  width: 100,
  height: 16,
  x: 112,
  y: 328,
  name: "",
  page: 1,
  placeholder: "",
  validationType: models.SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly,
};

const formFieldsPerDocument2: models.SubFormFieldsPerDocumentSignature = {
  documentIndex: 0,
  apiId: "uniqueIdHere_2",
  type: "signature",
  required: true,
  signer: "0",
  width: 120,
  height: 30,
  x: 530,
  y: 415,
  name: "",
  page: 1,
};

const formFieldsPerDocument = [
  formFieldsPerDocument1,
  formFieldsPerDocument2,
];

const mergeFields1: models.SubMergeField = {
  name: "Full Name",
  type: models.SubMergeField.TypeEnum.Text,
};

const mergeFields2: models.SubMergeField = {
  name: "Is Registered?",
  type: models.SubMergeField.TypeEnum.Checkbox,
};

const mergeFields = [
  mergeFields1,
  mergeFields2,
];

const templateCreateRequest: models.TemplateCreateRequest = {
  clientId: "37dee8d8440c66d54cfa05d92c160882",
  message: "For your approval",
  subject: "Please sign this document",
  testMode: true,
  title: "Test Template",
  ccRoles: [
    "Manager",
  ],
  files: [
    fs.createReadStream("./example_signature_request.pdf"),
  ],
  fieldOptions: fieldOptions,
  signerRoles: signerRoles,
  formFieldsPerDocument: formFieldsPerDocument,
  mergeFields: mergeFields,
};

apiCaller.templateCreate(
  templateCreateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TemplateCreateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();
        ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
        // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

        var fieldOptions = new SubFieldOptions();
        fieldOptions.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);

        var signerRoles1 = new SubTemplateRole();
        signerRoles1.name("Client");
        signerRoles1.order(0);

        var signerRoles2 = new SubTemplateRole();
        signerRoles2.name("Witness");
        signerRoles2.order(1);

        var signerRoles = new ArrayList<SubTemplateRole>(List.of (
            signerRoles1,
            signerRoles2
        ));

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText();
        formFieldsPerDocument1.documentIndex(0);
        formFieldsPerDocument1.apiId("uniqueIdHere_1");
        formFieldsPerDocument1.type("text");
        formFieldsPerDocument1.required(true);
        formFieldsPerDocument1.signer("1");
        formFieldsPerDocument1.width(100);
        formFieldsPerDocument1.height(16);
        formFieldsPerDocument1.x(112);
        formFieldsPerDocument1.y(328);
        formFieldsPerDocument1.name("");
        formFieldsPerDocument1.page(1);
        formFieldsPerDocument1.placeholder("");
        formFieldsPerDocument1.validationType(SubFormFieldsPerDocumentText.ValidationTypeEnum.NUMBERS_ONLY);

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature();
        formFieldsPerDocument2.documentIndex(0);
        formFieldsPerDocument2.apiId("uniqueIdHere_2");
        formFieldsPerDocument2.type("signature");
        formFieldsPerDocument2.required(true);
        formFieldsPerDocument2.signer("0");
        formFieldsPerDocument2.width(120);
        formFieldsPerDocument2.height(30);
        formFieldsPerDocument2.x(530);
        formFieldsPerDocument2.y(415);
        formFieldsPerDocument2.name("");
        formFieldsPerDocument2.page(1);

        var formFieldsPerDocument = new ArrayList<SubFormFieldsPerDocumentBase>(List.of (
            formFieldsPerDocument1,
            formFieldsPerDocument2
        ));

        var mergeFields1 = new SubMergeField();
        mergeFields1.name("Full Name");
        mergeFields1.type(SubMergeField.TypeEnum.TEXT);

        var mergeFields2 = new SubMergeField();
        mergeFields2.name("Is Registered?");
        mergeFields2.type(SubMergeField.TypeEnum.CHECKBOX);

        var mergeFields = new ArrayList<SubMergeField>(List.of (
            mergeFields1,
            mergeFields2
        ));

        var templateCreateRequest = new TemplateCreateRequest();
        templateCreateRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateRequest.message("For your approval");
        templateCreateRequest.subject("Please sign this document");
        templateCreateRequest.testMode(true);
        templateCreateRequest.title("Test Template");
        templateCreateRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateRequest.fieldOptions(fieldOptions);
        templateCreateRequest.signerRoles(signerRoles);
        templateCreateRequest.formFieldsPerDocument(formFieldsPerDocument);
        templateCreateRequest.mergeFields(mergeFields);

        try
        {
            var response = new TemplateApi(config).templateCreate(
                templateCreateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
    config.username = "YOUR_API_KEY"
    # config.access_token = "YOUR_ACCESS_TOKEN"
end

field_options = Dropbox::Sign::SubFieldOptions.new
field_options.date_format = "DD - MM - YYYY"

signer_roles_1 = Dropbox::Sign::SubTemplateRole.new
signer_roles_1.name = "Client"
signer_roles_1.order = 0

signer_roles_2 = Dropbox::Sign::SubTemplateRole.new
signer_roles_2.name = "Witness"
signer_roles_2.order = 1

signer_roles = [
    signer_roles_1,
    signer_roles_2,
]

form_fields_per_document_1 = Dropbox::Sign::SubFormFieldsPerDocumentText.new
form_fields_per_document_1.document_index = 0
form_fields_per_document_1.api_id = "uniqueIdHere_1"
form_fields_per_document_1.type = "text"
form_fields_per_document_1.required = true
form_fields_per_document_1.signer = "1"
form_fields_per_document_1.width = 100
form_fields_per_document_1.height = 16
form_fields_per_document_1.x = 112
form_fields_per_document_1.y = 328
form_fields_per_document_1.name = ""
form_fields_per_document_1.page = 1
form_fields_per_document_1.placeholder = ""
form_fields_per_document_1.validation_type = "numbers_only"

form_fields_per_document_2 = Dropbox::Sign::SubFormFieldsPerDocumentSignature.new
form_fields_per_document_2.document_index = 0
form_fields_per_document_2.api_id = "uniqueIdHere_2"
form_fields_per_document_2.type = "signature"
form_fields_per_document_2.required = true
form_fields_per_document_2.signer = "0"
form_fields_per_document_2.width = 120
form_fields_per_document_2.height = 30
form_fields_per_document_2.x = 530
form_fields_per_document_2.y = 415
form_fields_per_document_2.name = ""
form_fields_per_document_2.page = 1

form_fields_per_document = [
    form_fields_per_document_1,
    form_fields_per_document_2,
]

merge_fields_1 = Dropbox::Sign::SubMergeField.new
merge_fields_1.name = "Full Name"
merge_fields_1.type = "text"

merge_fields_2 = Dropbox::Sign::SubMergeField.new
merge_fields_2.name = "Is Registered?"
merge_fields_2.type = "checkbox"

merge_fields = [
    merge_fields_1,
    merge_fields_2,
]

template_create_request = Dropbox::Sign::TemplateCreateRequest.new
template_create_request.client_id = "37dee8d8440c66d54cfa05d92c160882"
template_create_request.message = "For your approval"
template_create_request.subject = "Please sign this document"
template_create_request.test_mode = true
template_create_request.title = "Test Template"
template_create_request.cc_roles = [
    "Manager",
]
template_create_request.files = [
    File.new("./example_signature_request.pdf", "r"),
]
template_create_request.field_options = field_options
template_create_request.signer_roles = signer_roles
template_create_request.form_fields_per_document = form_fields_per_document
template_create_request.merge_fields = merge_fields

begin
    response = Dropbox::Sign::TemplateApi.new.template_create(
        template_create_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
    username="YOUR_API_KEY",
    # access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    signer_roles_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    signer_roles_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    signer_roles = [
        signer_roles_1,
        signer_roles_2,
    ]

    form_fields_per_document_1 = models.SubFormFieldsPerDocumentText(
        document_index=0,
        api_id="uniqueIdHere_1",
        type="text",
        required=True,
        signer="1",
        width=100,
        height=16,
        x=112,
        y=328,
        name="",
        page=1,
        placeholder="",
        validation_type="numbers_only",
    )

    form_fields_per_document_2 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="uniqueIdHere_2",
        type="signature",
        required=True,
        signer="0",
        width=120,
        height=30,
        x=530,
        y=415,
        name="",
        page=1,
    )

    form_fields_per_document = [
        form_fields_per_document_1,
        form_fields_per_document_2,
    ]

    merge_fields_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_fields_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    merge_fields = [
        merge_fields_1,
        merge_fields_2,
    ]

    template_create_request = models.TemplateCreateRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        message="For your approval",
        subject="Please sign this document",
        test_mode=True,
        title="Test Template",
        cc_roles=[
            "Manager",
        ],
        files=[
            open("./example_signature_request.pdf", "rb").read(),
        ],
        field_options=field_options,
        signer_roles=signer_roles,
        form_fields_per_document=form_fields_per_document,
        merge_fields=merge_fields,
    )

    try:
        response = api.TemplateApi(api_client).template_create(
            template_create_request=template_create_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create: %s\n" % e)

```

```go Form Fields Per Document Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hellosign.com/v3/template/create"

	payload := strings.NewReader("{\n  \"form_fields_per_document\": [\n    {\n      \"type\": \"text\",\n      \"api_id\": \"uniqueIdHere_1\",\n      \"document_index\": 0,\n      \"height\": 16,\n      \"required\": true,\n      \"signer\": \"1\",\n      \"width\": 100,\n      \"x\": 112,\n      \"y\": 328,\n      \"name\": \"\",\n      \"page\": 1,\n      \"placeholder\": \"\",\n      \"validation_type\": \"numbers_only\"\n    },\n    {\n      \"type\": \"signature\",\n      \"api_id\": \"uniqueIdHere_2\",\n      \"document_index\": 0,\n      \"height\": 30,\n      \"required\": true,\n      \"signer\": \"0\",\n      \"width\": 120,\n      \"x\": 530,\n      \"y\": 415,\n      \"name\": \"\",\n      \"page\": 1\n    }\n  ],\n  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"field_options\": {\n    \"date_format\": \"DD - MM - YYYY\"\n  },\n  \"merge_fields\": [\n    {\n      \"name\": \"Full Name\",\n      \"type\": \"text\"\n    },\n    {\n      \"name\": \"Is Registered?\",\n      \"type\": \"checkbox\"\n    }\n  ],\n  \"message\": \"For your approval\",\n  \"subject\": \"Please sign this document\",\n  \"test_mode\": true,\n  \"title\": \"Test Template\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<apiKey>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Form Fields Per Document Example
import Foundation

let credentials = Data("<apiKey>:".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "form_fields_per_document": [
    [
      "type": "text",
      "api_id": "uniqueIdHere_1",
      "document_index": 0,
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "api_id": "uniqueIdHere_2",
      "document_index": 0,
      "height": 30,
      "required": true,
      "signer": "0",
      "width": 120,
      "x": 530,
      "y": 415,
      "name": "",
      "page": 1
    ]
  ],
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "field_options": ["date_format": "DD - MM - YYYY"],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$field_options = (new Dropbox\Sign\Model\SubFieldOptions())
    ->setDateFormat(Dropbox\Sign\Model\SubFieldOptions::DATE_FORMAT_DD_MM_YYYY);

$signer_roles_1 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Client")
    ->setOrder(0);

$signer_roles_2 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Witness")
    ->setOrder(1);

$signer_roles = [
    $signer_roles_1,
    $signer_roles_2,
];

$form_fields_per_document_1 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentText())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_1")
    ->setType("text")
    ->setRequired(true)
    ->setSigner("1")
    ->setWidth(100)
    ->setHeight(16)
    ->setX(112)
    ->setY(328)
    ->setName("")
    ->setPage(1)
    ->setPlaceholder("")
    ->setValidationType(Dropbox\Sign\Model\SubFormFieldsPerDocumentText::VALIDATION_TYPE_NUMBERS_ONLY);

$form_fields_per_document_2 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentSignature())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_2")
    ->setType("signature")
    ->setRequired(true)
    ->setSigner("0")
    ->setWidth(120)
    ->setHeight(30)
    ->setX(530)
    ->setY(415)
    ->setName("")
    ->setPage(1);

$form_fields_per_document = [
    $form_fields_per_document_1,
    $form_fields_per_document_2,
];

$merge_fields_1 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Full Name")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_TEXT);

$merge_fields_2 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Is Registered?")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_CHECKBOX);

$merge_fields = [
    $merge_fields_1,
    $merge_fields_2,
];

$template_create_request = (new Dropbox\Sign\Model\TemplateCreateRequest())
    ->setClientId("37dee8d8440c66d54cfa05d92c160882")
    ->setMessage("For your approval")
    ->setSubject("Please sign this document")
    ->setTestMode(true)
    ->setTitle("Test Template")
    ->setCcRoles([
        "Manager",
    ])
    ->setFiles([
    ])
    ->setFieldOptions($field_options)
    ->setSignerRoles($signer_roles)
    ->setFormFieldsPerDocument($form_fields_per_document)
    ->setMergeFields($merge_fields);

try {
    $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateCreate(
        template_create_request: $template_create_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class TemplateCreateExample
{
    public static void Run()
    {
        var config = new Configuration();
        config.Username = "YOUR_API_KEY";
        // config.AccessToken = "YOUR_ACCESS_TOKEN";

        var fieldOptions = new SubFieldOptions(
            dateFormat: SubFieldOptions.DateFormatEnum.DD_MM_YYYY
        );

        var signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

        var signerRoles2 = new SubTemplateRole(
            name: "Witness",
            order: 1
        );

        var signerRoles = new List<SubTemplateRole>
        {
            signerRoles1,
            signerRoles2,
        };

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText(
            documentIndex: 0,
            apiId: "uniqueIdHere_1",
            type: "text",
            required: true,
            signer: "1",
            width: 100,
            height: 16,
            x: 112,
            y: 328,
            name: "",
            page: 1,
            placeholder: "",
            validationType: SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly
        );

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature(
            documentIndex: 0,
            apiId: "uniqueIdHere_2",
            type: "signature",
            required: true,
            signer: "0",
            width: 120,
            height: 30,
            x: 530,
            y: 415,
            name: "",
            page: 1
        );

        var formFieldsPerDocument = new List<SubFormFieldsPerDocumentBase>
        {
            formFieldsPerDocument1,
            formFieldsPerDocument2,
        };

        var mergeFields1 = new SubMergeField(
            name: "Full Name",
            type: SubMergeField.TypeEnum.Text
        );

        var mergeFields2 = new SubMergeField(
            name: "Is Registered?",
            type: SubMergeField.TypeEnum.Checkbox
        );

        var mergeFields = new List<SubMergeField>
        {
            mergeFields1,
            mergeFields2,
        };

        var templateCreateRequest = new TemplateCreateRequest(
            clientId: "37dee8d8440c66d54cfa05d92c160882",
            message: "For your approval",
            subject: "Please sign this document",
            testMode: true,
            title: "Test Template",
            ccRoles: [
                "Manager",
            ],
            files: new List<Stream>
            {
                new FileStream(
                    path: "./example_signature_request.pdf",
                    mode: FileMode.Open
                ),
            },
            fieldOptions: fieldOptions,
            signerRoles: signerRoles,
            formFieldsPerDocument: formFieldsPerDocument,
            mergeFields: mergeFields
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreate(
                templateCreateRequest: templateCreateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.TemplateApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const fieldOptions: models.SubFieldOptions = {
  dateFormat: models.SubFieldOptions.DateFormatEnum.DdMmYyyy,
};

const signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

const signerRoles2: models.SubTemplateRole = {
  name: "Witness",
  order: 1,
};

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const formFieldsPerDocument1: models.SubFormFieldsPerDocumentText = {
  documentIndex: 0,
  apiId: "uniqueIdHere_1",
  type: "text",
  required: true,
  signer: "1",
  width: 100,
  height: 16,
  x: 112,
  y: 328,
  name: "",
  page: 1,
  placeholder: "",
  validationType: models.SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly,
};

const formFieldsPerDocument2: models.SubFormFieldsPerDocumentSignature = {
  documentIndex: 0,
  apiId: "uniqueIdHere_2",
  type: "signature",
  required: true,
  signer: "0",
  width: 120,
  height: 30,
  x: 530,
  y: 415,
  name: "",
  page: 1,
};

const formFieldsPerDocument = [
  formFieldsPerDocument1,
  formFieldsPerDocument2,
];

const mergeFields1: models.SubMergeField = {
  name: "Full Name",
  type: models.SubMergeField.TypeEnum.Text,
};

const mergeFields2: models.SubMergeField = {
  name: "Is Registered?",
  type: models.SubMergeField.TypeEnum.Checkbox,
};

const mergeFields = [
  mergeFields1,
  mergeFields2,
];

const templateCreateRequest: models.TemplateCreateRequest = {
  clientId: "37dee8d8440c66d54cfa05d92c160882",
  message: "For your approval",
  subject: "Please sign this document",
  testMode: true,
  title: "Test Template",
  ccRoles: [
    "Manager",
  ],
  files: [
    fs.createReadStream("./example_signature_request.pdf"),
  ],
  fieldOptions: fieldOptions,
  signerRoles: signerRoles,
  formFieldsPerDocument: formFieldsPerDocument,
  mergeFields: mergeFields,
};

apiCaller.templateCreate(
  templateCreateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TemplateCreateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();
        ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
        // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

        var fieldOptions = new SubFieldOptions();
        fieldOptions.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);

        var signerRoles1 = new SubTemplateRole();
        signerRoles1.name("Client");
        signerRoles1.order(0);

        var signerRoles2 = new SubTemplateRole();
        signerRoles2.name("Witness");
        signerRoles2.order(1);

        var signerRoles = new ArrayList<SubTemplateRole>(List.of (
            signerRoles1,
            signerRoles2
        ));

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText();
        formFieldsPerDocument1.documentIndex(0);
        formFieldsPerDocument1.apiId("uniqueIdHere_1");
        formFieldsPerDocument1.type("text");
        formFieldsPerDocument1.required(true);
        formFieldsPerDocument1.signer("1");
        formFieldsPerDocument1.width(100);
        formFieldsPerDocument1.height(16);
        formFieldsPerDocument1.x(112);
        formFieldsPerDocument1.y(328);
        formFieldsPerDocument1.name("");
        formFieldsPerDocument1.page(1);
        formFieldsPerDocument1.placeholder("");
        formFieldsPerDocument1.validationType(SubFormFieldsPerDocumentText.ValidationTypeEnum.NUMBERS_ONLY);

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature();
        formFieldsPerDocument2.documentIndex(0);
        formFieldsPerDocument2.apiId("uniqueIdHere_2");
        formFieldsPerDocument2.type("signature");
        formFieldsPerDocument2.required(true);
        formFieldsPerDocument2.signer("0");
        formFieldsPerDocument2.width(120);
        formFieldsPerDocument2.height(30);
        formFieldsPerDocument2.x(530);
        formFieldsPerDocument2.y(415);
        formFieldsPerDocument2.name("");
        formFieldsPerDocument2.page(1);

        var formFieldsPerDocument = new ArrayList<SubFormFieldsPerDocumentBase>(List.of (
            formFieldsPerDocument1,
            formFieldsPerDocument2
        ));

        var mergeFields1 = new SubMergeField();
        mergeFields1.name("Full Name");
        mergeFields1.type(SubMergeField.TypeEnum.TEXT);

        var mergeFields2 = new SubMergeField();
        mergeFields2.name("Is Registered?");
        mergeFields2.type(SubMergeField.TypeEnum.CHECKBOX);

        var mergeFields = new ArrayList<SubMergeField>(List.of (
            mergeFields1,
            mergeFields2
        ));

        var templateCreateRequest = new TemplateCreateRequest();
        templateCreateRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateRequest.message("For your approval");
        templateCreateRequest.subject("Please sign this document");
        templateCreateRequest.testMode(true);
        templateCreateRequest.title("Test Template");
        templateCreateRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateRequest.fieldOptions(fieldOptions);
        templateCreateRequest.signerRoles(signerRoles);
        templateCreateRequest.formFieldsPerDocument(formFieldsPerDocument);
        templateCreateRequest.mergeFields(mergeFields);

        try
        {
            var response = new TemplateApi(config).templateCreate(
                templateCreateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
    config.username = "YOUR_API_KEY"
    # config.access_token = "YOUR_ACCESS_TOKEN"
end

field_options = Dropbox::Sign::SubFieldOptions.new
field_options.date_format = "DD - MM - YYYY"

signer_roles_1 = Dropbox::Sign::SubTemplateRole.new
signer_roles_1.name = "Client"
signer_roles_1.order = 0

signer_roles_2 = Dropbox::Sign::SubTemplateRole.new
signer_roles_2.name = "Witness"
signer_roles_2.order = 1

signer_roles = [
    signer_roles_1,
    signer_roles_2,
]

form_fields_per_document_1 = Dropbox::Sign::SubFormFieldsPerDocumentText.new
form_fields_per_document_1.document_index = 0
form_fields_per_document_1.api_id = "uniqueIdHere_1"
form_fields_per_document_1.type = "text"
form_fields_per_document_1.required = true
form_fields_per_document_1.signer = "1"
form_fields_per_document_1.width = 100
form_fields_per_document_1.height = 16
form_fields_per_document_1.x = 112
form_fields_per_document_1.y = 328
form_fields_per_document_1.name = ""
form_fields_per_document_1.page = 1
form_fields_per_document_1.placeholder = ""
form_fields_per_document_1.validation_type = "numbers_only"

form_fields_per_document_2 = Dropbox::Sign::SubFormFieldsPerDocumentSignature.new
form_fields_per_document_2.document_index = 0
form_fields_per_document_2.api_id = "uniqueIdHere_2"
form_fields_per_document_2.type = "signature"
form_fields_per_document_2.required = true
form_fields_per_document_2.signer = "0"
form_fields_per_document_2.width = 120
form_fields_per_document_2.height = 30
form_fields_per_document_2.x = 530
form_fields_per_document_2.y = 415
form_fields_per_document_2.name = ""
form_fields_per_document_2.page = 1

form_fields_per_document = [
    form_fields_per_document_1,
    form_fields_per_document_2,
]

merge_fields_1 = Dropbox::Sign::SubMergeField.new
merge_fields_1.name = "Full Name"
merge_fields_1.type = "text"

merge_fields_2 = Dropbox::Sign::SubMergeField.new
merge_fields_2.name = "Is Registered?"
merge_fields_2.type = "checkbox"

merge_fields = [
    merge_fields_1,
    merge_fields_2,
]

template_create_request = Dropbox::Sign::TemplateCreateRequest.new
template_create_request.client_id = "37dee8d8440c66d54cfa05d92c160882"
template_create_request.message = "For your approval"
template_create_request.subject = "Please sign this document"
template_create_request.test_mode = true
template_create_request.title = "Test Template"
template_create_request.cc_roles = [
    "Manager",
]
template_create_request.files = [
    File.new("./example_signature_request.pdf", "r"),
]
template_create_request.field_options = field_options
template_create_request.signer_roles = signer_roles
template_create_request.form_fields_per_document = form_fields_per_document
template_create_request.merge_fields = merge_fields

begin
    response = Dropbox::Sign::TemplateApi.new.template_create(
        template_create_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
    username="YOUR_API_KEY",
    # access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    signer_roles_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    signer_roles_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    signer_roles = [
        signer_roles_1,
        signer_roles_2,
    ]

    form_fields_per_document_1 = models.SubFormFieldsPerDocumentText(
        document_index=0,
        api_id="uniqueIdHere_1",
        type="text",
        required=True,
        signer="1",
        width=100,
        height=16,
        x=112,
        y=328,
        name="",
        page=1,
        placeholder="",
        validation_type="numbers_only",
    )

    form_fields_per_document_2 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="uniqueIdHere_2",
        type="signature",
        required=True,
        signer="0",
        width=120,
        height=30,
        x=530,
        y=415,
        name="",
        page=1,
    )

    form_fields_per_document = [
        form_fields_per_document_1,
        form_fields_per_document_2,
    ]

    merge_fields_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_fields_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    merge_fields = [
        merge_fields_1,
        merge_fields_2,
    ]

    template_create_request = models.TemplateCreateRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        message="For your approval",
        subject="Please sign this document",
        test_mode=True,
        title="Test Template",
        cc_roles=[
            "Manager",
        ],
        files=[
            open("./example_signature_request.pdf", "rb").read(),
        ],
        field_options=field_options,
        signer_roles=signer_roles,
        form_fields_per_document=form_fields_per_document,
        merge_fields=merge_fields,
    )

    try:
        response = api.TemplateApi(api_client).template_create(
            template_create_request=template_create_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create: %s\n" % e)

```

```go Form Fields Per Document and Groups Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hellosign.com/v3/template/create"

	payload := strings.NewReader("{\n  \"form_fields_per_document\": [\n    {\n      \"type\": \"radio\",\n      \"api_id\": \"uniqueIdHere_1\",\n      \"document_index\": 0,\n      \"group\": \"RadioItemGroup1\",\n      \"height\": 18,\n      \"is_checked\": 1,\n      \"required\": false,\n      \"signer\": \"0\",\n      \"width\": 18,\n      \"x\": 112,\n      \"y\": 328,\n      \"name\": \"\",\n      \"page\": 1\n    },\n    {\n      \"type\": \"radio\",\n      \"api_id\": \"uniqueIdHere_2\",\n      \"document_index\": 0,\n      \"group\": \"RadioItemGroup1\",\n      \"height\": 18,\n      \"is_checked\": 0,\n      \"required\": false,\n      \"signer\": \"0\",\n      \"width\": 18,\n      \"x\": 112,\n      \"y\": 370,\n      \"name\": \"\",\n      \"page\": 1\n    }\n  ],\n  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"field_options\": {\n    \"date_format\": \"DD - MM - YYYY\"\n  },\n  \"form_field_groups\": [\n    {\n      \"group_id\": \"RadioItemGroup1\",\n      \"group_label\": \"Radio Item Group 1\",\n      \"requirement\": \"require_0-1\"\n    }\n  ],\n  \"merge_fields\": [\n    {\n      \"name\": \"Full Name\",\n      \"type\": \"text\"\n    },\n    {\n      \"name\": \"Is Registered?\",\n      \"type\": \"checkbox\"\n    }\n  ],\n  \"message\": \"For your approval\",\n  \"subject\": \"Please sign this document\",\n  \"test_mode\": true,\n  \"title\": \"Test Template\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<apiKey>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Form Fields Per Document and Groups Example
import Foundation

let credentials = Data("<apiKey>:".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "form_fields_per_document": [
    [
      "type": "radio",
      "api_id": "uniqueIdHere_1",
      "document_index": 0,
      "group": "RadioItemGroup1",
      "height": 18,
      "is_checked": 1,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1
    ],
    [
      "type": "radio",
      "api_id": "uniqueIdHere_2",
      "document_index": 0,
      "group": "RadioItemGroup1",
      "height": 18,
      "is_checked": 0,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 370,
      "name": "",
      "page": 1
    ]
  ],
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "field_options": ["date_format": "DD - MM - YYYY"],
  "form_field_groups": [
    [
      "group_id": "RadioItemGroup1",
      "group_label": "Radio Item Group 1",
      "requirement": "require_0-1"
    ]
  ],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

```php PHP
<?php

namespace Dropbox\SignSandbox;

require_once __DIR__ . '/../vendor/autoload.php';

use SplFileObject;
use Dropbox;

$config = Dropbox\Sign\Configuration::getDefaultConfiguration();
$config->setUsername("YOUR_API_KEY");
// $config->setAccessToken("YOUR_ACCESS_TOKEN");

$field_options = (new Dropbox\Sign\Model\SubFieldOptions())
    ->setDateFormat(Dropbox\Sign\Model\SubFieldOptions::DATE_FORMAT_DD_MM_YYYY);

$signer_roles_1 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Client")
    ->setOrder(0);

$signer_roles_2 = (new Dropbox\Sign\Model\SubTemplateRole())
    ->setName("Witness")
    ->setOrder(1);

$signer_roles = [
    $signer_roles_1,
    $signer_roles_2,
];

$form_fields_per_document_1 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentText())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_1")
    ->setType("text")
    ->setRequired(true)
    ->setSigner("1")
    ->setWidth(100)
    ->setHeight(16)
    ->setX(112)
    ->setY(328)
    ->setName("")
    ->setPage(1)
    ->setPlaceholder("")
    ->setValidationType(Dropbox\Sign\Model\SubFormFieldsPerDocumentText::VALIDATION_TYPE_NUMBERS_ONLY);

$form_fields_per_document_2 = (new Dropbox\Sign\Model\SubFormFieldsPerDocumentSignature())
    ->setDocumentIndex(0)
    ->setApiId("uniqueIdHere_2")
    ->setType("signature")
    ->setRequired(true)
    ->setSigner("0")
    ->setWidth(120)
    ->setHeight(30)
    ->setX(530)
    ->setY(415)
    ->setName("")
    ->setPage(1);

$form_fields_per_document = [
    $form_fields_per_document_1,
    $form_fields_per_document_2,
];

$merge_fields_1 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Full Name")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_TEXT);

$merge_fields_2 = (new Dropbox\Sign\Model\SubMergeField())
    ->setName("Is Registered?")
    ->setType(Dropbox\Sign\Model\SubMergeField::TYPE_CHECKBOX);

$merge_fields = [
    $merge_fields_1,
    $merge_fields_2,
];

$template_create_request = (new Dropbox\Sign\Model\TemplateCreateRequest())
    ->setClientId("37dee8d8440c66d54cfa05d92c160882")
    ->setMessage("For your approval")
    ->setSubject("Please sign this document")
    ->setTestMode(true)
    ->setTitle("Test Template")
    ->setCcRoles([
        "Manager",
    ])
    ->setFiles([
    ])
    ->setFieldOptions($field_options)
    ->setSignerRoles($signer_roles)
    ->setFormFieldsPerDocument($form_fields_per_document)
    ->setMergeFields($merge_fields);

try {
    $response = (new Dropbox\Sign\Api\TemplateApi(config: $config))->templateCreate(
        template_create_request: $template_create_request,
    );

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreate: {$e->getMessage()}";
}

```

```csharp C#
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.Json;

using Dropbox.Sign.Api;
using Dropbox.Sign.Client;
using Dropbox.Sign.Model;

namespace Dropbox.SignSandbox;

public class TemplateCreateExample
{
    public static void Run()
    {
        var config = new Configuration();
        config.Username = "YOUR_API_KEY";
        // config.AccessToken = "YOUR_ACCESS_TOKEN";

        var fieldOptions = new SubFieldOptions(
            dateFormat: SubFieldOptions.DateFormatEnum.DD_MM_YYYY
        );

        var signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

        var signerRoles2 = new SubTemplateRole(
            name: "Witness",
            order: 1
        );

        var signerRoles = new List<SubTemplateRole>
        {
            signerRoles1,
            signerRoles2,
        };

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText(
            documentIndex: 0,
            apiId: "uniqueIdHere_1",
            type: "text",
            required: true,
            signer: "1",
            width: 100,
            height: 16,
            x: 112,
            y: 328,
            name: "",
            page: 1,
            placeholder: "",
            validationType: SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly
        );

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature(
            documentIndex: 0,
            apiId: "uniqueIdHere_2",
            type: "signature",
            required: true,
            signer: "0",
            width: 120,
            height: 30,
            x: 530,
            y: 415,
            name: "",
            page: 1
        );

        var formFieldsPerDocument = new List<SubFormFieldsPerDocumentBase>
        {
            formFieldsPerDocument1,
            formFieldsPerDocument2,
        };

        var mergeFields1 = new SubMergeField(
            name: "Full Name",
            type: SubMergeField.TypeEnum.Text
        );

        var mergeFields2 = new SubMergeField(
            name: "Is Registered?",
            type: SubMergeField.TypeEnum.Checkbox
        );

        var mergeFields = new List<SubMergeField>
        {
            mergeFields1,
            mergeFields2,
        };

        var templateCreateRequest = new TemplateCreateRequest(
            clientId: "37dee8d8440c66d54cfa05d92c160882",
            message: "For your approval",
            subject: "Please sign this document",
            testMode: true,
            title: "Test Template",
            ccRoles: [
                "Manager",
            ],
            files: new List<Stream>
            {
                new FileStream(
                    path: "./example_signature_request.pdf",
                    mode: FileMode.Open
                ),
            },
            fieldOptions: fieldOptions,
            signerRoles: signerRoles,
            formFieldsPerDocument: formFieldsPerDocument,
            mergeFields: mergeFields
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreate(
                templateCreateRequest: templateCreateRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreate: " + e.Message);
            Console.WriteLine("Status Code: " + e.ErrorCode);
            Console.WriteLine(e.StackTrace);
        }
    }
}

```

```typescript TypeScript
import * as fs from 'fs';
import api from "@dropbox/sign"
import models from "@dropbox/sign"

const apiCaller = new api.TemplateApi();
apiCaller.username = "YOUR_API_KEY";
// apiCaller.accessToken = "YOUR_ACCESS_TOKEN";

const fieldOptions: models.SubFieldOptions = {
  dateFormat: models.SubFieldOptions.DateFormatEnum.DdMmYyyy,
};

const signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

const signerRoles2: models.SubTemplateRole = {
  name: "Witness",
  order: 1,
};

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const formFieldsPerDocument1: models.SubFormFieldsPerDocumentText = {
  documentIndex: 0,
  apiId: "uniqueIdHere_1",
  type: "text",
  required: true,
  signer: "1",
  width: 100,
  height: 16,
  x: 112,
  y: 328,
  name: "",
  page: 1,
  placeholder: "",
  validationType: models.SubFormFieldsPerDocumentText.ValidationTypeEnum.NumbersOnly,
};

const formFieldsPerDocument2: models.SubFormFieldsPerDocumentSignature = {
  documentIndex: 0,
  apiId: "uniqueIdHere_2",
  type: "signature",
  required: true,
  signer: "0",
  width: 120,
  height: 30,
  x: 530,
  y: 415,
  name: "",
  page: 1,
};

const formFieldsPerDocument = [
  formFieldsPerDocument1,
  formFieldsPerDocument2,
];

const mergeFields1: models.SubMergeField = {
  name: "Full Name",
  type: models.SubMergeField.TypeEnum.Text,
};

const mergeFields2: models.SubMergeField = {
  name: "Is Registered?",
  type: models.SubMergeField.TypeEnum.Checkbox,
};

const mergeFields = [
  mergeFields1,
  mergeFields2,
];

const templateCreateRequest: models.TemplateCreateRequest = {
  clientId: "37dee8d8440c66d54cfa05d92c160882",
  message: "For your approval",
  subject: "Please sign this document",
  testMode: true,
  title: "Test Template",
  ccRoles: [
    "Manager",
  ],
  files: [
    fs.createReadStream("./example_signature_request.pdf"),
  ],
  fieldOptions: fieldOptions,
  signerRoles: signerRoles,
  formFieldsPerDocument: formFieldsPerDocument,
  mergeFields: mergeFields,
};

apiCaller.templateCreate(
  templateCreateRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreate:");
  console.log(error.body);
});

```

```java Java
package com.dropbox.sign_sandbox;

import com.dropbox.sign.ApiException;
import com.dropbox.sign.Configuration;
import com.dropbox.sign.api.*;
import com.dropbox.sign.auth.*;
import com.dropbox.sign.JSON;
import com.dropbox.sign.model.*;

import java.io.File;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public class TemplateCreateExample
{
    public static void main(String[] args)
    {
        var config = Configuration.getDefaultApiClient();
        ((HttpBasicAuth) config.getAuthentication("api_key")).setUsername("YOUR_API_KEY");
        // ((HttpBearerAuth) config.getAuthentication("oauth2")).setBearerToken("YOUR_ACCESS_TOKEN");

        var fieldOptions = new SubFieldOptions();
        fieldOptions.dateFormat(SubFieldOptions.DateFormatEnum.DD_MM_YYYY);

        var signerRoles1 = new SubTemplateRole();
        signerRoles1.name("Client");
        signerRoles1.order(0);

        var signerRoles2 = new SubTemplateRole();
        signerRoles2.name("Witness");
        signerRoles2.order(1);

        var signerRoles = new ArrayList<SubTemplateRole>(List.of (
            signerRoles1,
            signerRoles2
        ));

        var formFieldsPerDocument1 = new SubFormFieldsPerDocumentText();
        formFieldsPerDocument1.documentIndex(0);
        formFieldsPerDocument1.apiId("uniqueIdHere_1");
        formFieldsPerDocument1.type("text");
        formFieldsPerDocument1.required(true);
        formFieldsPerDocument1.signer("1");
        formFieldsPerDocument1.width(100);
        formFieldsPerDocument1.height(16);
        formFieldsPerDocument1.x(112);
        formFieldsPerDocument1.y(328);
        formFieldsPerDocument1.name("");
        formFieldsPerDocument1.page(1);
        formFieldsPerDocument1.placeholder("");
        formFieldsPerDocument1.validationType(SubFormFieldsPerDocumentText.ValidationTypeEnum.NUMBERS_ONLY);

        var formFieldsPerDocument2 = new SubFormFieldsPerDocumentSignature();
        formFieldsPerDocument2.documentIndex(0);
        formFieldsPerDocument2.apiId("uniqueIdHere_2");
        formFieldsPerDocument2.type("signature");
        formFieldsPerDocument2.required(true);
        formFieldsPerDocument2.signer("0");
        formFieldsPerDocument2.width(120);
        formFieldsPerDocument2.height(30);
        formFieldsPerDocument2.x(530);
        formFieldsPerDocument2.y(415);
        formFieldsPerDocument2.name("");
        formFieldsPerDocument2.page(1);

        var formFieldsPerDocument = new ArrayList<SubFormFieldsPerDocumentBase>(List.of (
            formFieldsPerDocument1,
            formFieldsPerDocument2
        ));

        var mergeFields1 = new SubMergeField();
        mergeFields1.name("Full Name");
        mergeFields1.type(SubMergeField.TypeEnum.TEXT);

        var mergeFields2 = new SubMergeField();
        mergeFields2.name("Is Registered?");
        mergeFields2.type(SubMergeField.TypeEnum.CHECKBOX);

        var mergeFields = new ArrayList<SubMergeField>(List.of (
            mergeFields1,
            mergeFields2
        ));

        var templateCreateRequest = new TemplateCreateRequest();
        templateCreateRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateRequest.message("For your approval");
        templateCreateRequest.subject("Please sign this document");
        templateCreateRequest.testMode(true);
        templateCreateRequest.title("Test Template");
        templateCreateRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateRequest.fieldOptions(fieldOptions);
        templateCreateRequest.signerRoles(signerRoles);
        templateCreateRequest.formFieldsPerDocument(formFieldsPerDocument);
        templateCreateRequest.mergeFields(mergeFields);

        try
        {
            var response = new TemplateApi(config).templateCreate(
                templateCreateRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreate");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

```

```ruby Ruby
require "json"
require "dropbox-sign"

Dropbox::Sign.configure do |config|
    config.username = "YOUR_API_KEY"
    # config.access_token = "YOUR_ACCESS_TOKEN"
end

field_options = Dropbox::Sign::SubFieldOptions.new
field_options.date_format = "DD - MM - YYYY"

signer_roles_1 = Dropbox::Sign::SubTemplateRole.new
signer_roles_1.name = "Client"
signer_roles_1.order = 0

signer_roles_2 = Dropbox::Sign::SubTemplateRole.new
signer_roles_2.name = "Witness"
signer_roles_2.order = 1

signer_roles = [
    signer_roles_1,
    signer_roles_2,
]

form_fields_per_document_1 = Dropbox::Sign::SubFormFieldsPerDocumentText.new
form_fields_per_document_1.document_index = 0
form_fields_per_document_1.api_id = "uniqueIdHere_1"
form_fields_per_document_1.type = "text"
form_fields_per_document_1.required = true
form_fields_per_document_1.signer = "1"
form_fields_per_document_1.width = 100
form_fields_per_document_1.height = 16
form_fields_per_document_1.x = 112
form_fields_per_document_1.y = 328
form_fields_per_document_1.name = ""
form_fields_per_document_1.page = 1
form_fields_per_document_1.placeholder = ""
form_fields_per_document_1.validation_type = "numbers_only"

form_fields_per_document_2 = Dropbox::Sign::SubFormFieldsPerDocumentSignature.new
form_fields_per_document_2.document_index = 0
form_fields_per_document_2.api_id = "uniqueIdHere_2"
form_fields_per_document_2.type = "signature"
form_fields_per_document_2.required = true
form_fields_per_document_2.signer = "0"
form_fields_per_document_2.width = 120
form_fields_per_document_2.height = 30
form_fields_per_document_2.x = 530
form_fields_per_document_2.y = 415
form_fields_per_document_2.name = ""
form_fields_per_document_2.page = 1

form_fields_per_document = [
    form_fields_per_document_1,
    form_fields_per_document_2,
]

merge_fields_1 = Dropbox::Sign::SubMergeField.new
merge_fields_1.name = "Full Name"
merge_fields_1.type = "text"

merge_fields_2 = Dropbox::Sign::SubMergeField.new
merge_fields_2.name = "Is Registered?"
merge_fields_2.type = "checkbox"

merge_fields = [
    merge_fields_1,
    merge_fields_2,
]

template_create_request = Dropbox::Sign::TemplateCreateRequest.new
template_create_request.client_id = "37dee8d8440c66d54cfa05d92c160882"
template_create_request.message = "For your approval"
template_create_request.subject = "Please sign this document"
template_create_request.test_mode = true
template_create_request.title = "Test Template"
template_create_request.cc_roles = [
    "Manager",
]
template_create_request.files = [
    File.new("./example_signature_request.pdf", "r"),
]
template_create_request.field_options = field_options
template_create_request.signer_roles = signer_roles
template_create_request.form_fields_per_document = form_fields_per_document
template_create_request.merge_fields = merge_fields

begin
    response = Dropbox::Sign::TemplateApi.new.template_create(
        template_create_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create: #{e}"
end

```

```python Python
import json
from datetime import date, datetime
from pprint import pprint

from dropbox_sign import ApiClient, ApiException, Configuration, api, models

configuration = Configuration(
    username="YOUR_API_KEY",
    # access_token="YOUR_ACCESS_TOKEN",
)

with ApiClient(configuration) as api_client:
    field_options = models.SubFieldOptions(
        date_format="DD - MM - YYYY",
    )

    signer_roles_1 = models.SubTemplateRole(
        name="Client",
        order=0,
    )

    signer_roles_2 = models.SubTemplateRole(
        name="Witness",
        order=1,
    )

    signer_roles = [
        signer_roles_1,
        signer_roles_2,
    ]

    form_fields_per_document_1 = models.SubFormFieldsPerDocumentText(
        document_index=0,
        api_id="uniqueIdHere_1",
        type="text",
        required=True,
        signer="1",
        width=100,
        height=16,
        x=112,
        y=328,
        name="",
        page=1,
        placeholder="",
        validation_type="numbers_only",
    )

    form_fields_per_document_2 = models.SubFormFieldsPerDocumentSignature(
        document_index=0,
        api_id="uniqueIdHere_2",
        type="signature",
        required=True,
        signer="0",
        width=120,
        height=30,
        x=530,
        y=415,
        name="",
        page=1,
    )

    form_fields_per_document = [
        form_fields_per_document_1,
        form_fields_per_document_2,
    ]

    merge_fields_1 = models.SubMergeField(
        name="Full Name",
        type="text",
    )

    merge_fields_2 = models.SubMergeField(
        name="Is Registered?",
        type="checkbox",
    )

    merge_fields = [
        merge_fields_1,
        merge_fields_2,
    ]

    template_create_request = models.TemplateCreateRequest(
        client_id="37dee8d8440c66d54cfa05d92c160882",
        message="For your approval",
        subject="Please sign this document",
        test_mode=True,
        title="Test Template",
        cc_roles=[
            "Manager",
        ],
        files=[
            open("./example_signature_request.pdf", "rb").read(),
        ],
        field_options=field_options,
        signer_roles=signer_roles,
        form_fields_per_document=form_fields_per_document,
        merge_fields=merge_fields,
    )

    try:
        response = api.TemplateApi(api_client).template_create(
            template_create_request=template_create_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create: %s\n" % e)

```

```go Form Fields Per Document and Rules Example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.hellosign.com/v3/template/create"

	payload := strings.NewReader("{\n  \"form_fields_per_document\": [\n    {\n      \"type\": \"text\",\n      \"api_id\": \"uniqueIdHere_1\",\n      \"document_index\": 0,\n      \"height\": 16,\n      \"required\": true,\n      \"signer\": \"0\",\n      \"width\": 100,\n      \"x\": 112,\n      \"y\": 328,\n      \"name\": \"\",\n      \"page\": 1,\n      \"validation_type\": \"numbers_only\"\n    },\n    {\n      \"type\": \"signature\",\n      \"api_id\": \"uniqueIdHere_2\",\n      \"document_index\": 0,\n      \"height\": 30,\n      \"required\": true,\n      \"signer\": \"0\",\n      \"width\": 120,\n      \"x\": 530,\n      \"y\": 415,\n      \"name\": \"\",\n      \"page\": 1\n    }\n  ],\n  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"field_options\": {\n    \"date_format\": \"DD - MM - YYYY\"\n  },\n  \"form_field_rules\": [\n    {\n      \"id\": \"rule_1\",\n      \"trigger_operator\": \"AND\",\n      \"triggers\": [\n        {\n          \"id\": \"uniqueIdHere_1\",\n          \"operator\": \"is\",\n          \"value\": \"foo\"\n        }\n      ],\n      \"actions\": [\n        {\n          \"hidden\": true,\n          \"type\": \"change-field-visibility\",\n          \"field_id\": \"uniqueIdHere_2\"\n        }\n      ]\n    }\n  ],\n  \"merge_fields\": [\n    {\n      \"name\": \"Full Name\",\n      \"type\": \"text\"\n    },\n    {\n      \"name\": \"Is Registered?\",\n      \"type\": \"checkbox\"\n    }\n  ],\n  \"message\": \"For your approval\",\n  \"subject\": \"Please sign this document\",\n  \"test_mode\": true,\n  \"title\": \"Test Template\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.SetBasicAuth("<apiKey>", "")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```swift Form Fields Per Document and Rules Example
import Foundation

let credentials = Data("<apiKey>:".utf8).base64EncodedString()

let headers = [
  "Authorization": "Basic \(credentials)",
  "Content-Type": "application/json"
]
let parameters = [
  "form_fields_per_document": [
    [
      "type": "text",
      "api_id": "uniqueIdHere_1",
      "document_index": 0,
      "height": 16,
      "required": true,
      "signer": "0",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "api_id": "uniqueIdHere_2",
      "document_index": 0,
      "height": 30,
      "required": true,
      "signer": "0",
      "width": 120,
      "x": 530,
      "y": 415,
      "name": "",
      "page": 1
    ]
  ],
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "field_options": ["date_format": "DD - MM - YYYY"],
  "form_field_rules": [
    [
      "id": "rule_1",
      "trigger_operator": "AND",
      "triggers": [
        [
          "id": "uniqueIdHere_1",
          "operator": "is",
          "value": "foo"
        ]
      ],
      "actions": [
        [
          "hidden": true,
          "type": "change-field-visibility",
          "field_id": "uniqueIdHere_2"
        ]
      ]
    ]
  ],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.hellosign.com/v3/template/create")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```