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

# Create link for document

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

This endpoint allows API users to generate a link to embed the SignNow document editor into their app, allowing their customers to edit documents without sending them for signing.

To generate an embedded editor link, make sure that:

- the document has not been sent for signing or signed.
- the document is not deleted or archived.

## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `document_id` | string | Yes | ID of the document to open in the embedded editor. |

## Request Body

**Schema**

```json
{
  "type": "object",
  "properties": {
    "redirect_uri": {
      "type": "string",
      "description": "The page that opens after the signing session ends.",
      "x-stoplight": {
        "id": "kxpmc6cagjvqz"
      }
    },
    "link_expiration": {
      "type": "integer",
      "description": "15 minutes by default. Can be set max to 43200 minutes by a user with Admin level of access."
    },
    "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": "lxwrbfcdu3pnc"
      }
    }
  },
  "x-examples": {
    "example-1": {
      "redirect_uri": "some_valid_url",
      "link_expiration": 15,
      "redirect_target": "blank"
    }
  }
}
```

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

```json
{
  "redirect_uri": "some_valid_url",
  "link_expiration": 15,
  "redirect_target": "blank"
}
```

## Responses

### 200

Returns a link in case of correct request.

**Example** (`Correct request`)

```json
{
  "data": {
    "url": "https://example.com/document/9dXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX?access_token={access_token}&redirect_uri=https%3A%2F%2Fwww.example.com&embedded=1&redirect_target=blank"
  }
}
```

### 400

* Incorrect or missing token.
* Document was already sent.

**Validation errors:**

* `redirect_uri` is not a string.
* Empty `redirect_uri`.
* `redirect_uri` is longer than 2048 characters.
* `redirect_uri` is not a correct URL.
* `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** (`Empty redirect_uri`)

```json
{
  "errors": [
    {
      "code": 19046002,
      "message": "Parameter `redirect_uri` must not be an empty string."
    }
  ]
}
```

**Example** (`Missing redirect_uri`)

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

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

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

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

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

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

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

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

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

**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": 19046008,
      "message": "The `redirect_target` field is invalid, allowed values: self, blank."
    }
  ]
}
```

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

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

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

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

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

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

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

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

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

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

### 403

User doesn't own the document

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

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

### 422

* Document is in the Trash: 19001021
  Message: "Cannot fulfill request for the document in Trash folder."
* Document deleted (from the Trash as well): 19001022
  Message: "Document not found"  

**Example** (`Document is in the Trash`)

```json
{
  "errors": [
    {
      "code": 19001021,
      "message": "Cannot fulfill request for the document in Trash folder."
    }
  ]
}
```

**Example** (`Document deleted (from the Trash as well)`)

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

## 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-editor" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"redirect_uri": "some_valid_url", "link_expiration": 15, "redirect_target": "blank"}'
```

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