> 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 envelope

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

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

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

Reference: https://developers.docusign.com/docs/esign-rest-api/v2/reference/envelopes/envelopelocks/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.
- `envelopeId` (string, required) — The envelope's GUID. Eg 93be49ab-afa0-4adf-933c-f752070d71ec

### 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) — Sets the time, in seconds, until the lock expires when there is no activity on the envelope. If no value is entered, then the default value of 300 seconds is used. The maximum value is 1,800 seconds. The lock duration can be extended.
- `lockedByApp` (string, optional) — Specifies the friendly name of the application that is locking the envelope.
- `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"
}
```