> You are reading the Docusign Developer Documentation. For clean Markdown of any page, append .md to the page URL.
>
> Documentation indexes by section:
> - APIs and SDKs: https://docusign.docs.buildwithfern.com/docs/llms.txt
> - Platform 101: https://docusign.docs.buildwithfern.com/platform/llms.txt
> - Extension Apps: https://docusign.docs.buildwithfern.com/extension-apps/llms.txt
> - Docusign CLI: https://docusign.docs.buildwithfern.com/docusign-cli/llms.txt
>
> Authentication (OAuth, JWT Grant, M2M): https://docusign.docs.buildwithfern.com/platform/auth
> Webhooks and Connect: https://docusign.docs.buildwithfern.com/platform/webhooks
>
> OpenAPI specifications: https://docusign.docs.buildwithfern.com/openapi.json
> MCP server: https://docusign.docs.buildwithfern.com/_mcp/server

# Get URL for template edit view

POST https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/templates/{templateId}/views/edit
Content-Type: application/json

Returns a URL that enables you to embed the Template Edit view of Docusign eSignature. You can embed the view in an iframe.

**API request update**

The API request object for this API method was updated in June 2024. The new API request format is described below. Existing applications must update to the new version: it solves a security issue with the old version. The deprecation schedule was announced in the [Docusign Core Release Notes](https://support.docusign.com/s/document-item?language=en_US&bundleId=adp1720620778794_24-2-02-00-demo&topicId=wcz1616195757589.html&_LANG=enus). While backwards compatibility will be provided for a while for existing applications, all applications must be updated to be secure. See below for migration information.

**Best practices**

The returned URL expires after 10 minutes. Therefore, request the URL immediately before you redirect your user to it.

Due to screen space issues, do not use an iframe for embedded operations on mobile devices. For mobile applications, use a [WebView](https://developer.android.com/reference/android/webkit/WebView) (Android) or [WKWebView](https://developer.apple.com/documentation/webkit/wkwebview) (iOS).

### Closing the view's iframe

If you choose to embed the view in your application via an iframe, Docusign recommends this software pattern to close the iframe after the view has completed:

- (One time) create a standalone “return” web page that you will use as the `returnUrl` target for the view. The view will redirect the iframe to this URL when it has completed. Here's an [example return page](https://github.com/docusign/docusign.github.io/blob/master/jsfiddleDsResponse.html). In this page, use JavaScript and the [postMessage](https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) method to send a message to your application with the results of the view.
- In your application, use `window.addEventListener("message", function_name)` to register a listener for incoming messages.
- To show the view, use this API method, then set the iframe to load the URL from the API response.
- In your application, receive the completion message, validate it, and then close the iframe.

### Information security

This view only has write access to the specific template referenced in the API call. The edit access corresponds to the access rights of the user associated with the access token used for the API call.

**Recommendations:**

- Use the access token of a service user who can access the template.
- Do not use the access token of a user with administrator privileges.

### Migrating to the current version of the request object

This section only applies to existing applications that use the older version of the request object.

Migrating from the old API request object to the new version will take under a day of developer time.

**Step 1.** Does your application set the returnUrl attribute?

Yes: continue with step 2.

No: In this case, your users first edit the template, and then the Docusign eSignature home screen is shown. To accomplish this UI pattern with the new API request format:

- Set the returnUrl to a new endpoint for your application. You can use query parameters or session data to manage state. Remember to authenticate the incoming requests.
- When the endpoint is called, use the EnvelopeViews:createConsole API call to obtain and then display the Docusign eSignature home page to your application's user.

**Step 2.** Check that these API attributes are set:

- `"viewAccess" = "template"`
- the `returnUrl` is set.

**Step 3.** All done! Test your application.

Reference: https://developers.docusign.com/docs/esign-rest-api/reference/templates/templateviews/createedit

## Authentication

- `Authorization` header (required) (prefixed with ` Bearer  `) — OAuth 2.0 access token (JWT or auth-code grant). Sent as `Authorization: Bearer <token>` on every request except `GET /v2.1` and `GET /service_information`, which are public discovery endpoints.

## Servers

- `https://demo.docusign.net/restapi` (Demo, default)
- `https://www.docusign.net/restapi` (Production)

## Request

### Path parameters

- `accountId` (string, required) — The external account number (int) or account ID Guid.
- `templateId` (string, required) — The ID of the template.

### Body (application/json)

This endpoint expects a templateViewRequest.

- `returnUrl` (string, optional) — Identifies the return point after the user selects `Save And Close`. This property is required.
- `settings` (templateViewSettings, optional)
- `viewAccess` (string, optional) — Set to `template` to limit the app user's access to only the specified template. **Required.**

## Response

### 201

Successful response.

- `url` (string, optional) — URL for the template edit view.

## Errors

### 400 Bad Request Error

Error encountered.

- `errorCode` (string, optional) — The code associated with the error condition.
- `message` (string, optional) — A brief message describing the error condition.

## Types

### templateViewSettings

- `backButtonAction` (string, optional)
- `documentSettings` (envelopeViewDocumentSettings, optional)
- `envelopeCustomFieldSettings` (envelopeViewEnvelopeCustomFieldSettings, optional)
- `lockToken` (string, optional)
- `recipientSettings` (templateViewRecipientSettings, optional)
- `showAdvancedOptions` (string, optional)
- `showBackButton` (string, optional)
- `showDiscardAction` (string, optional)
- `showHeaderActions` (string, optional)
- `startingScreen` (string, optional)
- `taggerSettings` (envelopeViewTaggerSettings, optional)

### envelopeViewDocumentSettings

- `showEditDocuments` (string, optional) — When `false,` prevents the app user from adding, replacing, or deleting documents. The default value is `true`. **Note:** An existing document in the envelope can also be deleted by deleting all of the document’s pages via the document’s thumbnail images. To prohibit this, see the `ShowEditPages` attribute.
- `showEditDocumentVisibility` (string, optional) — When `false`, prevents the user from modifying document visibility settings. The default value is `true`.
- `showEditPages` (string, optional) — When `false`, prevents the user from deleting or rotating individual document pages via the document’s thumbnail images. The default value is `true`.
- `showSaveAsDocumentCustomField` (string, optional) — Reserved for Docusign.

### envelopeViewEnvelopeCustomFieldSettings

- `showEnvelopeCustomFields` (string, optional) — Reserved for Docusign.

### templateViewRecipientSettings

- `showContactsList` (string, optional)
- `showEditMessage` (string, optional)
- `showEditRecipients` (string, optional)

### envelopeViewTaggerSettings

- `paletteDefault` (string, optional) — When `paletteSections` is set to `custom`, this property selects the default tagger palette. Valid values: - `custom` - `merge` - `notary` - `seals` - `smartContracts` - `annotations` - `smartSections`
- `paletteSections` (string, optional) — Valid values: - `default` (default): The default tagger palette UX - `none`: No tagger palette - `custom`: Set by `paletteDefault`
- `paletteSettings` (paletteSettings, optional) — Reserved for Docusign.

### paletteSettings

Reserved for Docusign.

- `annotations` (paletteItemSettings, optional)
- `custom` (paletteItemSettings, optional)
- `merge` (paletteItemSettings, optional)
- `notary` (paletteItemSettings, optional)
- `seals` (paletteItemSettings, optional)
- `smartContracts` (paletteItemSettings, optional)
- `smartSections` (paletteItemSettings, optional)

### paletteItemSettings

- `show` (string, optional) — Reserved for Docusign.

## Examples

**Request**

```json
{
  "returnUrl": "sample string 1",
  "settings": {
    "backButtonAction": "sample string 1",
    "documentSettings": {
      "showEditDocuments": "sample string 1",
      "showEditDocumentVisibility": "sample string 2",
      "showEditPages": "sample string 3",
      "showSaveAsDocumentCustomField": "sample string 4"
    },
    "envelopeCustomFieldSettings": {
      "showEnvelopeCustomFields": "sample string 1"
    },
    "lockToken": "sample string 2",
    "recipientSettings": {
      "showContactsList": "sample string 1",
      "showEditMessage": "sample string 2",
      "showEditRecipients": "sample string 3"
    },
    "showAdvancedOptions": "sample string 3",
    "showBackButton": "sample string 4",
    "showDiscardAction": "sample string 5",
    "showHeaderActions": "sample string 6",
    "startingScreen": "sample string 7",
    "taggerSettings": {
      "paletteDefault": "sample string 1",
      "paletteSections": "sample string 2"
    }
  },
  "viewAccess": "sample string 2"
}
```

**Response**

```json
{
  "url": "sample string 1"
}
```