# Update envelope

`PATCH /v1/accounts/{accountId}/envelopes/{envelopeId}`

Rename the envelope, change its message or put its documents in a new order; send only what changes. Nothing is sent to anyone: the reads and every notice sent from then on (a reminder, a cancel, a document added) use the new name, message and order. The message is also each document's assignment `message`. Works on a closed envelope too. A refused request changes nothing; `errors` names every field at fault.

**Authentication:** Bearer access token (`Authorization: Bearer ...`) or API key (`X-Api-Key` header).

## Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `accountId` | path | string | yes | Workspace account ID. |
| `envelopeId` | path | string | yes | The envelope ID. |

## Request Body (required)

Fields (`application/json`):

- `name` (string) — What the invitation calls what is being signed. `<` is refused (`400`).
- `message` (Array) — The message sent to every signer from now on; null for none.
- `document_ids` (array) — Every document of the envelope, each once, in the new order; `position` follows it. An envelope listing no document takes no order.

Example:

```json
{
    "name": "Contrato de prestação de serviços",
    "message": "Segue o contrato e seus anexos.",
    "document_ids": [
        "615601fab04c0a3147bb1246",
        "615601fab04c0a3147bb1247"
    ]
}
```

## Responses

### 200 — The envelope as changed

```json
{
    "data": {
        "resource": "envelope",
        "id": "1a2f3c4d5e6f708192a3b4c5d6e",
        "name": "Contrato de prestação de serviços",
        "message": "Segue o contrato e seus anexos.",
        "documents": [
            {
                "id": "615601fab04c0a3147bb1246",
                "position": 1,
                "name": "contrato.pdf",
                "status": "pending_signature",
                "artifacts": {
                    "original": "https://api.assinafy.com.br/v1/documents/615601fab04c0a3147bb1246/download/original",
                    "thumbnail": "https://api.assinafy.com.br/v1/documents/615601fab04c0a3147bb1246/thumbnail"
                },
                "signers": [
                    {
                        "id": "fa8c140cb49b79f940aab95fddd",
                        "full_name": "Ana Souza",
                        "email": "ana@example.com",
                        "whatsapp_phone_number": "+5548999990001",
                        "completed": false,
                        "signed_at": "2026-11-06T14:30:00Z"
                    }
                ]
            }
        ],
        "counts": {
            "certificated": 1,
            "pending_signature": 2
        },
        "signing_urls": [
            {
                "signer_id": "string",
                "url": "https://api.assinafy.com.br/v1/sign/doc1?email=joe@example.com",
                "embedded": false
            }
        ],
        "created_at": "2026-11-04T12:00:00Z"
    },
    "status": 200,
    "message": ""
}
```

### 400 — Refused as sent; nothing changed. Each field at fault is an entry of `errors`: `name` (empty, not text, over 255 characters, or holding `<`), `message` (not text), `document_ids` (empty, or not a list of every document of the envelope, each once).

```json
{
    "status": 400,
    "message": "List each of the envelope's documents once, in their new order.",
    "errors": [
        {
            "field": "document_ids",
            "code": "Invalid",
            "message": "List each of the envelope's documents once, in their new order."
        }
    ]
}
```

### 403 — An OAuth app's token lacks `documents:write` (`InsufficientScope`). Also a member deactivated in the workspace, a workspace scheduled for deletion, or an OAuth token of another workspace.

```json
{
    "status": 400,
    "code": "PlanRestricted",
    "message": "Bad request.",
    "data": null,
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 404 — The requested resource does not exist.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 401 — Missing or invalid credentials.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```

### 500 — Unexpected server error.

```json
{
    "status": 400,
    "message": "Bad request.",
    "data": null,
    "code": "PlanRestricted",
    "errors": [
        {
            "field": "full_name",
            "code": "Required",
            "message": "Full Name cannot be blank."
        }
    ]
}
```
