> 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

# Lock template

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

Locks the specified template, and sets the time until the lock expires, to prevent other users or recipients from accessing and changing the template.

###### Note: Users must have envelope locking capability enabled to use this function (the userSetting property `canLockEnvelopes` must be set to **true** for the user).

Reference: https://developers.docusign.com/docs/esign-rest-api/v2/reference/templates/templatelocks/create

## Authentication

- `Authorization` header (required) — OAuth 2.0 access token (JWT or auth-code grant). Sent as Authorization: Bearer \<token>.

## 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 being accessed.

### Body (application/json)

This endpoint expects a lockRequest.

- `lockDurationInSeconds` (string, optional) — The number of seconds to lock the envelope for editing. Must be greater than 0 seconds.
- `lockedByApp` (string, optional) — A friendly name of the application used to lock the envelope. Will be used in error messages to the user when lock conflicts occur.
- `lockType` (string, optional) — The type of envelope lock. Currently "edit" is the only supported type.
- `templatePassword` (string, optional)
- `useScratchPad` (string, optional) — Reserved for future use. Indicates whether a scratchpad is used for editing information.

## Response

### 201

Successful response.

- `errorDetails` (errorDetails, optional) — This object describes errors that occur. It is only valid for responses, and ignored in requests.
- `lockDurationInSeconds` (string, optional) — The number of seconds to lock the envelope for editing. Must be greater than 0 seconds.
- `lockedByApp` (string, optional) — A friendly name of the application used to lock the envelope. Will be used in error messages to the user when lock conflicts occur.
- `lockedByUser` (userInfo, optional)
- `lockedUntilDateTime` (string, optional) — The datetime until the envelope lock expires.
- `lockToken` (string, optional) — A unique identifier provided to the owner of the envelope lock. Used to prove ownership of the lock.
- `lockType` (string, optional) — The type of envelope lock. Currently "edit" is the only supported type.
- `useScratchPad` (string, optional) — Reserved for future use. Indicates whether a scratchpad is used for editing information.

## Errors

### 400 Bad Request Error

Error encountered.

- `errorCode` (string, optional) — An error code associated with the error.
- `message` (string, optional) — A short error message.

## Types

### errorDetails

This object describes errors that occur. It is only valid for responses, and ignored in requests.

- `errorCode` (string, optional) — An error code associated with the error.
- `message` (string, optional) — A short error message.

### userInfo

- `activationAccessCode` (string, optional)
- `email` (string, optional)
- `errorDetails` (errorDetails, optional) — This object describes errors that occur. It is only valid for responses, and ignored in requests.
- `loginStatus` (string, optional)
- `sendActivationEmail` (string, optional)
- `uri` (string, optional)
- `userId` (string, optional) — The user ID of the user being accessed. Generally this is the user ID of the authenticated user, but if the authenticated user is an Admin on the account, this may be another user the Admin user is accessing. **Note**: For the [GET /v2/accounts/\{accountId}/envelopes](https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/listStatusChanges/#envelopesInformation) method, the `user_id` query parameter is not implemented and should not be used.
- `userName` (string, optional)
- `userStatus` (string, optional) — Status of the user's account. One of: * ActivationRequired * ActivationSent * Active * Closed * Disabled
- `userType` (string, optional)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "errorDetails": {
    "errorCode": "string",
    "message": "string"
  },
  "lockDurationInSeconds": "string",
  "lockedByApp": "string",
  "lockedByUser": {
    "activationAccessCode": "string",
    "email": "string",
    "errorDetails": {
      "errorCode": "string",
      "message": "string"
    },
    "loginStatus": "string",
    "sendActivationEmail": "string",
    "uri": "string",
    "userId": "string",
    "userName": "string",
    "userStatus": "string",
    "userType": "string"
  },
  "lockedUntilDateTime": "string",
  "lockToken": "string",
  "lockType": "string",
  "useScratchPad": "string"
}
```