> 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 Embedded Template Draft

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

The first step in an embedded template workflow. Creates a draft template that can then be further set up in the template 'edit' stage.

Reference: https://developers.hellosign.com/api/template/create-embedded-draft

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: Dropbox Sign API
  version: 1.0.0
paths:
  /template/create_embedded_draft:
    post:
      operationId: createEmbeddedDraft
      summary: Create Embedded Template Draft
      description: >-
        The first step in an embedded template workflow. Creates a draft
        template that can then be further set up in the template 'edit' stage.
      tags:
        - Template
      parameters:
        - name: Authorization
          in: header
          description: >
            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).            
          required: true
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TemplateCreateEmbeddedDraftResponse'
        '400':
          description: failed_operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TemplateCreateEmbeddedDraftRequest'
servers:
  - url: https://api.hellosign.com/v3
    description: https://api.hellosign.com/v3
components:
  schemas:
    SubAttachment:
      type: object
      properties:
        instructions:
          type: string
          description: The instructions for uploading the attachment.
        name:
          type: string
          description: The name of attachment.
        required:
          type: boolean
          default: false
          description: Determines if the attachment must be uploaded.
        signer_index:
          type: integer
          description: |-
            The signer's index in the `signers` parameter (0-based indexing).

            **NOTE:** Only one signer can be assigned per attachment.
      required:
        - name
        - signer_index
      title: SubAttachment
    SubEditorOptions:
      type: object
      properties:
        allow_edit_signers:
          type: boolean
          default: false
          description: Allows requesters to edit the list of signers
        allow_edit_documents:
          type: boolean
          default: false
          description: Allows requesters to edit documents, including delete and add
      description: >-
        This allows the requester to specify editor options when a preparing a
        document
      title: SubEditorOptions
    SubFieldOptionsDateFormat:
      type: string
      enum:
        - MM / DD / YYYY
        - MM - DD - YYYY
        - DD / MM / YYYY
        - DD - MM - YYYY
        - YYYY / MM / DD
        - YYYY - MM - DD
      description: >-
        Allows requester to specify the date format (see list of allowed
        [formats](/api/reference/constants/#date-formats))


        **NOTE:** Only available for Premium and higher.
      title: SubFieldOptionsDateFormat
    SubFieldOptions:
      type: object
      properties:
        date_format:
          $ref: '#/components/schemas/SubFieldOptionsDateFormat'
          description: >-
            Allows requester to specify the date format (see list of allowed
            [formats](/api/reference/constants/#date-formats))


            **NOTE:** Only available for Premium and higher.
      required:
        - date_format
      description: >-
        This allows the requester to specify field options for a signature
        request.
      title: SubFieldOptions
    SubFormFieldGroup:
      type: object
      properties:
        group_id:
          type: string
          description: >-
            ID of group. Use this to reference a specific group from the `group`
            value in `form_fields_per_document`.
        group_label:
          type: string
          description: Name of the group
        requirement:
          type: string
          description: >-
            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.
      required:
        - group_id
        - group_label
        - requirement
      title: SubFormFieldGroup
    SubFormFieldRuleTriggerOperator:
      type: string
      enum:
        - any
        - is
        - match
        - none
        - not
      description: |-
        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
      title: SubFormFieldRuleTriggerOperator
    SubFormFieldRuleTrigger:
      type: object
      properties:
        id:
          type: string
          description: >-
            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:
          $ref: '#/components/schemas/SubFormFieldRuleTriggerOperator'
          description: |-
            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
        value:
          type: string
          description: >-
            **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:
          type: array
          items:
            type: string
          description: >-
            **values** or **value** is required, but not both.


            The values to match against **operator** when it is one of the
            following:


            - `any`

            - `none`
      required:
        - id
        - operator
      title: SubFormFieldRuleTrigger
    SubFormFieldRuleActionType:
      type: string
      enum:
        - change-field-visibility
        - change-group-visibility
      title: SubFormFieldRuleActionType
    SubFormFieldRuleAction:
      type: object
      properties:
        field_id:
          type: string
          description: >-
            **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:
          type: string
          description: >-
            **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.
        hidden:
          type: boolean
          description: >-
            `true` to hide the target field when rule is satisfied, otherwise
            `false`.
        type:
          $ref: '#/components/schemas/SubFormFieldRuleActionType'
      required:
        - hidden
        - type
      title: SubFormFieldRuleAction
    SubFormFieldRule:
      type: object
      properties:
        id:
          type: string
          description: Must be unique across all defined rules.
        trigger_operator:
          type: string
          default: AND
          description: >-
            Currently only `AND` is supported. Support for `OR` is being worked
            on.
        triggers:
          type: array
          items:
            $ref: '#/components/schemas/SubFormFieldRuleTrigger'
          description: >-
            An array of trigger definitions, the "if this" part of "**if this**,
            then that". Currently only a single trigger per rule is allowed.
        actions:
          type: array
          items:
            $ref: '#/components/schemas/SubFormFieldRuleAction'
          description: >-
            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.
      required:
        - id
        - trigger_operator
        - triggers
        - actions
      title: SubFormFieldRule
    SubFormFieldsPerDocumentTextValidationType:
      type: string
      enum:
        - numbers_only
        - letters_only
        - phone_number
        - bank_routing_number
        - bank_account_number
        - email_address
        - zip_code
        - social_security_number
        - employer_identification_number
        - custom_regex
      description: >-
        Each text field may contain a `validation_type` parameter. Check out the
        list of [validation
        types](https://faq.hellosign.com/hc/en-us/articles/217115577) to learn
        more about the possible values.


        **NOTE:** When using `custom_regex` you are required to pass a second
        parameter `validation_custom_regex` and you can optionally provide
        `validation_custom_regex_format_label` for the error message the user
        will see in case of an invalid value.
      title: SubFormFieldsPerDocumentTextValidationType
    SubFormFieldsPerDocumentTextFontFamily:
      type: string
      enum:
        - helvetica
        - arial
        - courier
        - calibri
        - cambria
        - georgia
        - times
        - trebuchet
        - verdana
        - roboto
        - robotoMono
        - notoSans
        - notoSerif
        - notoCJK-JP-Regular
        - notoHebrew-Regular
        - notoSanThaiMerged
      description: Font family for the field.
      title: SubFormFieldsPerDocumentTextFontFamily
    SubFormFieldsPerDocumentDropdownFontFamily:
      type: string
      enum:
        - helvetica
        - arial
        - courier
        - calibri
        - cambria
        - georgia
        - times
        - trebuchet
        - verdana
        - roboto
        - robotoMono
        - notoSans
        - notoSerif
        - notoCJK-JP-Regular
        - notoHebrew-Regular
        - notoSanThaiMerged
      description: Font family for the field.
      title: SubFormFieldsPerDocumentDropdownFontFamily
    SubFormFieldsPerDocumentHyperlinkFontFamily:
      type: string
      enum:
        - helvetica
        - arial
        - courier
        - calibri
        - cambria
        - georgia
        - times
        - trebuchet
        - verdana
        - roboto
        - robotoMono
        - notoSans
        - notoSerif
        - notoCJK-JP-Regular
        - notoHebrew-Regular
        - notoSanThaiMerged
      description: Font family for the field.
      title: SubFormFieldsPerDocumentHyperlinkFontFamily
    SubFormFieldsPerDocumentDateSignedFontFamily:
      type: string
      enum:
        - helvetica
        - arial
        - courier
        - calibri
        - cambria
        - georgia
        - times
        - trebuchet
        - verdana
        - roboto
        - robotoMono
        - notoSans
        - notoSerif
        - notoCJK-JP-Regular
        - notoHebrew-Regular
        - notoSanThaiMerged
      description: Font family for the field.
      title: SubFormFieldsPerDocumentDateSignedFontFamily
    SubFormFieldsPerDocumentTextMergeFontFamily:
      type: string
      enum:
        - helvetica
        - arial
        - courier
        - calibri
        - cambria
        - georgia
        - times
        - trebuchet
        - verdana
        - roboto
        - robotoMono
        - notoSans
        - notoSerif
        - notoCJK-JP-Regular
        - notoHebrew-Regular
        - notoSanThaiMerged
      description: Font family for the field.
      title: SubFormFieldsPerDocumentTextMergeFontFamily
    SubFormFieldsPerDocumentBase:
      oneOf:
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
        - type: object
          properties:
            type:
              type: string
            document_index:
              type: integer
              description: >-
                Represents the integer index of the `file` or `file_url`
                document the field should be attached to.
            api_id:
              type: string
              description: >-
                An identifier for the field that is unique across all documents
                in the request.
            height:
              type: integer
              description: Size of the field in pixels.
            name:
              type: string
              description: Display name for the field.
            page:
              type:
                - integer
                - 'null'
              description: >-
                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.
            required:
              type: boolean
              description: Whether this field is required.
            signer:
              type: string
              description: >-
                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:
              type: integer
              description: Size of the field in pixels.
            x:
              type: integer
              description: Location coordinates of the field in pixels.
            'y':
              type: integer
              description: Location coordinates of the field in pixels.
          required:
            - type
            - document_index
            - api_id
            - height
            - required
            - signer
            - width
            - x
            - 'y'
          description: This class extends `SubFormFieldsPerDocumentBase`.
      discriminator:
        propertyName: type
      description: >-
        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`
      title: SubFormFieldsPerDocumentBase
    SubMergeFieldType:
      type: string
      enum:
        - text
        - checkbox
      description: The type of merge field.
      title: SubMergeFieldType
    SubMergeField:
      type: object
      properties:
        name:
          type: string
          description: The name of the merge field. Must be unique.
        type:
          $ref: '#/components/schemas/SubMergeFieldType'
          description: The type of merge field.
      required:
        - name
        - type
      title: SubMergeField
    SubTemplateRole:
      type: object
      properties:
        name:
          type: string
          description: >-
            The role name of the signer that will be displayed when the template
            is used to create a signature request.
        order:
          type:
            - integer
            - 'null'
          description: The order in which this signer role is required to sign.
      title: SubTemplateRole
    TemplateCreateEmbeddedDraftRequest:
      type: object
      properties:
        files:
          type: array
          items:
            type: string
            format: binary
          description: >-
            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:
          type: array
          items:
            type: string
          description: >-
            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_ccs:
          type: boolean
          default: true
          description: >-
            This allows the requester to specify whether the user is allowed to
            provide email addresses to CC when creating a template.
        allow_reassign:
          type: boolean
          default: false
          description: >-
            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:
          type: array
          items:
            $ref: '#/components/schemas/SubAttachment'
          description: A list describing the attachments
        cc_roles:
          type: array
          items:
            type: string
          description: >-
            The CC roles that must be assigned when using the template to send a
            signature request
        client_id:
          type: string
          description: >-
            Client id of the app you're using to create this draft. Used to
            apply the branding and callback url defined for the app.
        editor_options:
          $ref: '#/components/schemas/SubEditorOptions'
        field_options:
          $ref: '#/components/schemas/SubFieldOptions'
        force_signer_roles:
          type: boolean
          default: false
          description: Provide users the ability to review/edit the template signer roles.
        force_subject_message:
          type: boolean
          default: false
          description: >-
            Provide users the ability to review/edit the template subject and
            message.
        form_field_groups:
          type: array
          items:
            $ref: '#/components/schemas/SubFormFieldGroup'
          description: >-
            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`.
        form_field_rules:
          type: array
          items:
            $ref: '#/components/schemas/SubFormFieldRule'
          description: >-
            Conditional Logic rules for fields defined in
            `form_fields_per_document`.
        form_fields_per_document:
          type: array
          items:
            $ref: '#/components/schemas/SubFormFieldsPerDocumentBase'
          description: >-
            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`
        merge_fields:
          type: array
          items:
            $ref: '#/components/schemas/SubMergeField'
          description: >-
            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.
        message:
          type: string
          description: The default template email message.
        metadata:
          type: object
          additionalProperties:
            description: Any type
          description: >-
            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.
        show_preview:
          type: boolean
          default: false
          description: >-
            This allows the requester to enable the editor/preview experience.


            - `show_preview=true`: Allows requesters to enable the
            editor/preview experience.

            - `show_preview=false`: Allows requesters to disable the
            editor/preview experience.
        show_progress_stepper:
          type: boolean
          default: true
          description: >-
            When only one step remains in the signature request process and this
            parameter is set to `false` then the progress stepper will be
            hidden.
        signer_roles:
          type: array
          items:
            $ref: '#/components/schemas/SubTemplateRole'
          description: >-
            An array of the designated signer roles that must be specified when
            sending a SignatureRequest using this Template.
        skip_me_now:
          type: boolean
          default: false
          description: >-
            Disables the "Me (Now)" option for the person preparing the
            document. Does not work with type `send_document`. Defaults to
            `false`.
        subject:
          type: string
          description: The template title (alias).
        test_mode:
          type: boolean
          default: false
          description: >-
            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:
          type: string
          description: The title you want to assign to the SignatureRequest.
        use_preexisting_fields:
          type: boolean
          default: false
          description: >-
            Enable the detection of predefined PDF fields by setting the
            `use_preexisting_fields` to `true` (defaults to disabled, or
            `false`).
      required:
        - client_id
      title: TemplateCreateEmbeddedDraftRequest
    WarningResponse:
      type: object
      properties:
        warning_msg:
          type: string
          description: Warning message
        warning_name:
          type: string
          description: Warning name
      required:
        - warning_msg
        - warning_name
      description: A list of warnings.
      title: WarningResponse
    TemplateCreateEmbeddedDraftResponseTemplate:
      type: object
      properties:
        template_id:
          type: string
          description: The id of the Template.
        edit_url:
          type: string
          description: Link to edit the template.
        expires_at:
          type: integer
          description: When the link expires.
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/WarningResponse'
          description: A list of warnings.
      description: >-
        Template object with parameters: `template_id`, `edit_url`,
        `expires_at`.
      title: TemplateCreateEmbeddedDraftResponseTemplate
    TemplateCreateEmbeddedDraftResponse:
      type: object
      properties:
        template:
          $ref: '#/components/schemas/TemplateCreateEmbeddedDraftResponseTemplate'
        warnings:
          type: array
          items:
            $ref: '#/components/schemas/WarningResponse'
          description: A list of warnings.
      required:
        - template
      title: TemplateCreateEmbeddedDraftResponse
    ErrorResponseError:
      type: object
      properties:
        error_msg:
          type: string
          description: Message describing an error.
        error_path:
          type: string
          description: Path at which an error occurred.
        error_name:
          type: string
          description: >-
            Name of the error. See the `x-error-codes` catalog in openapi file
            for a complete list of possible error codes with detailed
            information including HTTP status codes, causes, remediation steps,
            and retry guidance.
      required:
        - error_msg
        - error_name
      description: Contains information about an error that occurred.
      title: ErrorResponseError
    ErrorResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorResponseError'
      required:
        - error
      title: ErrorResponse
  securitySchemes:
    Basic:
      type: http
      scheme: basic
      description: >
        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).            
    Bearer:
      type: http
      scheme: bearer
      description: >
        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.

```

## Examples

### Create Embedded Draft Template



**Request**

```json
undefined
```

**Response**

```json
{
  "template": {
    "template_id": "61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "edit_url": "https://app.hellosign.com/editor/embeddedTemplate?token=8d80ead273a0405d6844005a20beb99b&amp;root_snapshot_guids%5B0%5D=74cc144a76afa5bdca3378278e9a6ac3c2947c92&amp;snapshot_access_guids%5B0%5D=9ceac764&amp;guid=61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "expires_at": 1427306768
  }
}
```

**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);

$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,
];

$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,
];

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

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

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreateEmbeddedDraft: {$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 TemplateCreateEmbeddedDraftExample
{
    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 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 signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

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

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

        var templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest(
            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,
            mergeFields: mergeFields,
            signerRoles: signerRoles
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest: templateCreateEmbeddedDraftRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreateEmbeddedDraft: " + 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 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 signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

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

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const templateCreateEmbeddedDraftRequest: models.TemplateCreateEmbeddedDraftRequest = {
  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,
  mergeFields: mergeFields,
  signerRoles: signerRoles,
};

apiCaller.templateCreateEmbeddedDraft(
  templateCreateEmbeddedDraftRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreateEmbeddedDraft:");
  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 TemplateCreateEmbeddedDraftExample
{
    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 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 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 templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest();
        templateCreateEmbeddedDraftRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateEmbeddedDraftRequest.message("For your approval");
        templateCreateEmbeddedDraftRequest.subject("Please sign this document");
        templateCreateEmbeddedDraftRequest.testMode(true);
        templateCreateEmbeddedDraftRequest.title("Test Template");
        templateCreateEmbeddedDraftRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateEmbeddedDraftRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateEmbeddedDraftRequest.fieldOptions(fieldOptions);
        templateCreateEmbeddedDraftRequest.mergeFields(mergeFields);
        templateCreateEmbeddedDraftRequest.signerRoles(signerRoles);

        try
        {
            var response = new TemplateApi(config).templateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreateEmbeddedDraft");
            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"

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,
]

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,
]

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

begin
    response = Dropbox::Sign::TemplateApi.new.template_create_embedded_draft(
        template_create_embedded_draft_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create_embedded_draft: #{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",
    )

    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,
    ]

    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,
    ]

    template_create_embedded_draft_request = models.TemplateCreateEmbeddedDraftRequest(
        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,
        merge_fields=merge_fields,
        signer_roles=signer_roles,
    )

    try:
        response = api.TemplateApi(api_client).template_create_embedded_draft(
            template_create_embedded_draft_request=template_create_embedded_draft_request,
        )

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

```

```go Create Embedded Draft Template
package main

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

func main() {

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

	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 Embedded Draft 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_embedded_draft")! 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
{
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": [
    "https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"
  ],
  "cc_roles": [
    "Manager"
  ],
  "field_options": {
    "date_format": "DD - MM - YYYY"
  },
  "merge_fields": [
    {
      "name": "Full Name",
      "type": "text"
    },
    {
      "name": "Is Registered?",
      "type": "checkbox"
    }
  ],
  "message": "For your approval",
  "signer_roles": [
    {
      "name": "Client",
      "order": 0
    },
    {
      "name": "Witness",
      "order": 1
    }
  ],
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
}
```

**Response**

```json
{
  "template": {
    "template_id": "61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "edit_url": "https://app.hellosign.com/editor/embeddedTemplate?token=8d80ead273a0405d6844005a20beb99b&amp;root_snapshot_guids%5B0%5D=74cc144a76afa5bdca3378278e9a6ac3c2947c92&amp;snapshot_access_guids%5B0%5D=9ceac764&amp;guid=61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "expires_at": 1427306768
  }
}
```

**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);

$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,
];

$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,
];

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

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

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreateEmbeddedDraft: {$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 TemplateCreateEmbeddedDraftExample
{
    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 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 signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

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

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

        var templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest(
            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,
            mergeFields: mergeFields,
            signerRoles: signerRoles
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest: templateCreateEmbeddedDraftRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreateEmbeddedDraft: " + 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 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 signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

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

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const templateCreateEmbeddedDraftRequest: models.TemplateCreateEmbeddedDraftRequest = {
  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,
  mergeFields: mergeFields,
  signerRoles: signerRoles,
};

apiCaller.templateCreateEmbeddedDraft(
  templateCreateEmbeddedDraftRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreateEmbeddedDraft:");
  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 TemplateCreateEmbeddedDraftExample
{
    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 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 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 templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest();
        templateCreateEmbeddedDraftRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateEmbeddedDraftRequest.message("For your approval");
        templateCreateEmbeddedDraftRequest.subject("Please sign this document");
        templateCreateEmbeddedDraftRequest.testMode(true);
        templateCreateEmbeddedDraftRequest.title("Test Template");
        templateCreateEmbeddedDraftRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateEmbeddedDraftRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateEmbeddedDraftRequest.fieldOptions(fieldOptions);
        templateCreateEmbeddedDraftRequest.mergeFields(mergeFields);
        templateCreateEmbeddedDraftRequest.signerRoles(signerRoles);

        try
        {
            var response = new TemplateApi(config).templateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreateEmbeddedDraft");
            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"

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,
]

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,
]

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

begin
    response = Dropbox::Sign::TemplateApi.new.template_create_embedded_draft(
        template_create_embedded_draft_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create_embedded_draft: #{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",
    )

    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,
    ]

    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,
    ]

    template_create_embedded_draft_request = models.TemplateCreateEmbeddedDraftRequest(
        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,
        merge_fields=merge_fields,
        signer_roles=signer_roles,
    )

    try:
        response = api.TemplateApi(api_client).template_create_embedded_draft(
            template_create_embedded_draft_request=template_create_embedded_draft_request,
        )

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

```

```go Default Example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\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  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\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 = [
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "field_options": ["date_format": "DD - MM - YYYY"],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "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_embedded_draft")! 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
{
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": [
    "https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"
  ],
  "cc_roles": [
    "Manager"
  ],
  "field_options": {
    "date_format": "DD - MM - YYYY"
  },
  "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
    }
  ],
  "merge_fields": [
    {
      "name": "Full Name",
      "type": "text"
    },
    {
      "name": "Is Registered?",
      "type": "checkbox"
    }
  ],
  "message": "For your approval",
  "signer_roles": [
    {
      "name": "Client",
      "order": 0
    },
    {
      "name": "Witness",
      "order": 1
    }
  ],
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
}
```

**Response**

```json
{
  "template": {
    "template_id": "61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "edit_url": "https://app.hellosign.com/editor/embeddedTemplate?token=8d80ead273a0405d6844005a20beb99b&amp;root_snapshot_guids%5B0%5D=74cc144a76afa5bdca3378278e9a6ac3c2947c92&amp;snapshot_access_guids%5B0%5D=9ceac764&amp;guid=61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "expires_at": 1427306768
  }
}
```

**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);

$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,
];

$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,
];

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

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

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreateEmbeddedDraft: {$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 TemplateCreateEmbeddedDraftExample
{
    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 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 signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

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

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

        var templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest(
            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,
            mergeFields: mergeFields,
            signerRoles: signerRoles
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest: templateCreateEmbeddedDraftRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreateEmbeddedDraft: " + 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 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 signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

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

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const templateCreateEmbeddedDraftRequest: models.TemplateCreateEmbeddedDraftRequest = {
  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,
  mergeFields: mergeFields,
  signerRoles: signerRoles,
};

apiCaller.templateCreateEmbeddedDraft(
  templateCreateEmbeddedDraftRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreateEmbeddedDraft:");
  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 TemplateCreateEmbeddedDraftExample
{
    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 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 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 templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest();
        templateCreateEmbeddedDraftRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateEmbeddedDraftRequest.message("For your approval");
        templateCreateEmbeddedDraftRequest.subject("Please sign this document");
        templateCreateEmbeddedDraftRequest.testMode(true);
        templateCreateEmbeddedDraftRequest.title("Test Template");
        templateCreateEmbeddedDraftRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateEmbeddedDraftRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateEmbeddedDraftRequest.fieldOptions(fieldOptions);
        templateCreateEmbeddedDraftRequest.mergeFields(mergeFields);
        templateCreateEmbeddedDraftRequest.signerRoles(signerRoles);

        try
        {
            var response = new TemplateApi(config).templateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreateEmbeddedDraft");
            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"

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,
]

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,
]

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

begin
    response = Dropbox::Sign::TemplateApi.new.template_create_embedded_draft(
        template_create_embedded_draft_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create_embedded_draft: #{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",
    )

    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,
    ]

    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,
    ]

    template_create_embedded_draft_request = models.TemplateCreateEmbeddedDraftRequest(
        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,
        merge_fields=merge_fields,
        signer_roles=signer_roles,
    )

    try:
        response = api.TemplateApi(api_client).template_create_embedded_draft(
            template_create_embedded_draft_request=template_create_embedded_draft_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create_embedded_draft: %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_embedded_draft"

	payload := strings.NewReader("{\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\n  \"field_options\": {\n    \"date_format\": \"DD - MM - YYYY\"\n  },\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  \"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  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\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 = [
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "field_options": ["date_format": "DD - MM - YYYY"],
  "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
    ]
  ],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "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_embedded_draft")! 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
{
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": [
    "https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"
  ],
  "cc_roles": [
    "Manager"
  ],
  "field_options": {
    "date_format": "DD - MM - YYYY"
  },
  "form_field_groups": [
    {
      "group_id": "RadioItemGroup1",
      "group_label": "Radio Item Group 1",
      "requirement": "require_0-1"
    }
  ],
  "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
    }
  ],
  "merge_fields": [
    {
      "name": "Full Name",
      "type": "text"
    },
    {
      "name": "Is Registered?",
      "type": "checkbox"
    }
  ],
  "message": "For your approval",
  "signer_roles": [
    {
      "name": "Client",
      "order": 0
    },
    {
      "name": "Witness",
      "order": 1
    }
  ],
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
}
```

**Response**

```json
{
  "template": {
    "template_id": "61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "edit_url": "https://app.hellosign.com/editor/embeddedTemplate?token=8d80ead273a0405d6844005a20beb99b&amp;root_snapshot_guids%5B0%5D=74cc144a76afa5bdca3378278e9a6ac3c2947c92&amp;snapshot_access_guids%5B0%5D=9ceac764&amp;guid=61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "expires_at": 1427306768
  }
}
```

**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);

$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,
];

$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,
];

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

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

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreateEmbeddedDraft: {$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 TemplateCreateEmbeddedDraftExample
{
    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 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 signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

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

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

        var templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest(
            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,
            mergeFields: mergeFields,
            signerRoles: signerRoles
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest: templateCreateEmbeddedDraftRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreateEmbeddedDraft: " + 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 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 signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

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

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const templateCreateEmbeddedDraftRequest: models.TemplateCreateEmbeddedDraftRequest = {
  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,
  mergeFields: mergeFields,
  signerRoles: signerRoles,
};

apiCaller.templateCreateEmbeddedDraft(
  templateCreateEmbeddedDraftRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreateEmbeddedDraft:");
  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 TemplateCreateEmbeddedDraftExample
{
    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 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 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 templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest();
        templateCreateEmbeddedDraftRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateEmbeddedDraftRequest.message("For your approval");
        templateCreateEmbeddedDraftRequest.subject("Please sign this document");
        templateCreateEmbeddedDraftRequest.testMode(true);
        templateCreateEmbeddedDraftRequest.title("Test Template");
        templateCreateEmbeddedDraftRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateEmbeddedDraftRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateEmbeddedDraftRequest.fieldOptions(fieldOptions);
        templateCreateEmbeddedDraftRequest.mergeFields(mergeFields);
        templateCreateEmbeddedDraftRequest.signerRoles(signerRoles);

        try
        {
            var response = new TemplateApi(config).templateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreateEmbeddedDraft");
            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"

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,
]

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,
]

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

begin
    response = Dropbox::Sign::TemplateApi.new.template_create_embedded_draft(
        template_create_embedded_draft_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create_embedded_draft: #{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",
    )

    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,
    ]

    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,
    ]

    template_create_embedded_draft_request = models.TemplateCreateEmbeddedDraftRequest(
        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,
        merge_fields=merge_fields,
        signer_roles=signer_roles,
    )

    try:
        response = api.TemplateApi(api_client).template_create_embedded_draft(
            template_create_embedded_draft_request=template_create_embedded_draft_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create_embedded_draft: %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_embedded_draft"

	payload := strings.NewReader("{\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\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  \"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  \"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  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\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 = [
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "field_options": ["date_format": "DD - MM - YYYY"],
  "form_field_groups": [
    [
      "group_id": "RadioItemGroup1",
      "group_label": "Radio Item Group 1",
      "requirement": "require_0-1"
    ]
  ],
  "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
    ]
  ],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "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_embedded_draft")! 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
{
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": [
    "https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"
  ],
  "cc_roles": [
    "Manager"
  ],
  "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"
        }
      ]
    }
  ],
  "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
    }
  ],
  "merge_fields": [
    {
      "name": "Full Name",
      "type": "text"
    },
    {
      "name": "Is Registered?",
      "type": "checkbox"
    }
  ],
  "message": "For your approval",
  "signer_roles": [
    {
      "name": "Client",
      "order": 0
    },
    {
      "name": "Witness",
      "order": 1
    }
  ],
  "subject": "Please sign this document",
  "test_mode": true,
  "title": "Test Template"
}
```

**Response**

```json
{
  "template": {
    "template_id": "61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "edit_url": "https://app.hellosign.com/editor/embeddedTemplate?token=8d80ead273a0405d6844005a20beb99b&amp;root_snapshot_guids%5B0%5D=74cc144a76afa5bdca3378278e9a6ac3c2947c92&amp;snapshot_access_guids%5B0%5D=9ceac764&amp;guid=61a832ff0d8423f91d503e76bfbcc750f7417c78",
    "expires_at": 1427306768
  }
}
```

**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);

$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,
];

$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,
];

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

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

    print_r($response);
} catch (Dropbox\Sign\ApiException $e) {
    echo "Exception when calling TemplateApi#templateCreateEmbeddedDraft: {$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 TemplateCreateEmbeddedDraftExample
{
    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 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 signerRoles1 = new SubTemplateRole(
            name: "Client",
            order: 0
        );

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

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

        var templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest(
            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,
            mergeFields: mergeFields,
            signerRoles: signerRoles
        );

        try
        {
            var response = new TemplateApi(config).TemplateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest: templateCreateEmbeddedDraftRequest
            );

            Console.WriteLine(response);
        }
        catch (ApiException e)
        {
            Console.WriteLine("Exception when calling TemplateApi#TemplateCreateEmbeddedDraft: " + 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 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 signerRoles1: models.SubTemplateRole = {
  name: "Client",
  order: 0,
};

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

const signerRoles = [
  signerRoles1,
  signerRoles2,
];

const templateCreateEmbeddedDraftRequest: models.TemplateCreateEmbeddedDraftRequest = {
  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,
  mergeFields: mergeFields,
  signerRoles: signerRoles,
};

apiCaller.templateCreateEmbeddedDraft(
  templateCreateEmbeddedDraftRequest,
).then(response => {
  console.log(response.body);
}).catch(error => {
  console.log("Exception when calling TemplateApi#templateCreateEmbeddedDraft:");
  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 TemplateCreateEmbeddedDraftExample
{
    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 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 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 templateCreateEmbeddedDraftRequest = new TemplateCreateEmbeddedDraftRequest();
        templateCreateEmbeddedDraftRequest.clientId("37dee8d8440c66d54cfa05d92c160882");
        templateCreateEmbeddedDraftRequest.message("For your approval");
        templateCreateEmbeddedDraftRequest.subject("Please sign this document");
        templateCreateEmbeddedDraftRequest.testMode(true);
        templateCreateEmbeddedDraftRequest.title("Test Template");
        templateCreateEmbeddedDraftRequest.ccRoles(List.of (
            "Manager"
        ));
        templateCreateEmbeddedDraftRequest.files(List.of (
            new File("./example_signature_request.pdf")
        ));
        templateCreateEmbeddedDraftRequest.fieldOptions(fieldOptions);
        templateCreateEmbeddedDraftRequest.mergeFields(mergeFields);
        templateCreateEmbeddedDraftRequest.signerRoles(signerRoles);

        try
        {
            var response = new TemplateApi(config).templateCreateEmbeddedDraft(
                templateCreateEmbeddedDraftRequest
            );

            System.out.println(response);
        } catch (ApiException e) {
            System.err.println("Exception when calling TemplateApi#templateCreateEmbeddedDraft");
            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"

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,
]

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,
]

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

begin
    response = Dropbox::Sign::TemplateApi.new.template_create_embedded_draft(
        template_create_embedded_draft_request,
    )

    p response
rescue Dropbox::Sign::ApiError => e
    puts "Exception when calling TemplateApi#template_create_embedded_draft: #{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",
    )

    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,
    ]

    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,
    ]

    template_create_embedded_draft_request = models.TemplateCreateEmbeddedDraftRequest(
        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,
        merge_fields=merge_fields,
        signer_roles=signer_roles,
    )

    try:
        response = api.TemplateApi(api_client).template_create_embedded_draft(
            template_create_embedded_draft_request=template_create_embedded_draft_request,
        )

        pprint(response)
    except ApiException as e:
        print("Exception when calling TemplateApi#template_create_embedded_draft: %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_embedded_draft"

	payload := strings.NewReader("{\n  \"client_id\": \"37dee8d8440c66d54cfa05d92c160882\",\n  \"file_urls\": [\n    \"https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1\"\n  ],\n  \"cc_roles\": [\n    \"Manager\"\n  ],\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  \"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  \"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  \"signer_roles\": [\n    {\n      \"name\": \"Client\",\n      \"order\": 0\n    },\n    {\n      \"name\": \"Witness\",\n      \"order\": 1\n    }\n  ],\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 = [
  "client_id": "37dee8d8440c66d54cfa05d92c160882",
  "file_urls": ["https://www.dropbox.com/s/ad9qnhbrjjn64tu/mutual-NDA-example.pdf?dl=1"],
  "cc_roles": ["Manager"],
  "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"
        ]
      ]
    ]
  ],
  "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
    ]
  ],
  "merge_fields": [
    [
      "name": "Full Name",
      "type": "text"
    ],
    [
      "name": "Is Registered?",
      "type": "checkbox"
    ]
  ],
  "message": "For your approval",
  "signer_roles": [
    [
      "name": "Client",
      "order": 0
    ],
    [
      "name": "Witness",
      "order": 1
    ]
  ],
  "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_embedded_draft")! 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()
```