---
title: "Locks an envelope."
method: POST
path: "/v2.1/accounts/{accountId}/envelopes/{envelopeId}/lock"
tags: ["EnvelopeLocks"]
---

# Locks an envelope.

`POST /v2.1/accounts/{accountId}/envelopes/{envelopeId}/lock`

This method locks the specified envelope and sets the time until
the lock expires to prevent other users or recipients from
changing the envelope.

The response to this request includes a `lockToken` parameter
that you must use in the `X-DocuSign-Edit` header for
every PUT method (typically a method that updates an envelope)
while the envelope is locked.


If you do not provide the `lockToken` when accessing
a locked envelope, you will get the following
error:

```
{
   "errorCode": "EDIT_LOCK_NOT_LOCK_OWNER",
   "message": "The user is not the owner of the lock. The template is locked by another user or in another application"
}
```


### The X-DocuSign-Edit header

The `X-DocuSign-Edit` header looks like this
and can be specified in either JSON or XML.

**JSON**
```
{
  "LockToken": "token-from-response",
  "LockDurationInSeconds": "600"
}
```

**XML**
```
<DocuSignEdit>
  <LockToken>token-from-response</LockToken>
  <LockDurationInSeconds>600</LockDurationInSeconds>
</DocuSignEdit>
```

In the actual HTTP header, you would remove the linebreaks:

```
X-DocuSign-Edit: {"LockToken": "token-from-response", "LockDurationInSeconds": "600" }
    or
X-DocuSign-Edit:<DocuSignEdit><LockToken>token-from-response</LockToken><LockDurationInSeconds>600</LockDurationInSeconds></DocuSignEdit>
```


### Related topics

- [Common API Tasks: Locking and unlocking envelopes](https://www.docusign.com/blog/dsdev-common-api-tasks-locking-and-unlocking-envelopes)

## Path parameters

- `accountId` string, required
- `envelopeId` string, required

## Request body

- LockRequest — This request object contains information about the lock that you want to create or update.
  - `lockDurationInSeconds` string — The number of seconds to lock the envelope for editing. Must be greater than 0 seconds.
  - `lockedByApp` string — 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 — The type of lock. Currently `edit` is the only supported type.
  - `templatePassword` string — The [password for the template](https://support.docusign.com/s/document-item?bundleId=xry1643227563338&topicId=xwo1578456395432.html). If you are using a lock for a template that has a password or an envelope that is based on a template that has a password, you must enter the `templatePassword` to save the changes.
  - `useScratchPad` string — When **true,** a scratchpad is used to edit information.

## Response `201`

Successful response.

## Other responses

- `400` — Error encountered.

---

[API](https://skmtc.net/docusign/apis/docusign-esignature-rest-api.md) · [All operations](https://skmtc.net/docusign/apis/docusign-esignature-rest-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/docusign/docusign-esignature-rest-api/revisions/77f1998c313d/schema)
