---
title: "Create link for document"
url: "https://docs.signnow.com/docs/embedded-sending/operations/post-v2-documents-document_id-embedded-sending"
type: "endpoint"
section: "embedded-sending"
slug: "embedded-sending/operations/post-v2-documents-document_id-embedded-sending"
method: "POST"
path: "/v2/documents/{document_id}/embedded-sending"
operation_id: "post-v2-documents-document_id-embedded-sending"
authorization: "bearer"
---

# Create link for document

`POST /v2/documents/{document_id}/embedded-sending`

This endpoint allows users to create a link for embedded document sending.

Use the request body attributes to define where the link opens (the editor or the Send Invite page), configure redirect options, specify link expiration, and customize the sender’s email and name appearance.

For more information, see [Embedded sending guide](/docs/guides-embedded-sending) and 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=MR_Rko0X0aU)

</details>

## Authorization

bearer

## Path Parameters

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

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "type"
  ],
  "properties": {
    "type": {
      "type": "string",
      "minLength": 1,
      "description": "The type of invite settings available by the link. Possible values: `invite` - the Send Invite page opens for the document where user add the signer's address, email subject and message etc.; `document` - the document opens in the editor for adding fillable fields, and then the Send Invite page opens."
    },
    "from_name": {
      "type": "string",
      "example": "Anna Green",
      "maxLength": 300,
      "description": "Use this attribute to customize the name that appears: 1) on the Send Invite page (From, Invite Email Subject, and Invite Email Message); 2) in the invite and reassign emails: in email subject and email body; 3) in the signing session: as the name in From in the header and on the detailed From card."
    },
    "from_email": {
      "type": "string",
      "example": "sender@email.com",
      "maxLength": 255,
      "description": "Use this attribute to customize the email address that appears: 1) [part before @]on the Send Invite page (From, Invite Email Subject, and Invite Email Message) 2) in the invite and reassign emails: [part before @] in email subject and email body; when clicking Contact Sender and in Reply-to; 3) in the signing session: as the email in From in the header and on the detailed From card; when clicking Contact Sender in the More Actions menu and on the detailed From card."
    },
    "redirect_uri": {
      "type": "string",
      "minLength": 1,
      "description": "The page that opens after the signing session ends."
    },
    "link_expiration": {
      "type": "integer",
      "default": 15,
      "maximum": 45,
      "minimum": 15,
      "description": "Specifies how many minutes the link remains active. The allowed range is 15 to 45 minutes."
    },
    "redirect_target": {
      "type": "string",
      "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, default value.",
      "x-stoplight": {
        "id": "0twi4weakxf1z"
      }
    }
  },
  "x-examples": {
    "example-1": {
      "type": "document",
      "redirect_uri": "https://your.redirect.uri.com"
    }
  }
}
```

**Example** (`application/json`)

```json
{
  "type": "document",
  "from_name": "Jane Doe",
  "from_email": "sender@email.com",
  "redirect_uri": "https://example.com",
  "link_expiration": 15,
  "redirect_target": "blank"
}
```

## Responses

### 200

Returns the link for embedded sending in case of correct request.



**Example** (`Success`)

```json
{
  "data": {
    "url": "http://example.com/invite/16XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?access_token={token}&redirect_uri=http%3A%2F%2Fyour.redirect.uri.com&embedded_sending=1&redirect_target=blank"
  }
}
```

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

```json
{
  "data": {
    "url": "http://app-eval.signnow.com/webapp/invite/16df19211b354cb5b4beeb830803f3f4abd79c55?access_token={token}&redirect_uri=http%3A%2F%2Fyour.redirect.uri.com&embedded_sending=1"
  }
}
```

### 400

* Incorrect or missing token.
* User doesn't own the document.
* Document not found.
* Document was already sent.
* Cannot send an invite for the document from Trash folder.
* Incorrect payload.

**Validation errors:**

* Missing `type`.
* Incorrect `type`. Allowed values: `document`, `invite`.
* `redirect_uri` is not a string.
* `redirect_uri` is longer than 2048 characters.
* `redirect_uri` is not a correct URL.
* UTF 4-byte characters in `redirect_uri` are not supported.
* `link_expiration` is not an integer.
* `link_expiration` must be between 15 and 45.
* Custom `link_expiration` is more than 43200 minutes.
* `redirect_target` is not a string.
* Incorrect `redirect_target`. Allowed values: `self`, `blank`.
* `redirect_uri` is required if `redirect_target` is added.

**Example** (`missing type`)

```json
{
  "errors": [
    {
      "code": 19038001,
      "message": "The `type` value should not be blank."
    }
  ]
}
```

**Example** (`Incorrect type`)

```json
{
  "errors": [
    {
      "code": 19038002,
      "message": "The `type` attribute is invalid, allowed values: document, invite."
    }
  ]
}
```

**Example** (`Incorrect payload`)

```json
{
  "errors": [
    {
      "code": 19001000,
      "message": "Invalid payload"
    }
  ]
}
```

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

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

**Example** (`Missing redirect_uri`)

```json
{
  "errors": [
    {
      "code": 19038011,
      "message": "The `redirect_uri` field is required when `redirect_target` is added."
    }
  ]
}
```

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

```json
{
  "errors": [
    {
      "code": 19038004,
      "message": "Parameter `redirect_uri` must not exceed 2048 characters."
    }
  ]
}
```

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

```json
{
  "errors": [
    {
      "code": 19038006,
      "message": "Parameter `redirect_uri` must be a valid URL."
    }
  ]
}
```

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

```json
{
  "errors": [
    {
      "code": 19001002,
      "message": "User is not document owner."
    }
  ]
}
```

**Example** (`link_expiration too big`)

```json
{
  "errors": [
    {
      "code": 19047001,
      "message": "The link expiration should be less than or equal to 45 minutes."
    }
  ]
}
```

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

```json
{
  "errors": [
    {
      "code": 19038003,
      "message": "Parameter `redirect_uri` must be a string."
    }
  ]
}
```

**Example** (`Document in Trash folder`)

```json
{
  "errors": [
    {
      "code": 19001021,
      "message": "Cannot send an invite for the document from Trash folder."
    }
  ]
}
```

**Example** (`Document was already sent`)

```json
{
  "errors": [
    {
      "code": 19001047,
      "message": "Document has been already sent to a signer."
    }
  ]
}
```

**Example** (`Incorrect redirect_target`)

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

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

```json
{
  "errors": [
    {
      "code": 1537,
      "message": "Invalid token"
    }
  ]
}
```

**Example** (`link_expiration too little`)

```json
{
  "errors": [
    {
      "code": 19038008,
      "message": "The link expiration should be greater than or equal to 15 minutes."
    }
  ]
}
```

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

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

**Example** (`link_expiration not integer`)

```json
{
  "errors": [
    {
      "code": 19038007,
      "message": "The link expiration value should be of type int."
    }
  ]
}
```

**Example** (`Custom link_expiration too big`)

```json
{
  "errors": [
    {
      "code": 19047001,
      "message": "The link expiration should be less than or equal to 43200 minutes."
    }
  ]
}
```

**Example** (`4-byte characters in redirect_uri`)

```json
{
  "errors": [
    {
      "code": 19038005,
      "message": "4-byte characters in `redirect_uri` are not supported."
    }
  ]
}
```

## Code Examples

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

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/v2/documents/{document_id}/embedded-sending" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"type": "document", "from_name": "Jane Doe", "from_email": "sender@email.com", "redirect_uri": "https://example.com", "link_expiration": 15, "redirect_target": "blank"}'
```

---
*Full reference: https://docs.signnow.com/docs/embedded-sending/operations/post-v2-documents-document_id-embedded-sending*
