---
title: "Invite to sign"
url: "https://docs.signnow.com/docs/document-field-invite/operations/post-document-doc_id-invite"
type: "endpoint"
section: "document-field-invite"
slug: "document-field-invite/operations/post-document-doc_id-invite"
method: "POST"
path: "/document/{document_id}/invite"
operation_id: "post-document-doc_id-invite"
authorization: "bearer"
---

# Invite to sign

`POST /document/{document_id}/invite`

This endpoint allows users to create and send a field invite to sign a document. Invite payload varies for a document that contains or doesn't contain fields.

* For an invite with fields sent by email, see this page.
* For an invite without fields, see [Freeform invite](/docs/document-field-invite/operations/post-field_invite).<br>
* For an invite with fields sent by SMS, see [SMS invite](/docs/document-field-invite/operations/post-field_invite).

Learn more about an [Invite to sign a document](/docs/invite-to-sign#send-a-document-for-signature).

<details>

**<summary>Use additional attributes to customize signing experience</summary>**

Parameter | Description | Example
---------|----------|---------
 `reassign` | A recipient can forward the invite by clicking **More Actions** > **Forward Invite** and entering an email address. | <img src="/reference-assets/images/Screenshots with attribute explanations/Field invite/reassign.png" alt="Forward invite"> 
 `force_new_signature` | A recipient must create a new signature for each signature field. | <img src="/reference-assets/images/Screenshots with attribute explanations/Field invite/Force_new_signature.png" alt="Force new signature">
 `prefill_signature_name` | A string with a signature name that appears when a signer clicks a signature field. The signer can edit the signature.|
 `required_preset_signature_name` | A string with a signature name that appears when a signer clicks a signature field. The signer cannot edit the signature. |
 `decline_by_signature` | When a signer clicks a signature field, they see two options: sign the fields and decline the document. | <img src="/reference-assets/images/Screenshots with attribute explanations/Field invite/Decline_by_signature.png" alt="Decline by signature">
 `authentication_type` | Requires a recipient to enter a password or a code before viewing the document. For more information, see [Two-factor authentication](/docs/two-factor-authentication). | <img src="/reference-assets/images/Screenshots with attribute explanations/Field invite/Document_authentication.png" alt="Password_authentication">
</details>

## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `document_id` | string | Yes | ID of the document |

## Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Content-type` | string | No | application/json |

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "to",
    "from"
  ],
  "properties": {
    "cc": {
      "type": "array",
      "items": {
        "type": "object"
      },
      "description": "Array[string]: email addresses for CC recipients"
    },
    "to": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "email",
          "phone_invite",
          "role_id",
          "role",
          "order"
        ],
        "properties": {
          "role": {
            "type": "string",
            "minLength": 1,
            "description": "Recipient's role name. e.g. Signer 1, Signer 2. Optional if the role_id parameter is specified"
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "description": "Recipient's email address"
          },
          "order": {
            "type": "number",
            "description": "Integer, order of signing: 1 - the recipient has to sign the document first, then the document is sent to 2,3 etc. Several recipients can hold the same order of signing."
          },
          "phone": {
            "type": "string",
            "description": "Signer's verification phone number. Required if \"authentication_type\": \"phone\""
          },
          "method": {
            "type": "string",
            "default": "sms",
            "description": "Method of the phone authentication type. Required with the `phone` authentication type. Allowed values: `sms`, `phone_call`."
          },
          "message": {
            "type": "string",
            "minLength": 1,
            "description": "Custom email message for the recipient. Requires a paid API plan, an API free trial, or a Site License."
          },
          "role_id": {
            "type": "string",
            "minLength": 1,
            "description": "ID of the recipient's Signer role. Optional if the role parameter is specified"
          },
          "subject": {
            "type": "string",
            "minLength": 1,
            "description": "Custom email subject for the recipient. Requires a paid API plan, an API free trial, or a Site License."
          },
          "language": {
            "type": "string",
            "description": "Sets the language of the signing session and notification emails for the signer. Possible values: `en` for English, `es` for Spanish, and `fr` for French. If not set, the language is determined by the language of your SignNow account. If emails are branded, you can set up [your own](/docs/guides-branding#language-branding) email texts in different languages."
          },
          "password": {
            "type": "string",
            "minLength": 1,
            "description": "Signer's verification password. Required if \"authentication_type\": \"password\""
          },
          "reassign": {
            "type": "string",
            "minLength": 1,
            "description": "Specifies whether the recipient can forward the invite to another email address. `0` - recipient can forward the invite. `1` - recipient cannot forward the invite."
          },
          "reminder": {
            "type": "object",
            "properties": {
              "remind_after": {
                "type": "number",
                "maximum": 179,
                "minimum": 1,
                "description": "x days after the invite, a recipient gets a reminder email. Must be less than `expiration_days`"
              },
              "remind_before": {
                "type": "number",
                "maximum": 179,
                "minimum": 1,
                "description": "x days before expiration, a recipient gets a reminder email. Must be less than `expiration_days`"
              },
              "remind_repeat": {
                "type": "number",
                "maximum": 7,
                "minimum": 1,
                "description": "A recipient gets a reminder email each x days after the invite is sent"
              }
            }
          },
          "signature": {
            "type": "object",
            "properties": {
              "type": {
                "type": "string",
                "description": "Type of QES signature. Possible values: `eideasy`,` eideasy-pdf`, and `nom151`. All signers in the invite must have the same signature type."
              }
            },
            "description": "This object is used to request QES signatures from signers. To use it, a user must be a member of an organization with QES settings enabled. If QES is used, it must be used for all signers in the invite.<br>For more information, see [QES user guide](/docs/qualified-electronic-signature)."
          },
          "email_group": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "A name of the email group. Must be defined in the `email_groups` array."
              }
            },
            "description": "A group of users that should receive the invite. When one of the users signs the document, the document is completed. Must be used with the `email_groups` array. Required if `email` or `phone_invite` is not added but cannot be used at the same time with either of these parameters."
          },
          "phone_invite": {
            "type": "string",
            "description": "Recipient's phone number. Required for Invite via SMS"
          },
          "redirect_uri": {
            "type": "string",
            "description": "When all the requested fields are completed and signed, the signer is redirected to this URI."
          },
          "expiration_days": {
            "type": "number",
            "default": 30,
            "maximum": 180,
            "minimum": 3,
            "description": "In x days, the invite expires"
          },
          "redirect_target": {
            "type": "string",
            "default": "blank",
            "description": "Determines whether to open the redirect link in the new tab in the browser, or in the same tab after the signing session. Possible values: `blank` - opens the link in the new tab, `self` - opens the link in the same tab."
          },
          "close_redirect_uri": {
            "type": "string",
            "description": "The link that opens when a signer clicks\u00a0**Save Progress and Finish Later**\u00a0during a signing session or\u00a0**Close**\u00a0in view mode. "
          },
          "authentication_type": {
            "type": "string",
            "minLength": 1,
            "description": "Type of signer's identity verification. Possible values: `\"password\"` or `\"phone\"`"
          },
          "force_new_signature": {
            "type": "number",
            "description": "Whether or not the signer can use their saved signature. Possible values: 0 - signer can use a saved signature, 1 - signer has to add a new signature"
          },
          "decline_by_signature": {
            "type": "string",
            "minLength": 1,
            "description": "Whether or not to allow recipients decline the invite"
          },
          "decline_redirect_uri": {
            "type": "string",
            "description": "The link that opens after the signing session has been declined by the signer."
          },
          "prefill_signature_name": {
            "type": "string",
            "example": "Jane Doe",
            "maxLength": 255,
            "description": "The text displayed in the Signature field. The signer can edit this value."
          },
          "authentication_sms_message": {
            "type": "string",
            "description": "If `\"method\": \"sms\"` - custom message, max 140 characters. Example: `\"Custom SMS message to add to your {password}\"`. Customizing the 2FA SMS message requires an API free trial, an active API subscription, or a Site License."
          },
          "is_close_redirect_canceled": {
            "type": "boolean",
            "default": false,
            "description": "Specifies whether the save progress redirect setting is canceled for the organization.`true` \u2013 the redirect is canceled;`false` \u2013 the redirect remains active."
          },
          "is_finish_redirect_canceled": {
            "type": "boolean",
            "default": false,
            "description": "Specifies whether the completion redirect setting is canceled for the organization.`true` \u2013 the redirect is canceled;`false` \u2013 the redirect remains active."
          },
          "is_decline_redirect_canceled": {
            "type": "boolean",
            "default": false,
            "description": "Specifies whether the decline redirect setting is canceled for the organization.`true` \u2013 the redirect is canceled;`false` \u2013 the redirect remains active."
          },
          "required_preset_signature_name": {
            "type": "string",
            "example": "Jane Doe",
            "description": "The text displayed in the Signature field. The signer cannot edit this value. Cannot be used simultaneously with `prefill_signature_name` or `force_new_signature` for the same role."
          }
        }
      },
      "minItems": 1,
      "description": "Array[object]: email addresses and settings for all recipients",
      "uniqueItems": true
    },
    "from": {
      "type": "string",
      "minLength": 1,
      "description": "Sender's email address: you can use only the email address associated with your SignNow account (login email) as `from` address."
    },
    "cc_step": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "description": "Name of the step"
          },
          "step": {
            "type": "number",
            "description": "Integer: the order of sending, starting from 1"
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "description": "CC recipient's email address"
          }
        }
      },
      "minItems": 1,
      "description": "Array[string]: order and settings of sending the cc emails",
      "uniqueItems": true
    },
    "message": {
      "type": "string",
      "minLength": 1,
      "description": "Email message for all signers. Requires a paid API plan, an API free trial, or a Site License."
    },
    "subject": {
      "type": "string",
      "minLength": 1,
      "description": "Email subject for all signers. Requires a paid API plan, an API free trial, or a Site License."
    },
    "viewers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "minLength": 1,
            "description": "Viewer's role name"
          },
          "email": {
            "type": "string",
            "minLength": 1,
            "description": "Viewer's email address"
          },
          "order": {
            "type": "number",
            "description": "Integer: the order of sending, starting from 1"
          },
          "message": {
            "type": "string",
            "description": "Custom email message for the viewer. Requires a paid API plan, an API free trial, or a Site License."
          },
          "subject": {
            "type": "string",
            "description": "Custom email subject for the viewer. Requires a paid API plan, an API free trial, or a Site License."
          }
        }
      },
      "minItems": 1,
      "description": "An array of recipients who will get read-only access to the invite.",
      "uniqueItems": true
    },
    "approvers": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "role": {
            "type": "string",
            "example": "Approver",
            "description": "Approver's role name."
          },
          "email": {
            "type": "string",
            "example": "approver@email.com",
            "description": "Approver's email address."
          },
          "order": {
            "type": "integer",
            "example": 1,
            "minimum": 1,
            "description": "The order of receiving the invite."
          },
          "phone": {
            "type": "string",
            "example": "+1234567",
            "description": "Phone number used to authenticate the recipient. Required with the `phone`authentication  method.",
            "x-stoplight": {
              "id": "xab3ua1zhgqaf"
            }
          },
          "method": {
            "type": "string",
            "example": "sms",
            "description": "Method of the phone authentication type. Required with the `phone` authentication type. Allowed values: `sms`, `phone_call`."
          },
          "message": {
            "type": "string",
            "example": "Review and approve the invoice",
            "description": "Custom email message for the approver. Requires a paid API plan, an API free trial, or a Site License."
          },
          "subject": {
            "type": "string",
            "example": "Approve the invoice",
            "description": "Custom email subject for the approver. Requires a paid API plan, an API free trial, or a Site License."
          },
          "password": {
            "type": "string",
            "example": "123456",
            "description": "Password set for the recipient authentication. Required with the `password` authentication type."
          },
          "redirect_uri": {
            "type": "string",
            "example": "https://www.signnow.com/",
            "description": "The URL that opens after the approver approves the document."
          },
          "expiration_days": {
            "type": "integer",
            "maximum": 30,
            "minimum": 1,
            "description": "Number of days before the invite expires. Allowed range: `1`\u2013`30`."
          },
          "redirect_target": {
            "type": "string",
            "example": "blank",
            "description": "Determines whether to open the redirect link in the new tab in the browser, or in the same tab after the signing session. Possible values: `blank` - opens the link in the new tab, `self` - opens the link in the same tab."
          },
          "authentication_type": {
            "type": "string",
            "example": "phone",
            "description": "Type of approver's identity verification. Possible values: `password` or `phone`."
          },
          "authentication_sms_method": {
            "type": "string",
            "example": "Enter the password {password} to unlock your document.",
            "description": "Custom sms message sent to the recipient, containing the {password} placeholder. Used with the `sms` method. Without this parameter, the recipient receives a default sms with an autogenerated password (unlock code) - \"SignNow document invite unlock code: 123456\"."
          }
        }
      },
      "description": "List of recipients who can review and approve the invite."
    },
    "cc_message": {
      "type": "string",
      "minLength": 1,
      "description": "CC email message for all CC recipients"
    },
    "cc_subject": {
      "type": "string",
      "minLength": 1,
      "description": "CC email subject for all CC recipients"
    },
    "email_groups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "An ID of an email group. A unique 40-character long ID that you need to create."
          },
          "name": {
            "type": "string",
            "description": "A name of the group. Use it in the `to.email_group` array."
          },
          "emails": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "email": {
                  "type": "string",
                  "description": "An email address of the group member."
                }
              }
            },
            "description": "Email addresses that should receive an invite. Must be unique within the group."
          }
        }
      },
      "description": "A group of users that should receive the invite."
    },
    "general_reminder": {
      "type": "object",
      "properties": {
        "remind_after": {
          "type": "integer",
          "description": "Days after invite is sent before a reminder is delivered. Must be less than `general_expiration_days`."
        },
        "remind_before": {
          "type": "integer",
          "description": "Days before expiration when a reminder is delivered. Must be less than `general_expiration_days`."
        },
        "remind_repeat": {
          "type": "integer",
          "description": "Days between repeated reminders."
        }
      },
      "x-nullable": true,
      "description": "Default `reminder` applied to all recipients in the invite."
    },
    "general_expiration_days": {
      "type": "integer",
      "example": 30,
      "maximum": 180,
      "minimum": 1,
      "x-nullable": true,
      "description": "Default `expiration_days` applied to all recipients in the invite. Min: `1`, Max: `180`. Default: `30`."
    }
  },
  "x-examples": {
    "example-1": {
      "cc": [
        "sales@email.com",
        "hr@email.com"
      ],
      "to": [
        {
          "role": "Signer 1",
          "email": "signer1@email.com",
          "order": 1,
          "message": "Hi, this is an invite to sign a document from sender@email.com.",
          "role_id": "48XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
          "subject": "You\u2019ve got a new signature request",
          "password": "123456",
          "reassign": "0",
          "reminder": 0,
          "redirect_uri": "https://example.com",
          "expiration_days": 30,
          "redirect_target": "blank",
          "authentication_type": "password",
          "force_new_signature": 1,
          "decline_by_signature": "0",
          "decline_redirect_uri": "https://signnow.com",
          "signing_instructions": "Please, add your signature here",
          "prefill_signature_name": "Recipient signature"
        }
      ],
      "from": "sender@email.com",
      "cc_step": [
        {
          "name": "CC 1",
          "step": 1,
          "email": "cc_recipient1@email.com"
        },
        {
          "name": "CC 2",
          "step": 2,
          "email": "cc_recipient2@email.com"
        }
      ],
      "message": "sender@email.com invited you to sign the Invoice document",
      "subject": "sender@email.com Needs Your Signature",
      "viewers": [
        {
          "role": "Viewer 1",
          "email": "viewer@email.com",
          "order": 1
        }
      ],
      "cc_message": "cc Invoice request for Signer 1",
      "cc_subject": "cc Invoice request"
    }
  }
}
```

**Example** (`With QES`)

```json
{
  "to": [
    {
      "role": "Signer 1",
      "email": "signer@email.com",
      "order": 1,
      "message": "Hi, this is an invite to sign a document from sender@email.com.",
      "role_id": "6e9580fa76ba4edca18fa6e680a36d10a6bab503",
      "subject": "You\u2019ve got a new signature request",
      "reassign": "0",
      "signature": {
        "type": "eideasy"
      },
      "expiration_days": 30,
      "force_new_signature": 1,
      "decline_by_signature": "0",
      "prefill_signature_name": "Jane Doe"
    }
  ],
  "from": "sender@email.com"
}
```

**Example** (`With an email group`)

```json
{
  "to": [
    {
      "role": "Signer 1",
      "email_group": {
        "name": "HR department"
      }
    }
  ],
  "from": "sender@email.com",
  "email_groups": [
    {
      "id": "b31d1cae529c4f5ebaf04b6e585e360c137abf27",
      "name": "HR department",
      "emails": [
        {
          "email": "signer1@email.com"
        },
        {
          "email": "signer2@email.com"
        }
      ]
    }
  ]
}
```

**Example** (`Regular field invite`)

```json
{
  "cc": [
    "cc_recipient1@email.com",
    "cc_recipient2@email.com"
  ],
  "to": [
    {
      "role": "Signer 1",
      "email": "signer1@email.com",
      "order": 1,
      "message": "Hi, this is an invite to sign a document from sender@email.com.",
      "role_id": "48XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "subject": "You\u2019ve got a new signature request",
      "language": "en",
      "password": "123456",
      "reassign": "0",
      "reminder": {
        "remind_after": 3,
        "remind_repeat": 7
      },
      "redirect_uri": "https://unique-solutions.com",
      "expiration_days": 30,
      "redirect_target": "blank",
      "close_redirect_uri": "https://unique-solutions.com",
      "authentication_type": "password",
      "force_new_signature": 1,
      "decline_by_signature": "0",
      "decline_redirect_uri": "https://unique-solutions.com",
      "prefill_signature_name": "Recipient signature"
    }
  ],
  "from": "sender@email.com",
  "cc_step": [
    {
      "name": "CC 1",
      "step": 1,
      "email": "cc_recipient1@email.com"
    },
    {
      "name": "CC 2",
      "step": 2,
      "email": "cc_recipient2@email.com"
    }
  ],
  "message": "sender@email.com invited you to sign the Invoice document",
  "subject": "sender@email.com needs your signature",
  "viewers": [
    {
      "role": "Viewer 1",
      "email": "viewer@email.com",
      "order": 1,
      "message": "You\u2019ve got a new document to review.",
      "subject": "New document"
    }
  ],
  "approvers": [
    {
      "role": "Approver",
      "email": "approver@email.com",
      "order": 3,
      "message": "Hi, this is an invite to review and approve the purchase agreement.",
      "subject": "Review and approve the agreement",
      "password": "123458",
      "redirect_uri": "https://example.com",
      "expiration_days": 30,
      "redirect_target": "blank",
      "authentication_type": "password"
    }
  ],
  "cc_message": "cc Invoice request for Signer 1",
  "cc_subject": "cc Invoice request",
  "general_reminder": {
    "remind_after": 3,
    "remind_before": 5,
    "remind_repeat": 7
  },
  "general_expiration_days": 30
}
```

**Example** (`Invite to sign via SMS `)

```json
{
  "to": [
    {
      "role": "Signer 1",
      "order": 1,
      "role_id": "48XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "reassign": "0",
      "phone_invite": "+1XXXXXXXXXX",
      "redirect_uri": "https://example.com",
      "expiration_days": 27,
      "redirect_target": "blank",
      "close_redirect_uri": "https://close-redirect-uri.com",
      "decline_by_signature": "1",
      "decline_redirect_uri": "https://signnow.com"
    }
  ],
  "from": "sender@email.com"
}
```

**Example** (`Invite with 2FA via SMS`)

```json
{
  "cc": [
    "cc_recipient1@email.com",
    "cc_recipient2@email.com"
  ],
  "to": [
    {
      "role": "Signer 1",
      "email": "signer1@email.com",
      "order": 1,
      "message": "Hi, this is an invite to sign a document from sender@email.com.",
      "role_id": "48XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
      "subject": "You\u2019ve got a new signature request",
      "password": "123456",
      "reassign": "0",
      "reminder": {
        "remind_after": 3,
        "remind_repeat": 7
      },
      "redirect_uri": "https://example.com",
      "expiration_days": 30,
      "redirect_target": "blank",
      "close_redirect_uri": "https://close-redirect-uri.com",
      "authentication_type": "password",
      "force_new_signature": 1,
      "decline_by_signature": "0",
      "decline_redirect_uri": "https://signnow.com",
      "prefill_signature_name": "Recipient signature"
    }
  ],
  "from": "sender@email.com",
  "cc_step": [
    {
      "name": "CC 1",
      "step": 1,
      "email": "cc_recipient1@email.com"
    },
    {
      "name": "CC 2",
      "step": 2,
      "email": "cc_recipient2@email.com"
    }
  ],
  "message": "sender@email.com invited you to sign the Invoice document",
  "subject": "sender@email.com needs your signature",
  "viewers": [
    {
      "role": "Viewer 1",
      "email": "viewer@email.com",
      "order": 1,
      "message": "You\u2019ve got a new document to review.",
      "subject": "New document",
      "redirect_target": "blank",
      "close_redirect_uri": ""
    }
  ],
  "cc_message": "cc Invoice request for Signer 1",
  "cc_subject": "cc Invoice request"
}
```

## Responses

### 200

Returns success if the request is correct. 

**Example** (`Example 1`)

```json
{
  "status": "success"
}
```

**Example** (`Invite to sign via SMS`)

```json
{
  "status": "success"
}
```

**Example** (`Field invite (document with fields)`)

```json
{
  "status": "success"
}
```

**Example** (`Freeform invite (document without fields)`)

```json
{
  "id": "96XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
  "result": "success",
  "callback_url": "none"
}
```

### 400

* Incorrect or missing token.
* `to` is not a correct email address.
* `from` is not a correct email address.
* `role_id_1` doesn't exist on the document.
* Document has no active fields.
* Document has active invites.
* Document is not found.
* Missing authentication type.
* `language` is not a string.
* Incorrect `language`. Allowed values: `en`, `fr`, `es`.
* `redirect_uri` is not a string.
* Empty `redirect_uri`.
* `redirect_uri` is not a correct URL.
* `redirect_uri` is longer than 2048 characters.
* `decline_redirect_uri` is not a string.
* Empty `decline_redirect_uri`.
* `decline_redirect_uri` is not a correct URL.
* `decline_redirect_uri` is longer than 2048 characters.
* `redirect_target` is not a string.
* Incorrect `redirect_target`. Allowed values: `self`, `blank`.
* One of `redirect_uri` fields is required when `redirect_target` is added.
* Missing signature type.
* Incorrect `signature.type`. Allowed values: `eideasy`,`eideasy-pdf`, `nom151`.
* Missing or different QES settings for one or more signers.
* Either `to.email` or `to.email_group` should be used.
* Email group is not defined.
* Email addresses in an email group are not unique.
* `email_group` is not an array.
* `email_group.name` is not a string.
* `email_groups` is not an array.
* `email_groups.id` is not a string.
* `email_groups.name` is not a string.
* `email_groups.emails` is not an array.
* `emails.[*].email` is not a string.
* `close_redirect_uri` is not a string.
* `close_redirect_uri` is empty.
* `close_redirect_uri` is not a correct URL address.
* `close_redirect_uri` is longer than 2048 characters.
* `viewers.close_redirect_uri` is not a string.
* `viewers.close_redirect_uri` is empty.
* `viewers.close_redirect_uri` is not a correct URL address.
* `viewers.close_redirect_uri` is longer than 2048 characters.
* `viewers.redirect_target is` added but `viewers.close_redirect_uri` is missing.
* `viewers.redirect_target` is not a string.
* Incorrect `viewers.redirect_target` value.

**Example** (`Document not found`)

```json
{
  "errors": [
    {
      "code": 65582,
      "message": "Document not found"
    }
  ]
}
```

**Example** (`Empty redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_uri` field must not be empty."
    }
  ]
}
```

**Example** (`Incorrect language`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `language` field is invalid, allowed values: \"en\", \"es\", \"fr\"."
    }
  ]
}
```

**Example** (`language not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `language` field must be a string."
    }
  ]
}
```

**Example** (`Incorrect `to` email`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "To must be a valid email."
    }
  ]
}
```

**Example** (`Missing redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The one of `redirect_uri` fields is required when `redirect_target` is added."
    }
  ]
}
```

**Example** (`email_group not array`)

```json
{
  "code": 65536,
  "message": "The `email_group` should be of type array."
}
```

**Example** (`redirect_uri too long`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_uri` field must contain no more than 2048 characters."
    }
  ]
}
```

**Example** (`role_id doesn't exist`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Role {{role_id_1}} does not exist on document"
    }
  ]
}
```

**Example** (`Incorrect `from` email`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "From must be a valid email."
    }
  ]
}
```

**Example** (`Incorrect redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_uri` field contains a URL in an invalid format."
    }
  ]
}
```

**Example** (`Missing signature type`)

```json
{
  "code": 66390,
  "message": "Signature type could not be blank"
}
```

**Example** (`email_groups not array`)

```json
{
  "code": 65536,
  "message": "The `email_groups` must be an array."
}
```

**Example** (`Email group not defined`)

```json
{
  "code": 65536,
  "message": "%email_group should be present in `email_groups`."
}
```

**Example** (`emails.email not string`)

```json
{
  "code": 65536,
  "message": "Field `email` in `email_groups.emails` should be of type string."
}
```

**Example** (`Empty close_redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field must not be empty."
    }
  ]
}
```

**Example** (`Incorrect signature type`)

```json
{
  "code": 66390,
  "message": "The signature_type must be one of the following types: eideasy, eideasy-pdf, nom151"
}
```

**Example** (`redirect_uri not string `)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_uri` field must be a string."
    }
  ]
}
```

**Example** (`Incorrect redirect_target`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_target` field is invalid, allowed values: self, blank."
    }
  ]
}
```

**Example** (`Empty decline_redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `decline_redirect_uri` field must not be empty."
    }
  ]
}
```

**Example** (`Incorrect or missing token`)

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

**Example** (`email_groups.id not string`)

```json
{
  "code": 65536,
  "message": "Field `id` in `email_groups` should be of type string."
}
```

**Example** (`redirect_target not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_target` field must be a string."
    }
  ]
}
```

**Example** (`Document has active invites`)

```json
{
  "errors": [
    {
      "code": 65629,
      "message": "Could not create duplicate field invite"
    }
  ]
}
```

**Example** (`Missing authentication type`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "Authentication type must not be empty"
    }
  ]
}
```

**Example** (`close_redirect_uri too long`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field must contain no more than 2048 characters."
    }
  ]
}
```

**Example** (`email_group.name not string`)

```json
{
  "code": 65536,
  "message": "Field `name` in `to.email_group` should be of type string."
}
```

**Example** (`close_redirect_uri not a URL`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field contains a URL in an invalid format."
    }
  ]
}
```

**Example** (`email_groups.name not string`)

```json
{
  "code": 65536,
  "message": "Field `name` in `email_groups` should be of type string."
}
```

**Example** (`Document has no active fields`)

```json
{
  "errors": [
    {
      "code": 65594,
      "message": "Cannot send a field invite: This document does not contain fields."
    }
  ]
}
```

**Example** (`Email group emails not unique`)

```json
{
  "code": 65536,
  "message": "Emails in email group should be unique."
}
```

**Example** (`close_redirect_uri not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field must be a string."
    }
  ]
}
```

**Example** (`decline_redirect_uri too long`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `decline_redirect_uri` field must contain no more than 2048 characters."
    }
  ]
}
```

**Example** (`email_groups.emails not array`)

```json
{
  "code": 65536,
  "message": "Field `emails` in `email_groups` should be of type array."
}
```

**Example** (`Incorrect decline_redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `decline_redirect_uri` field contains a URL in an invalid format"
    }
  ]
}
```

**Example** (`Use either email or email_group`)

```json
{
  "code": 65582,
  "message": "Either `phone_invite`, `email`, or `email_group` in `to` is required. Only one parameter at a time is allowed."
}
```

**Example** (`decline_redirect_uri not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `decline_redirect_uri` field must be a string."
    }
  ]
}
```

**Example** (`Empty viewers.close_redirect_uri`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field in `viewers` must not be empty."
    }
  ]
}
```

**Example** (`Missing or different QES settings`)

```json
{
  "code": 65582,
  "message": "Invalid advanced sign provider for sender organization"
}
```

**Example** (`viewers.redirect_target not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_target` field in `viewers` must be a string."
    }
  ]
}
```

**Example** (`viewers.close_redirect_uri too long`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field in `viewers` must contain no more than 2048 characters."
    }
  ]
}
```

**Example** (`viewers.close_redirect_uri not a URL`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field in `viewers` contains a URL in an invalid format."
    }
  ]
}
```

**Example** (`viewers.close_redirect_uri is missing`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field in `viewers` is required when `redirect_target` is added."
    }
  ]
}
```

**Example** (`viewers.close_redirect_uri not string`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `close_redirect_uri` field in `viewers` must be a string."
    }
  ]
}
```

**Example** (`Incorrect viewers.redirect_target value`)

```json
{
  "errors": [
    {
      "code": 65536,
      "message": "The `redirect_target` field in `viewers` is invalid, allowed values: self, blank."
    }
  ]
}
```

## Code Examples

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

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/document/{document_id}/invite" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"to": [{"role": "Signer 1", "email": "signer@email.com", "order": 1, "message": "Hi, this is an invite to sign a document from sender@email.com.", "role_id": "6e9580fa76ba4edca18fa6e680a36d10a6bab503", "subject": "You\u2019ve got a new signature request", "reassign": "0", "signature": {"type": "eideasy"}, "expiration_days": 30, "force_new_signature": 1, "decline_by_signature": "0", "prefill_signature_name": "Jane Doe"}], "from": "sender@email.com"}'
```

---
*Full reference: https://docs.signnow.com/docs/document-field-invite/operations/post-document-doc_id-invite*
