---
title: "Edit document group"
url: "https://docs.signnow.com/docs/document-group/operations/patch-v2-document-groups-document_group_id"
type: "endpoint"
section: "document-group"
slug: "document-group/operations/patch-v2-document-groups-document_group_id"
method: "PATCH"
path: "/v2/document-groups/{document_group_id}"
operation_id: "patch-v2-document-groups-document_group_id"
authorization: "bearer"
---

# Edit document group

`PATCH /v2/document-groups/{document_group_id}`

This endpoint allows users to reorder documents and update the action performed upon document group completion.
> Document group should not have pending or fulfilled signature invites.


## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `document_group_id` | string | Yes | ID of the document group. |

## Request Body

**Schema**

```json
{
  "type": "object",
  "properties": {
    "order": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "List of document IDs in the group.\n"
    },
    "email_action_on_complete": {
      "type": "string",
      "example": "documents_and_attachments_only_to_recipients",
      "description": "Specifies the action to be taken upon invite completion. Allowed values: \n`documents_and_attachments`: Email documents and attachments to all parties.\n`documents_and_attachments_only_to_recipients`: Email documents and attachments only to recipients.\n`without_documents_and_attachments`: Do not email documents or any attachments."
    }
  },
  "x-examples": {
    "Example 1": {
      "order": [
        "ffa1e7109013c26d5a706d34a9d0ad598f95afff",
        "06d34a9d0ad598f95afa1ffa1e7109013c26d555"
      ],
      "email_action_on_complete": "documents_and_attachments_only_to_recipients"
    }
  }
}
```

**Example** (`Example 1`)

```json
{
  "order": [
    "ffa1e7109013c26d5a706d34a9d0ad598f95afff",
    "06d34a9d0ad598f95afa1ffa1e7109013c26d555"
  ],
  "email_action_on_complete": "documents_and_attachments_only_to_recipients"
}
```

## Responses

### 204

Success.

### 400

**Authorization errors**

**Validation errors:**
- `order` type is incorrect.
- Document ID is incorrect. Document IDs must follow the regex [a-z0-9] and be 40 characters long.
- Document IDs are not unique.
- `email_action_on_complete` value is incorrect.



**Example** (`Example 1`)

```json
{
  "code": 1537,
  "message": "invalid_token"
}
```

**Example** (`Authorization error`)

```json
{
  "code": 1537,
  "message": "invalid_token"
}
```

**Example** (`Document IDs not unique`)

```json
{
  "code": 46,
  "message": "The order array must include unique document ids."
}
```

**Example** (`Order type is incorrect`)

```json
{
  "code": 46,
  "message": "The order field must be an array"
}
```

**Example** (`Document ID is incorrect`)

```json
{
  "code": 46,
  "message": "The order array must include valid unique document ids"
}
```

**Example** (`email_action_on_complete is incorrect`)

```json
{
  "code": 13022001,
  "message": "The email_action_on_complete value you selected is not a valid choice."
}
```

### 404

Document group not found.


**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "message": "Document group `{uid}` not found"
    }
  ]
}
```

**Example** (`DG not found`)

```json
{
  "errors": [
    {
      "message": "Document group `{uid}` not found"
    }
  ]
}
```

### 422

- User is not the owner of the document group.
- Payload documents do not match the group.
- Document group has pending or fulfilled invites.


**Example** (`Example 1`)

```json
{
  "code": 65536,
  "message": "You has not such DocumentGroup"
}
```

**Example** (`User is not owner`)

```json
{
  "code": 65536,
  "message": "You do not have this DocumentGroup"
}
```

**Example** (`Pending or fulfilled invites`)

```json
{
  "code": 65594,
  "message": "DocumentGroup has incorrect status"
}
```

**Example** (`Documents do not match the group`)

```json
{
  "code": 65585,
  "message": "Documents in order are not equal to existing documents in the document group"
}
```

## Code Examples

> Replace `$SIGNNOW_ACCESS_TOKEN` and any `{placeholder}` values before running.

### cURL

```bash
curl -X PATCH \
  "https://api.signnow.com/v2/document-groups/{document_group_id}" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"order": ["ffa1e7109013c26d5a706d34a9d0ad598f95afff", "06d34a9d0ad598f95afa1ffa1e7109013c26d555"], "email_action_on_complete": "documents_and_attachments_only_to_recipients"}'
```

---
*Full reference: https://docs.signnow.com/docs/document-group/operations/patch-v2-document-groups-document_group_id*
