---
title: "Edit document"
url: "https://docs.signnow.com/docs/document/operations/edit-document"
type: "endpoint"
section: "document"
slug: "document/operations/edit-document"
method: "PUT"
path: "/document/{document_id}"
operation_id: "edit-document"
authorization: "bearer"
---

# Edit document

`PUT /document/{document_id}`

This endpoint allows users to edit a document by adding or overwriting fields. Users can also add their signatures, text, and checkmarks to the document.

**Fields** are rectangular spaces in the document designated for signing and editing (filling in) by the recipient. 

You can add the following fields to a document:
- Regular fields (`text`, `signature`, `initials`, `stamp`, `checkbox`, `attachment`, `hyperlink` (available upon request), `radiobutton`, `enumeration` (dropdown menu).
- Fields completed by you: texts (text fields), signatures (signatures, initials, and stamps), checks (checkmarks), lines. 
- [Payment request fields](/docs/request-payments/operations/put-document-document_id)
- Conditional fields
- Formulas (calculated fields)
- [Smart fields](/docs/smart-fields/operations/add-smart-fields-to-template-integraion-objects)

Every field is an object that contains field properties: `type`, assigned `role`,  `x`/`y` coordinates in the document, field `width` and `height`, `label`, `name`, etc. Field properties vary depending on the field `type`.

Learn more about [fields](/docs/fields).

For more information, check out our video tutorial.

<details open>

**<summary>Video tutorial</summary>**

<sub><sup>Note: The design shown in the video is outdated, but the flow is still accurate. You can go ahead and follow the steps as demonstrated.</sup></sub>

[Video tutorial](https://www.youtube.com/watch?v=6IZqgFgQv3U)

</details>

## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `document_id` | string | Yes | Document ID. |

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "fields"
  ],
  "properties": {
    "lines": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "page_number",
          "subtype",
          "x",
          "y",
          "height",
          "width",
          "control_points",
          "fill_color",
          "line_width"
        ],
        "properties": {
          "x": {
            "type": "number",
            "example": 20,
            "description": "A horizontal position of the line's bounding box in pixels."
          },
          "y": {
            "type": "number",
            "example": 20,
            "description": "A vertical position of the line's bounding box in pixels."
          },
          "width": {
            "type": "number",
            "example": 20,
            "description": "Width of the line's bounding box in pixels."
          },
          "height": {
            "type": "number",
            "example": 20,
            "description": "Height of the line's bounding box in pixels."
          },
          "subtype": {
            "enum": [
              "line"
            ],
            "type": "string",
            "example": "line",
            "description": "Element subtype. Must be `line`."
          },
          "fill_color": {
            "type": "string",
            "example": "E15554",
            "description": "Line color as a hex color code (without the `#` prefix)."
          },
          "line_width": {
            "type": "number",
            "example": 2,
            "description": "Line stroke width in pixels."
          },
          "page_number": {
            "type": "number",
            "example": 0,
            "description": "The page number where the line will be placed. Page numbering starts at 0 (corresponding to page 1)."
          },
          "control_points": {
            "type": "array",
            "items": {
              "type": "number"
            },
            "example": [
              265,
              59,
              556,
              57
            ],
            "maxItems": 4,
            "minItems": 4,
            "description": "An array of four numbers defining the start and end points of the line: `[x1, y1, x2, y2]`."
          }
        }
      },
      "description": "A list of line elements to add to the document."
    },
    "texts": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "data",
          "x",
          "y",
          "page_number",
          "font",
          "size"
        ],
        "properties": {
          "x": {
            "type": "number",
            "description": "A horizontal position of the field in pixels."
          },
          "y": {
            "type": "number",
            "description": "A vertical position of the field in pixels."
          },
          "data": {
            "type": "string",
            "description": "Content of the field."
          },
          "font": {
            "type": "string",
            "example": "Arial",
            "description": "The text font. Possible values: `Arial`, `Times New Roman`, `Courier New`, `Tahoma`, `Comic Sans MS`."
          },
          "size": {
            "type": "number",
            "example": 12,
            "description": "The text size."
          },
          "page_number": {
            "type": "number",
            "description": "The page number where the field will be placed. Page numbering starts at 0 (corresponding to page 1)."
          }
        }
      },
      "description": "A list of completed text fields to add to the document."
    },
    "checks": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "x",
          "y",
          "width",
          "height",
          "page_number"
        ],
        "properties": {
          "x": {
            "type": "number",
            "description": "A horizontal position of the field in pixels."
          },
          "y": {
            "type": "number",
            "description": "A vertical position of the field in pixels."
          },
          "width": {
            "type": "number",
            "description": "Field width in pixels."
          },
          "height": {
            "type": "number",
            "description": "Field height in pixels."
          },
          "page_number": {
            "type": "number",
            "description": "The page number where the field will be placed. Page numbering starts at 0 (corresponding to page 1)."
          }
        }
      },
      "description": "A list of checkmarks to add to the document."
    },
    "fields": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "x",
          "y",
          "width",
          "height",
          "type",
          "page_number",
          "required",
          "role"
        ],
        "properties": {
          "x": {
            "type": "number",
            "example": 217,
            "description": "A horizontal position of the field in pixels."
          },
          "y": {
            "type": "number",
            "example": 32,
            "description": "A vertical position of the field in pixels."
          },
          "name": {
            "type": "string",
            "example": "first_name",
            "description": "A unique field name."
          },
          "role": {
            "type": "string",
            "example": "Recipient 1",
            "description": "Recipient role assigned to the field."
          },
          "type": {
            "type": "string",
            "example": "text",
            "description": "Field type. Possible values: `text`, `signature`, `initials`, `stamp`, `checkbox`, `attachment`, `hyperlink`, `radiobutton`, `enumeration`."
          },
          "align": {
            "type": "string",
            "example": "left",
            "description": "Horizontal alignment. Possible values: `left`, `center`, `right`."
          },
          "label": {
            "type": "string",
            "example": "First name",
            "description": "A hint for a recipient added to the field. When a recipient has filled out a labeled `text` field, all other `text` fields with the same `label` will be automatically filled out with the same data when the recipient clicks on that `text` field."
          },
          "radio": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "x",
                "y",
                "width",
                "height",
                "page_number",
                "value"
              ],
              "properties": {
                "x": {
                  "type": "number",
                  "example": 389,
                  "description": "A horizontal position of the field in pixels."
                },
                "y": {
                  "type": "number",
                  "example": 141,
                  "description": "A vertical position of the field in pixels."
                },
                "value": {
                  "type": "string",
                  "example": "Yes",
                  "description": "Field value."
                },
                "width": {
                  "type": "number",
                  "example": 23,
                  "description": "Field width in pixels."
                },
                "height": {
                  "type": "number",
                  "example": 23,
                  "description": "Field height in pixels."
                },
                "page_number": {
                  "type": "number",
                  "example": 0,
                  "description": "The page number where the field will be placed. Page numbering starts at 0 (corresponding to page 1)."
                }
              }
            },
            "description": "An array of radio buttons."
          },
          "value": {
            "type": "string",
            "example": "Option 1",
            "description": "Value set to the `checkbox` field."
          },
          "width": {
            "type": "number",
            "example": 50,
            "description": "Field width in pixels."
          },
          "height": {
            "type": "number",
            "example": 20,
            "description": "Field height in pixels."
          },
          "required": {
            "type": "boolean",
            "description": "Whether the field is required or optional. Possible values: `true`, `false`.\n\n**Note:** When `checkbox_groups` is present in the request, all `checkbox` fields must have `required` set to `false`."
          },
          "page_number": {
            "type": "number",
            "example": 0,
            "description": "The page number where the field will be placed. Page numbering starts at 0 (corresponding to page 1)."
          },
          "stretch_mode": {
            "type": "string",
            "example": "horizontal",
            "description": "Defines how the field is stretched if it's overflowed. Possible values: `fixed`, `horizontal`, `vertical`, `auto`."
          },
          "validator_id": {
            "type": "string",
            "example": "7ef095fd94ce63b670b52b2e83457d59ac796a39",
            "description": "A string that adds format validation. Learn more about [data validators](/docs/fields#data-validators)."
          },
          "allowed_types": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "List of allowed `signature` types. Possible values: `type` (user types the signature), `draw` (user draws the signature), `upload` (user uploads an image with the signature). By default, all types are allowed. For `initials`, only `type` and `draw` are possible."
          },
          "prefilled_text": {
            "type": "string",
            "example": "ACME",
            "description": "The text in the specified format shown in the field when the signer opens the document. For `checkbox`, any non-empty value will mark it as checked. For `radiobutton`, a value that should be checked."
          },
          "lock_to_sign_date": {
            "type": "boolean",
            "default": false,
            "description": "Defines whether the date field is automatically pre-filled with the completion date and/or time. `false`: the date field is not pre-filled with the completion date; `true`: the date field is automatically pre-filled. Available for `validator_id`: `13435fa6c2a17f83177fcbb5c4a9376ce85befeb`, `059b068ef8ee5cc27e09ba79af58f9e805b7c2b3`, `09d3bb6a5eb6598edb7bfad02b0143d8c68ad788`, `0f4827a308018f98b11ae3923104685ff0c03070`, `06448a0d0eb6a71c7c116ec4754bcb04ebf11da5`"
          },
          "enumeration_options": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "An array of strings with the dropdown options."
          },
          "lock_to_sign_prefill": {
            "type": "boolean",
            "default": false,
            "description": "Whether to lock the pre-filled text for editing. If set to `true`, the pre-filled data will be locked and the signer will not be able to edit it. If set to `false`, the pre-filled data will be editable by the signer. Default value is `false`. Applies to text fields and requires a non-empty `prefilled_text` parameter."
          },
          "custom_defined_option": {
            "type": "boolean",
            "description": "Used with `enumeration` type. If `true`, a recipient can add their own values to the dropdown. If `false`, a recipient can only choose from the predefined list."
          }
        }
      },
      "minItems": 1,
      "description": "Array of field objects to add to the document.",
      "uniqueItems": true
    },
    "signatures": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "data",
          "x",
          "y",
          "width",
          "height",
          "page_number"
        ],
        "properties": {
          "x": {
            "type": "number",
            "description": "A horizontal position of the field in pixels."
          },
          "y": {
            "type": "number",
            "description": "A vertical position of the field in pixels."
          },
          "data": {
            "type": "string",
            "description": "Data attribute of a signature, initials, or stamp. Find the signature, initials, or stamp `data` by sending a [`GET /document`](/docs/document/operations/get-document) request for a document signed by you. The `data` is a long string stored in the `signatures.data` field in the response."
          },
          "width": {
            "type": "number",
            "description": "Field width in pixels."
          },
          "height": {
            "type": "number",
            "description": "Field height in pixels."
          },
          "page_number": {
            "type": "string",
            "description": "The page number where the field will be placed. Page numbering starts at 0 (corresponding to page 1)."
          }
        }
      },
      "description": "A list of signatures, initials, and stamps to add to the document."
    },
    "document_name": {
      "type": "string",
      "example": "New document name",
      "description": "Name of the document."
    },
    "checkbox_groups": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "name",
          "checkbox_names",
          "validation_type",
          "validation_amount"
        ],
        "properties": {
          "name": {
            "type": "string",
            "example": "payment_options",
            "description": "A unique checkbox group name within the document."
          },
          "checkbox_names": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "option_credit",
              "option_debit",
              "option_paypal"
            ],
            "minItems": 1,
            "description": "Array of `name` values of the `checkbox` fields to include in the group. Must contain at least one item."
          },
          "validation_type": {
            "enum": [
              "at_least",
              "at_most",
              "exactly",
              "none"
            ],
            "type": "string",
            "example": "at_least",
            "description": "Validation rule applied to the group. Possible values:\n- `at_least` \u2014 the signer must check at least `validation_amount` checkboxes. \n- `at_most` \u2014 the signer must check no more than `validation_amount` checkboxes. \n- `exactly` \u2014 the signer must check exactly `validation_amount` checkboxes.\n- `none` \u2014 no validation is applied; `validation_amount` must be `null`."
          },
          "validation_amount": {
            "type": [
              "integer",
              "null"
            ],
            "example": 1,
            "description": "The number of checkboxes that must be checked (an integer between 1 and the total number of checkboxes in the group). Must be `null` when `validation_type` is `none`."
          }
        }
      },
      "description": "A list of checkbox groups. Each group applies validation rules to a set of existing `checkbox` fields in the document.\n\n**Prerequisites:** All checkbox fields referenced in `checkbox_groups` must be defined in the `fields` array of the same request. When `checkbox_groups` is present, every `checkbox` field in the request must belong to exactly one group, and all checkboxes in a group must have `required` set to `false`.\n\n**Example:** To group checkboxes for a payment method selection, first define the checkbox fields in `fields`:\n```json\n\"fields\": [\n  {\n    \"type\": \"checkbox\",\n    \"role\": \"Signer 1\",\n    \"name\": \"option_credit\",\n    \"value\": \"Credit Card\",\n    \"required\": false,\n    \"x\": 100,\n    \"y\": 200,\n    \"width\": 20,\n    \"height\": 20,\n    \"page_number\": 0\n  },\n  {\n    \"type\": \"checkbox\",\n    \"role\": \"Signer 1\",\n    \"name\": \"option_debit\",\n    \"value\": \"Debit Card\",\n    \"required\": false,\n    \"x\": 100,\n    \"y\": 230,\n    \"width\": 20,\n    \"height\": 20,\n    \"page_number\": 0\n  },\n  {\n    \"type\": \"checkbox\",\n    \"role\": \"Signer 1\",\n    \"name\": \"option_paypal\",\n    \"value\": \"PayPal\",\n    \"required\": false,\n    \"x\": 100,\n    \"y\": 260,\n    \"width\": 20,\n    \"height\": 20,\n    \"page_number\": 0\n  }\n]\n```\nThen reference them in `checkbox_groups`:\n```json\n\"checkbox_groups\": [\n  {\n    \"name\": \"payment_options\",\n    \"checkbox_names\": [\"option_credit\", \"option_debit\", \"option_paypal\"],\n    \"validation_type\": \"at_least\",\n    \"validation_amount\": 1\n  }\n]\n```"
    },
    "client_timestamp": {
      "type": "string",
      "minLength": 1,
      "description": "Local time of a user."
    }
  }
}
```

**Example** (`Request example`)

```json
{
  "lines": [
    {
      "x": 20,
      "y": 20,
      "width": 20,
      "height": 20,
      "subtype": "line",
      "fill_color": "E15554",
      "line_width": 2,
      "page_number": 0,
      "control_points": [
        265,
        59,
        556,
        57
      ]
    }
  ],
  "texts": [
    {
      "x": 450,
      "y": 750,
      "data": "Anna Green",
      "font": "Arial",
      "size": 25,
      "page_number": 0
    }
  ],
  "checks": [
    {
      "x": 754,
      "y": 417,
      "width": 17,
      "height": 17,
      "page_number": 0
    }
  ],
  "fields": [
    {
      "x": 217,
      "y": 32,
      "role": "Recipient 1",
      "type": "text",
      "align": "center",
      "label": "First name",
      "width": 50,
      "height": 20,
      "required": true,
      "page_number": 0,
      "stretch_mode": "horizontal",
      "prefilled_text": "First name",
      "lock_to_sign_prefill": true
    },
    {
      "x": 217,
      "y": 32,
      "role": "Recipient 1",
      "type": "signature",
      "width": 50,
      "height": 20,
      "required": true,
      "page_number": 0,
      "allowed_types": [
        "draw"
      ]
    },
    {
      "x": 217,
      "y": 32,
      "role": "Recipient 1",
      "type": "text",
      "label": "Date",
      "width": 50,
      "height": 20,
      "required": true,
      "page_number": 0,
      "validator_id": "059b068ef8ee5cc27e09ba79af58f9e805b7c2b3",
      "lock_to_sign_date": false
    },
    {
      "x": 100,
      "y": 200,
      "name": "option_credit",
      "role": "Signer 1",
      "type": "checkbox",
      "value": "Credit Card",
      "width": 20,
      "height": 20,
      "required": false,
      "page_number": 0
    },
    {
      "x": 100,
      "y": 230,
      "name": "option_debit",
      "role": "Signer 1",
      "type": "checkbox",
      "value": "Debit Card",
      "width": 20,
      "height": 20,
      "required": false,
      "page_number": 0
    },
    {
      "x": 100,
      "y": 260,
      "name": "option_paypal",
      "role": "Signer 1",
      "type": "checkbox",
      "value": "PayPal",
      "width": 20,
      "height": 20,
      "required": false,
      "page_number": 0
    },
    {
      "x": 217,
      "y": 32,
      "name": "photo",
      "role": "Recipient 1",
      "type": "attachment",
      "label": "Your photo",
      "width": 15,
      "height": 15,
      "required": true,
      "page_number": 0
    },
    {
      "x": 389,
      "y": 141,
      "name": "US residency",
      "role": "Recipient 1",
      "type": "radiobutton",
      "radio": [
        {
          "x": 389,
          "y": 141,
          "value": "Yes",
          "width": 23,
          "height": 23,
          "page_number": 0
        },
        {
          "x": 389,
          "y": 170,
          "value": "No",
          "width": 23,
          "height": 23,
          "page_number": 0
        }
      ],
      "width": 23,
      "height": 23,
      "required": true,
      "page_number": 0,
      "prefilled_text": "Yes"
    },
    {
      "x": 100,
      "y": 32,
      "name": "Department",
      "role": "Recipient 1",
      "type": "enumeration",
      "label": "Your department",
      "width": 70,
      "height": 40,
      "required": true,
      "page_number": 0,
      "enumeration_options": [
        "HR",
        "IT",
        "Finance"
      ],
      "custom_defined_option": true
    }
  ],
  "signatures": [
    {
      "x": 88,
      "y": 15,
      "data": "iVRFWHRkYAAAABJRU5ErkJggg==",
      "size": 11,
      "width": 122,
      "height": 34,
      "subtype": "signature",
      "line_height": 12,
      "page_number": 0,
      "client_timestamp": 1566237855,
      "prefill_content_type": "email"
    }
  ],
  "document_name": "New document name",
  "checkbox_groups": [
    {
      "name": "payment_options",
      "checkbox_names": [
        "option_credit",
        "option_debit",
        "option_paypal"
      ],
      "validation_type": "at_least",
      "validation_amount": 1
    }
  ],
  "client_timestamp": "timestamp"
}
```

## Responses

### 200

Returns ID of the updated document in case of a successful response.

**Example** (`Example 1`)

```json
{
  "id": "3dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
```

**Example** (`example-1`)

```json
{
  "id": "3dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
```

### 400

Bad Request

- Required parameter is missing.
- The document was sent for signature.
- The invite is not in pending status.
- Consent to sign electronically is required.
- The user has no access to the document.
- The signature invite has expired.
- Fields or elements do not exist in the document.
- The field is assigned to another role.
- The field was not found.
- The field has already been completed.
- The `lock_to_sign_prefill` type is incorrect.
- The `prefilled_text` is empty.

**Checkbox group validation errors**
- Checkbox group names are not unique within the document.
- A checkbox group references a non-existent checkbox field.
- A checkbox belongs to more than one group.
- The validation amount is invalid for the specified validation type.
- Checkboxes in a group belong to different roles.
- Checkboxes in a group with validation rules have `required` set to `true`.
- Not all checkbox fields are assigned to a group.
- The checkbox group name is missing or not a string.
- The checkbox names are not provided as an array.
- The validation type is missing or incorrect.
- The checkbox group does not reference at least one checkbox field.
- The number of checked checkboxes in a group is less than required.
- The number of checked checkboxes in a group exceeds the allowed maximum.
- The number of checked checkboxes in a group does not match the required exact amount.

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Invite should be pending"
    }
  ]
}
```

**Example** (`Invite expired`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Invite has expired"
    }
  ]
}
```

**Example** (`Field completed`)

```json
{
  "errors": [
    {
      "code": 65583,
      "message": "Field request already fulfilled"
    }
  ]
}
```

**Example** (`Field not found`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Unique ids: {{ array with ids }} not found!"
    }
  ]
}
```

**Example** (`Fields not exist`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Cannot remove nonexistent element."
    }
  ]
}
```

**Example** (`Consent is missing`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Please give consent to sign electronically before signing"
    }
  ]
}
```

**Example** (`Not pending invite`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Invite should be pending"
    }
  ]
}
```

**Example** (`No access to document`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Access denied to sign this document"
    }
  ]
}
```

**Example** (`prefilled_text is empty`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Empty prefilled text for lock to sign prefill."
    }
  ]
}
```

**Example** (`Incorrect validation type`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Invalid validation type specified for checkbox group"
    }
  ]
}
```

**Example** (`Required parameter missing`)

```json
{
  "errors": [
    {
      "code": 69632,
      "message": "Height must not be empty"
    }
  ]
}
```

**Example** (`Document sent for signature`)

```json
{
  "errors": [
    {
      "code": 65595,
      "message": "Cannot edit fields on this document. This document has already been sent for signing."
    }
  ]
}
```

**Example** (`Incorrect validation amount`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Invalid validation amount for the specified validation type"
    }
  ]
}
```

**Example** (`Validation type is required`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Validation type is required"
    }
  ]
}
```

**Example** (`Too many checkboxes in group`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group \"test_group\" requires between 1 and 2 checkbox(es) to be checked, but 3 provided."
    }
  ]
}
```

**Example** (`Checkbox not assigned to group`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "All checkbox fields must belong to a checkbox group"
    }
  ]
}
```

**Example** (`Field assigned to another role`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Bad field invite"
    }
  ]
}
```

**Example** (`Not enough checkboxes in group`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group \"test_group\" requires at least 2 checkbox(es) to be checked, but only 1 provided."
    }
  ]
}
```

**Example** (`Checkbox group name is required`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group name is required"
    }
  ]
}
```

**Example** (`Checkbox group names not unique`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group names must be unique within the document"
    }
  ]
}
```

**Example** (`Checkbox names must be an array`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox names must be an array"
    }
  ]
}
```

**Example** (`Not exactly checkboxes in group`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group \"test_group\" requires exactly 2 checkbox(es) to be checked, but 3 provided."
    }
  ]
}
```

**Example** (`Checkboxes in group are required`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "All checkboxes in a group with validation rules must not be required"
    }
  ]
}
```

**Example** (`Checkbox belongs to multiple groups`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "A checkbox can only belong to one group"
    }
  ]
}
```

**Example** (`lock_to_sign_prefill incorrect type`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "lock_to_sign_prefill value should be of type bool."
    }
  ]
}
```

**Example** (`Checkbox group name must be a string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group name must be a string"
    }
  ]
}
```

**Example** (`Checkboxes in group have different roles`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "All checkboxes in a group must belong to the same role"
    }
  ]
}
```

**Example** (`Checkbox group references non-existent field`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group references a non-existent checkbox field name"
    }
  ]
}
```

**Example** (`Checkbox group must reference at least one field`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Checkbox group must reference at least one checkbox field name"
    }
  ]
}
```

## Code Examples

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

### cURL

```bash
curl -X PUT \
  "https://api.signnow.com/document/{document_id}" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"lines": [{"x": 20, "y": 20, "width": 20, "height": 20, "subtype": "line", "fill_color": "E15554", "line_width": 2, "page_number": 0, "control_points": [265, 59, 556, 57]}], "texts": [{"x": 450, "y": 750, "data": "Anna Green", "font": "Arial", "size": 25, "page_number": 0}], "checks": [{"x": 754, "y": 417, "width": 17, "height": 17, "page_number": 0}], "fields": [{"x": 217, "y": 32, "role": "Recipient 1", "type": "text", "align": "center", "label": "First name", "width": 50, "height": 20, "required": true, "page_number": 0, "stretch_mode": "horizontal", "prefilled_text": "First name", "lock_to_sign_prefill": true}, {"x": 217, "y": 32, "role": "Recipient 1", "type": "signature", "width": 50, "height": 20, "required": true, "page_number": 0, "allowed_types": ["draw"]}, {"x": 217, "y": 32, "role": "Recipient 1", "type": "text", "label": "Date", "width": 50, "height": 20, "required": true, "page_number": 0, "validator_id": "059b068ef8ee5cc27e09ba79af58f9e805b7c2b3", "lock_to_sign_date": false}, {"x": 100, "y": 200, "name": "option_credit", "role": "Signer 1", "type": "checkbox", "value": "Credit Card", "width": 20, "height": 20, "required": false, "page_number": 0}, {"x": 100, "y": 230, "name": "option_debit", "role": "Signer 1", "type": "checkbox", "value": "Debit Card", "width": 20, "height": 20, "required": false, "page_number": 0}, {"x": 100, "y": 260, "name": "option_paypal", "role": "Signer 1", "type": "checkbox", "value": "PayPal", "width": 20, "height": 20, "required": false, "page_number": 0}, {"x": 217, "y": 32, "name": "photo", "role": "Recipient 1", "type": "attachment", "label": "Your photo", "width": 15, "height": 15, "required": true, "page_number": 0}, {"x": 389, "y": 141, "name": "US residency", "role": "Recipient 1", "type": "radiobutton", "radio": [{"x": 389, "y": 141, "value": "Yes", "width": 23, "height": 23, "page_number": 0}, {"x": 389, "y": 170, "value": "No", "width": 23, "height": 23, "page_number": 0}], "width": 23, "height": 23, "required": true, "page_number": 0, "prefilled_text": "Yes"}, {"x": 100, "y": 32, "name": "Department", "role": "Recipient 1", "type": "enumeration", "label": "Your department", "width": 70, "height": 40, "required": true, "page_number": 0, "enumeration_options": ["HR", "IT", "Finance"], "custom_defined_option": true}], "signatures": [{"x": 88, "y": 15, "data": "iVRFWHRkYAAAABJRU5ErkJggg==", "size": 11, "width": 122, "height": 34, "subtype": "signature", "line_height": 12, "page_number": 0, "client_timestamp": 1566237855, "prefill_content_type": "email"}], "document_name": "New document name", "checkbox_groups": [{"name": "payment_options", "checkbox_names": ["option_credit", "option_debit", "option_paypal"], "validation_type": "at_least", "validation_amount": 1}], "client_timestamp": "timestamp"}'
```

---
*Full reference: https://docs.signnow.com/docs/document/operations/edit-document*
