> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.hellosign.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.hellosign.com/_mcp/server.

# 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

## Authentication

- `Authorization` header (basic auth, required) — Your API key can be used to make calls to the Dropbox Sign API. See [Authentication](/api/reference/authentication) for more information. ✅ Supported by Try it console (calls sent in `test_mode` only).
- `Authorization` header (bearer token, required) — You can use an Access Token issued through an OAuth flow to send calls to the Dropbox Sign API from your app. The access scopes required by this endpoint are listed in the gray box above. See [Authentication](/api/reference/authentication) for more information. ❌ **Not supported** by Try it console.

## Request

### Body (application/json)

- `form_fields_per_document` (list of object, required) — The fields that should appear on the document, expressed as an array of objects. (For more details you can read about it here: [Using Form Fields per Document](/docs/openapi/form-fields-per-document).) **NOTE:** Fields like **text**, **dropdown**, **checkbox**, **radio**, and **hyperlink** have additional required and optional parameters. Check out the list of [additional parameters](/api/reference/constants/#form-fields-per-document) for these field types. * Text Field use `SubFormFieldsPerDocumentText` * Dropdown Field use `SubFormFieldsPerDocumentDropdown` * Hyperlink Field use `SubFormFieldsPerDocumentHyperlink` * Checkbox Field use `SubFormFieldsPerDocumentCheckbox` * Radio Field use `SubFormFieldsPerDocumentRadio` * Signature Field use `SubFormFieldsPerDocumentSignature` * Date Signed Field use `SubFormFieldsPerDocumentDateSigned` * Initials Field use `SubFormFieldsPerDocumentInitials` * Text Merge Field use `SubFormFieldsPerDocumentTextMerge` * Checkbox Merge Field use `SubFormFieldsPerDocumentCheckboxMerge`
  - `type`: `text` (text)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `dropdown` (dropdown)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `hyperlink` (hyperlink)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `checkbox` (checkbox)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `radio` (radio)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `signature` (signature)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `date_signed` (date_signed)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `initials` (initials)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `text-merge` (text-merge)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
  - `type`: `checkbox-merge` (checkbox-merge)
    - `document_index` (integer, required) — Represents the integer index of the `file` or `file_url` document the field should be attached to.
    - `api_id` (string, required) — An identifier for the field that is unique across all documents in the request.
    - `height` (integer, required) — Size of the field in pixels.
    - `required` (boolean, required) — Whether this field is required.
    - `signer` (string, required) — Signer index identified by the offset in the signers parameter (0-based indexing), indicating which signer should fill out the field. **NOTE:** To set the value of the field as the preparer you must set this to `me_now` **NOTE:** If type is `text-merge` or `checkbox-merge`, you must set this to sender in order to use pre-filled data.
    - `width` (integer, required) — Size of the field in pixels.
    - `x` (integer, required) — Location coordinates of the field in pixels.
    - `y` (integer, required) — Location coordinates of the field in pixels.
    - `name` (string, optional) — Display name for the field.
    - `page` (integer, optional, nullable) — Page in the document where the field should be placed (requires documents be PDF files). - When the page number parameter is supplied, the API will use the new coordinate system. - Check out the differences between both [coordinate systems](https://faq.hellosign.com/hc/en-us/articles/217115577) and how to use them.
- `signer_roles` (list of object, required) — An array of the designated signer roles that must be specified when sending a SignatureRequest using this Template.
  - `name` (string, optional) — The role name of the signer that will be displayed when the template is used to create a signature request.
  - `order` (integer, optional, nullable) — The order in which this signer role is required to sign.
- `files` (list of string, optional) — Use `files[]` to indicate the uploaded file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.
- `file_urls` (list of string, optional) — Use `file_urls[]` to have Dropbox Sign download the file(s) to send for signature. This endpoint requires either **files** or **file_urls[]**, but not both.
- `allow_reassign` (boolean, optional, default: false) — Allows signers to reassign their signature requests to other signers if set to `true`. Defaults to `false`. **NOTE:** Only available for Premium plan and higher.
- `attachments` (list of object, optional) — A list describing the attachments
  - `name` (string, required) — The name of attachment.
  - `signer_index` (integer, required) — The signer's index in the `signers` parameter (0-based indexing). **NOTE:** Only one signer can be assigned per attachment.
  - `instructions` (string, optional) — The instructions for uploading the attachment.
  - `required` (boolean, optional, default: false) — Determines if the attachment must be uploaded.
- `cc_roles` (list of string, optional) — The CC roles that must be assigned when using the template to send a signature request
- `client_id` (string, optional) — Client id of the app you're using to create this draft. Used to apply the branding and callback url defined for the app.
- `field_options` (object, optional) — This allows the requester to specify field options for a signature request.
  - `date_format` (enum, required) — Allows requester to specify the date format (see list of allowed [formats](/api/reference/constants/#date-formats)) **NOTE:** Only available for Premium and higher.
    - Allowed values: `MM / DD / YYYY`, `MM - DD - YYYY`, `DD / MM / YYYY`, `DD - MM - YYYY`, `YYYY / MM / DD`, `YYYY - MM - DD`
- `form_field_groups` (list of object, optional) — Group information for fields defined in `form_fields_per_document`. String-indexed JSON array with `group_label` and `requirement` keys. `form_fields_per_document` must contain fields referencing a group defined in `form_field_groups`.
  - `group_id` (string, required) — ID of group. Use this to reference a specific group from the `group` value in `form_fields_per_document`.
  - `group_label` (string, required) — Name of the group
  - `requirement` (string, required) — Examples: `require_0-1` `require_1` `require_1-ormore` - Check out the list of [acceptable `requirement` checkbox type values](/api/reference/constants/#checkbox-field-grouping). - Check out the list of [acceptable `requirement` radio type fields](/api/reference/constants/#radio-field-grouping). - Radio groups require **at least** two fields per group.
- `form_field_rules` (list of object, optional) — Conditional Logic rules for fields defined in `form_fields_per_document`.
  - `id` (string, required) — Must be unique across all defined rules.
  - `trigger_operator` (string, required, default: AND) — Currently only `AND` is supported. Support for `OR` is being worked on.
  - `triggers` (list of object, required) — An array of trigger definitions, the "if this" part of "**if this**, then that". Currently only a single trigger per rule is allowed.
    - `id` (string, required) — Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Trigger and action fields and groups must belong to the same signer.
    - `operator` (enum, required) — Different field types allow different `operator` values: - Field type of **text**: - **is**: exact match - **not**: not exact match - **match**: regular expression, without /. Example: - OK `[a-zA-Z0-9]` - Not OK `/[a-zA-Z0-9]/` - Field type of **dropdown**: - **is**: exact match, single value - **not**: not exact match, single value - **any**: exact match, array of values. - **none**: not exact match, array of values. - Field type of **checkbox**: - **is**: exact match, single value - **not**: not exact match, single value - Field type of **radio**: - **is**: exact match, single value - **not**: not exact match, single value
      - Allowed values: `any`, `is`, `match`, `none`, `not`
    - `value` (string, optional) — **value** or **values** is required, but not both. The value to match against **operator**. - When **operator** is one of the following, **value** must be `String`: - `is` - `not` - `match` Otherwise, - **checkbox**: When **type** of trigger is **checkbox**, **value** must be `0` or `1` - **radio**: When **type** of trigger is **radio**, **value** must be `1`
    - `values` (list of string, optional) — **values** or **value** is required, but not both. The values to match against **operator** when it is one of the following: - `any` - `none`
  - `actions` (list of object, required) — An array of action definitions, the "then that" part of "if this, **then that**". Any number of actions may be attached to a single rule.
    - `hidden` (boolean, required) — `true` to hide the target field when rule is satisfied, otherwise `false`.
    - `type` (enum, required)
      - Allowed values: `change-field-visibility`, `change-group-visibility`
    - `field_id` (string, optional) — **field_id** or **group_id** is required, but not both. Must reference the `api_id` of an existing field defined within `form_fields_per_document`. Cannot use with `group_id`. Trigger and action fields must belong to the same signer.
    - `group_id` (string, optional) — **group_id** or **field_id** is required, but not both. Must reference the ID of an existing group defined within `form_field_groups`. Cannot use with `field_id`. Trigger and action fields and groups must belong to the same signer.
- `merge_fields` (list of object, optional) — Add merge fields to the template. Merge fields are placed by the user creating the template and used to pre-fill data by passing values into signature requests with the `custom_fields` parameter. If the signature request using that template *does not* pass a value into a merge field, then an empty field remains in the document.
  - `name` (string, required) — The name of the merge field. Must be unique.
  - `type` (enum, required) — The type of merge field.
    - Allowed values: `text`, `checkbox`
- `message` (string, optional) — The default template email message.
- `metadata` (map from string to any, optional) — Key-value data that should be attached to the signature request. This metadata is included in all API responses and events involving the signature request. For example, use the metadata field to store a signer's order number for look up when receiving events for the signature request. Each request can include up to 10 metadata keys (or 50 nested metadata keys), with key names up to 40 characters long and values up to 1000 characters long.
- `subject` (string, optional) — The template title (alias).
- `test_mode` (boolean, optional, default: false) — Whether this is a test, the signature request created from this draft will not be legally binding if set to `true`. Defaults to `false`.
- `title` (string, optional) — The title you want to assign to the SignatureRequest.
- `use_preexisting_fields` (boolean, optional, default: false) — Enable the detection of predefined PDF fields by setting the `use_preexisting_fields` to `true` (defaults to disabled, or `false`).

## Response

### 200

successful operation

- `template` (object, required) — Template object with parameters: `template_id`.
  - `template_id` (string, optional) — The id of the Template.
- `warnings` (list of object, optional) — A list of warnings.
  - `warning_msg` (string, required) — Warning message
  - `warning_name` (string, required) — Warning name

## Examples

### Create Template

**Request**

```json
undefined
```

**Response**

```json
{
  "template": {
    "template_id": "f57db65d3f933b5316d398057a36176831451a35",
    "accounts": [
      {
        "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
        "email_address": "me@dropboxsign.com",
        "is_locked": false,
        "is_paid_hf": false,
        "is_paid_hs": true,
        "quotas": {
          "api_signature_requests_left": 0,
          "documents_left": 3600000,
          "sms_verifications_left": 300000,
          "templates_left": null
        }
      }
    ],
    "can_edit": true,
    "cc_roles": [
      {
        "name": "Corporate Attorney"
      }
    ],
    "documents": [
      {
        "custom_fields": [
          {
            "api_id": "78083014-32d8-4b5b-b65e-fe6010f3be64",
            "avg_text_length": {
              "num_chars_per_line": 22,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 14,
            "isMultiline": false,
            "name": "Effective Date",
            "originalFontSize": 12,
            "required": false,
            "signer": null,
            "type": "text",
            "width": 84,
            "x": 378,
            "y": 36
          }
        ],
        "field_groups": [
          {
            "name": "group1",
            "rule": "require_1-ormore"
          }
        ],
        "form_fields": [
          {
            "api_id": "b65e03_10",
            "group": "group1",
            "height": 15,
            "name": "DepartmentA",
            "required": false,
            "signer": "1",
            "type": "checkbox",
            "width": 15,
            "x": 117,
            "y": 19
          },
          {
            "api_id": "b65e03_11",
            "group": "group1",
            "height": 15,
            "name": "DepartmentB",
            "required": false,
            "signer": "2",
            "type": "checkbox",
            "width": 15,
            "x": 118,
            "y": 41
          },
          {
            "api_id": "0ec7a7_1",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorName",
            "originalFontSize": 12,
            "required": true,
            "signer": "1",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 141
          },
          {
            "api_id": "0ec7a7_2",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 181
          },
          {
            "api_id": "0ec7a7_3",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerName",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 221
          },
          {
            "api_id": "0ec7a7_4",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 251
          },
          {
            "api_id": "0ec7a7_5",
            "group": null,
            "height": 16,
            "name": "DateSigned",
            "required": true,
            "signer": "1",
            "type": "date_signed",
            "width": 105,
            "x": 523,
            "y": 28
          }
        ],
        "index": 0,
        "name": "mutual_nda.pdf"
      }
    ],
    "is_creator": true,
    "is_embedded": false,
    "is_locked": false,
    "message": "Please sign this NDA as soon as possible.",
    "metadata": {},
    "signer_roles": [
      {
        "name": "Outside Vendor",
        "order": 0
      },
      {
        "name": "Internal Manager",
        "order": 1
      }
    ],
    "title": "Mutual NDA",
    "updated_at": 1570471067
  }
}
```

**SDK Code**

```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()
```

### Default Example

**Request**

```json
{
  "form_fields_per_document": [
    {
      "type": "text",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    },
    {
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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"
}
```

**Response**

```json
{
  "template": {
    "template_id": "f57db65d3f933b5316d398057a36176831451a35",
    "accounts": [
      {
        "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
        "email_address": "me@dropboxsign.com",
        "is_locked": false,
        "is_paid_hf": false,
        "is_paid_hs": true,
        "quotas": {
          "api_signature_requests_left": 0,
          "documents_left": 3600000,
          "sms_verifications_left": 300000,
          "templates_left": null
        }
      }
    ],
    "can_edit": true,
    "cc_roles": [
      {
        "name": "Corporate Attorney"
      }
    ],
    "documents": [
      {
        "custom_fields": [
          {
            "api_id": "78083014-32d8-4b5b-b65e-fe6010f3be64",
            "avg_text_length": {
              "num_chars_per_line": 22,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 14,
            "isMultiline": false,
            "name": "Effective Date",
            "originalFontSize": 12,
            "required": false,
            "signer": null,
            "type": "text",
            "width": 84,
            "x": 378,
            "y": 36
          }
        ],
        "field_groups": [
          {
            "name": "group1",
            "rule": "require_1-ormore"
          }
        ],
        "form_fields": [
          {
            "api_id": "b65e03_10",
            "group": "group1",
            "height": 15,
            "name": "DepartmentA",
            "required": false,
            "signer": "1",
            "type": "checkbox",
            "width": 15,
            "x": 117,
            "y": 19
          },
          {
            "api_id": "b65e03_11",
            "group": "group1",
            "height": 15,
            "name": "DepartmentB",
            "required": false,
            "signer": "2",
            "type": "checkbox",
            "width": 15,
            "x": 118,
            "y": 41
          },
          {
            "api_id": "0ec7a7_1",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorName",
            "originalFontSize": 12,
            "required": true,
            "signer": "1",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 141
          },
          {
            "api_id": "0ec7a7_2",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 181
          },
          {
            "api_id": "0ec7a7_3",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerName",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 221
          },
          {
            "api_id": "0ec7a7_4",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 251
          },
          {
            "api_id": "0ec7a7_5",
            "group": null,
            "height": 16,
            "name": "DateSigned",
            "required": true,
            "signer": "1",
            "type": "date_signed",
            "width": 105,
            "x": 523,
            "y": 28
          }
        ],
        "index": 0,
        "name": "mutual_nda.pdf"
      }
    ],
    "is_creator": true,
    "is_embedded": false,
    "is_locked": false,
    "message": "Please sign this NDA as soon as possible.",
    "metadata": {},
    "signer_roles": [
      {
        "name": "Outside Vendor",
        "order": 0
      },
      {
        "name": "Internal Manager",
        "order": 1
      }
    ],
    "title": "Mutual NDA",
    "updated_at": 1570471067
  }
}
```

**SDK Code**

```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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_1\",\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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_2\",\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",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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()
```

### Form Fields Per Document Example

**Request**

```json
{
  "form_fields_per_document": [
    {
      "type": "text",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    },
    {
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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"
}
```

**Response**

```json
{
  "template": {
    "template_id": "f57db65d3f933b5316d398057a36176831451a35",
    "accounts": [
      {
        "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
        "email_address": "me@dropboxsign.com",
        "is_locked": false,
        "is_paid_hf": false,
        "is_paid_hs": true,
        "quotas": {
          "api_signature_requests_left": 0,
          "documents_left": 3600000,
          "sms_verifications_left": 300000,
          "templates_left": null
        }
      }
    ],
    "can_edit": true,
    "cc_roles": [
      {
        "name": "Corporate Attorney"
      }
    ],
    "documents": [
      {
        "custom_fields": [
          {
            "api_id": "78083014-32d8-4b5b-b65e-fe6010f3be64",
            "avg_text_length": {
              "num_chars_per_line": 22,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 14,
            "isMultiline": false,
            "name": "Effective Date",
            "originalFontSize": 12,
            "required": false,
            "signer": null,
            "type": "text",
            "width": 84,
            "x": 378,
            "y": 36
          }
        ],
        "field_groups": [
          {
            "name": "group1",
            "rule": "require_1-ormore"
          }
        ],
        "form_fields": [
          {
            "api_id": "b65e03_10",
            "group": "group1",
            "height": 15,
            "name": "DepartmentA",
            "required": false,
            "signer": "1",
            "type": "checkbox",
            "width": 15,
            "x": 117,
            "y": 19
          },
          {
            "api_id": "b65e03_11",
            "group": "group1",
            "height": 15,
            "name": "DepartmentB",
            "required": false,
            "signer": "2",
            "type": "checkbox",
            "width": 15,
            "x": 118,
            "y": 41
          },
          {
            "api_id": "0ec7a7_1",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorName",
            "originalFontSize": 12,
            "required": true,
            "signer": "1",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 141
          },
          {
            "api_id": "0ec7a7_2",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 181
          },
          {
            "api_id": "0ec7a7_3",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerName",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 221
          },
          {
            "api_id": "0ec7a7_4",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 251
          },
          {
            "api_id": "0ec7a7_5",
            "group": null,
            "height": 16,
            "name": "DateSigned",
            "required": true,
            "signer": "1",
            "type": "date_signed",
            "width": 105,
            "x": 523,
            "y": 28
          }
        ],
        "index": 0,
        "name": "mutual_nda.pdf"
      }
    ],
    "is_creator": true,
    "is_embedded": false,
    "is_locked": false,
    "message": "Please sign this NDA as soon as possible.",
    "metadata": {},
    "signer_roles": [
      {
        "name": "Outside Vendor",
        "order": 0
      },
      {
        "name": "Internal Manager",
        "order": 1
      }
    ],
    "title": "Mutual NDA",
    "updated_at": 1570471067
  }
}
```

**SDK Code**

```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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_1\",\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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_2\",\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",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "1",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "placeholder": "",
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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()
```

### Form Fields Per Document and Groups Example

**Request**

```json
{
  "form_fields_per_document": [
    {
      "type": "radio",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 18,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "group": "RadioItemGroup1",
      "is_checked": 1
    },
    {
      "type": "radio",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "height": 18,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 370,
      "name": "",
      "page": 1,
      "group": "RadioItemGroup1",
      "is_checked": 0
    }
  ],
  "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"
}
```

**Response**

```json
{
  "template": {
    "template_id": "f57db65d3f933b5316d398057a36176831451a35",
    "accounts": [
      {
        "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
        "email_address": "me@dropboxsign.com",
        "is_locked": false,
        "is_paid_hf": false,
        "is_paid_hs": true,
        "quotas": {
          "api_signature_requests_left": 0,
          "documents_left": 3600000,
          "sms_verifications_left": 300000,
          "templates_left": null
        }
      }
    ],
    "can_edit": true,
    "cc_roles": [
      {
        "name": "Corporate Attorney"
      }
    ],
    "documents": [
      {
        "custom_fields": [
          {
            "api_id": "78083014-32d8-4b5b-b65e-fe6010f3be64",
            "avg_text_length": {
              "num_chars_per_line": 22,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 14,
            "isMultiline": false,
            "name": "Effective Date",
            "originalFontSize": 12,
            "required": false,
            "signer": null,
            "type": "text",
            "width": 84,
            "x": 378,
            "y": 36
          }
        ],
        "field_groups": [
          {
            "name": "group1",
            "rule": "require_1-ormore"
          }
        ],
        "form_fields": [
          {
            "api_id": "b65e03_10",
            "group": "group1",
            "height": 15,
            "name": "DepartmentA",
            "required": false,
            "signer": "1",
            "type": "checkbox",
            "width": 15,
            "x": 117,
            "y": 19
          },
          {
            "api_id": "b65e03_11",
            "group": "group1",
            "height": 15,
            "name": "DepartmentB",
            "required": false,
            "signer": "2",
            "type": "checkbox",
            "width": 15,
            "x": 118,
            "y": 41
          },
          {
            "api_id": "0ec7a7_1",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorName",
            "originalFontSize": 12,
            "required": true,
            "signer": "1",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 141
          },
          {
            "api_id": "0ec7a7_2",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 181
          },
          {
            "api_id": "0ec7a7_3",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerName",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 221
          },
          {
            "api_id": "0ec7a7_4",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 251
          },
          {
            "api_id": "0ec7a7_5",
            "group": null,
            "height": 16,
            "name": "DateSigned",
            "required": true,
            "signer": "1",
            "type": "date_signed",
            "width": 105,
            "x": 523,
            "y": 28
          }
        ],
        "index": 0,
        "name": "mutual_nda.pdf"
      }
    ],
    "is_creator": true,
    "is_embedded": false,
    "is_locked": false,
    "message": "Please sign this NDA as soon as possible.",
    "metadata": {},
    "signer_roles": [
      {
        "name": "Outside Vendor",
        "order": 0
      },
      {
        "name": "Internal Manager",
        "order": 1
      }
    ],
    "title": "Mutual NDA",
    "updated_at": 1570471067
  }
}
```

**SDK Code**

```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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_1\",\n      \"height\": 18,\n      \"required\": false,\n      \"signer\": \"0\",\n      \"width\": 18,\n      \"x\": 112,\n      \"y\": 328,\n      \"name\": \"\",\n      \"page\": 1,\n      \"group\": \"RadioItemGroup1\",\n      \"is_checked\": 1\n    },\n    {\n      \"type\": \"radio\",\n      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_2\",\n      \"height\": 18,\n      \"required\": false,\n      \"signer\": \"0\",\n      \"width\": 18,\n      \"x\": 112,\n      \"y\": 370,\n      \"name\": \"\",\n      \"page\": 1,\n      \"group\": \"RadioItemGroup1\",\n      \"is_checked\": 0\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",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 18,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "group": "RadioItemGroup1",
      "is_checked": 1
    ],
    [
      "type": "radio",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "height": 18,
      "required": false,
      "signer": "0",
      "width": 18,
      "x": 112,
      "y": 370,
      "name": "",
      "page": 1,
      "group": "RadioItemGroup1",
      "is_checked": 0
    ]
  ],
  "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()
```

### Form Fields Per Document and Rules Example

**Request**

```json
{
  "form_fields_per_document": [
    {
      "type": "text",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "0",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "validation_type": "numbers_only"
    },
    {
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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"
}
```

**Response**

```json
{
  "template": {
    "template_id": "f57db65d3f933b5316d398057a36176831451a35",
    "accounts": [
      {
        "account_id": "5008b25c7f67153e57d5a357b1687968068fb465",
        "email_address": "me@dropboxsign.com",
        "is_locked": false,
        "is_paid_hf": false,
        "is_paid_hs": true,
        "quotas": {
          "api_signature_requests_left": 0,
          "documents_left": 3600000,
          "sms_verifications_left": 300000,
          "templates_left": null
        }
      }
    ],
    "can_edit": true,
    "cc_roles": [
      {
        "name": "Corporate Attorney"
      }
    ],
    "documents": [
      {
        "custom_fields": [
          {
            "api_id": "78083014-32d8-4b5b-b65e-fe6010f3be64",
            "avg_text_length": {
              "num_chars_per_line": 22,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 14,
            "isMultiline": false,
            "name": "Effective Date",
            "originalFontSize": 12,
            "required": false,
            "signer": null,
            "type": "text",
            "width": 84,
            "x": 378,
            "y": 36
          }
        ],
        "field_groups": [
          {
            "name": "group1",
            "rule": "require_1-ormore"
          }
        ],
        "form_fields": [
          {
            "api_id": "b65e03_10",
            "group": "group1",
            "height": 15,
            "name": "DepartmentA",
            "required": false,
            "signer": "1",
            "type": "checkbox",
            "width": 15,
            "x": 117,
            "y": 19
          },
          {
            "api_id": "b65e03_11",
            "group": "group1",
            "height": 15,
            "name": "DepartmentB",
            "required": false,
            "signer": "2",
            "type": "checkbox",
            "width": 15,
            "x": 118,
            "y": 41
          },
          {
            "api_id": "0ec7a7_1",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorName",
            "originalFontSize": 12,
            "required": true,
            "signer": "1",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 141
          },
          {
            "api_id": "0ec7a7_2",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "VendorTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 181
          },
          {
            "api_id": "0ec7a7_3",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerName",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 221
          },
          {
            "api_id": "0ec7a7_4",
            "avg_text_length": {
              "num_chars_per_line": 19,
              "num_lines": 1
            },
            "fontFamily": "arial",
            "group": null,
            "height": 30,
            "isMultiline": false,
            "name": "ManagerTitle",
            "originalFontSize": 12,
            "required": true,
            "signer": "2",
            "type": "text",
            "width": 80,
            "x": 160,
            "y": 251
          },
          {
            "api_id": "0ec7a7_5",
            "group": null,
            "height": 16,
            "name": "DateSigned",
            "required": true,
            "signer": "1",
            "type": "date_signed",
            "width": 105,
            "x": 523,
            "y": 28
          }
        ],
        "index": 0,
        "name": "mutual_nda.pdf"
      }
    ],
    "is_creator": true,
    "is_embedded": false,
    "is_locked": false,
    "message": "Please sign this NDA as soon as possible.",
    "metadata": {},
    "signer_roles": [
      {
        "name": "Outside Vendor",
        "order": 0
      },
      {
        "name": "Internal Manager",
        "order": 1
      }
    ],
    "title": "Mutual NDA",
    "updated_at": 1570471067
  }
}
```

**SDK Code**

```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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_1\",\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      \"document_index\": 0,\n      \"api_id\": \"uniqueIdHere_2\",\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",
      "document_index": 0,
      "api_id": "uniqueIdHere_1",
      "height": 16,
      "required": true,
      "signer": "0",
      "width": 100,
      "x": 112,
      "y": 328,
      "name": "",
      "page": 1,
      "validation_type": "numbers_only"
    ],
    [
      "type": "signature",
      "document_index": 0,
      "api_id": "uniqueIdHere_2",
      "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()
```