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

# Share document group

`POST /v2/document-groups/{document_group_id}/roles`

This endpoint allows API users to share a document group with a user by email, assigning them a specified role. If the user does not have an account, one is created automatically.

**Notes**

* **Viewer** - can view, download, and make copies of documents in a document group; **sender** - can view, download, make copies, invite to sign, and manage document invites.
* Only the owner of the document group can share it.
* A document group can be shared only once with the same user. Attempting to share again (even with a different role) returns an error.
* The user receives an email notification about the shared document group, including a preview link.
* If the user does not exist in the system, a new account is created automatically.
* If the document group was created from a document group template (DGT) that is already shared with the target user (as owner or sender), the sharing is rejected with a conflict error.

## Authorization

bearer

## Path Parameters

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

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "email",
    "role"
  ],
  "properties": {
    "role": {
      "type": "string",
      "example": "viewer",
      "description": "Role to assign. Allowed values: `viewer`, `sender`."
    },
    "email": {
      "type": "string",
      "example": "user@email.com",
      "description": "Email address of the user to share with."
    },
    "message": {
      "type": "string",
      "example": "Please review the documents.",
      "description": "Custom message to include in the notification email."
    }
  }
}
```

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

```json
{
  "role": "viewer",
  "email": "user@example.com",
  "message": "Please review these documents."
}
```

## Responses

### 200

Document group successfully shared.

**Example** (`Example 1`)

```json
{
  "id": "def456abc123def456abc123def456abc123defg",
  "role": "viewer",
  "email": "user@example.com"
}
```

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

```json
{
  "id": "def456abc123def456abc123def456abc123defg",
  "role": "viewer",
  "email": "user@example.com"
}
```

### 400

Bad request. Possible errors:

* Document group not found.
* You can't share document to yourself.
* Entity can only be shared once.
* Email validation errors.
* Role validation errors.
* Message validation errors.

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 12029026,
      "message": "Document group not found."
    }
  ]
}
```

**Example** (`Already shared`)

```json
{
  "errors": [
    {
      "code": 12029008,
      "message": "Entity can only be shared once."
    }
  ]
}
```

**Example** (`Message too long`)

```json
{
  "errors": [
    {
      "code": 12029028,
      "message": "Field `message` should not exceed 10000 characters."
    }
  ]
}
```

**Example** (`Role is required`)

```json
{
  "errors": [
    {
      "code": 12029004,
      "message": "Role is required."
    }
  ]
}
```

**Example** (`Email is required`)

```json
{
  "errors": [
    {
      "code": 12029002,
      "message": "Email is required."
    }
  ]
}
```

**Example** (`Message too short`)

```json
{
  "errors": [
    {
      "code": 12029028,
      "message": "Field `message` should be not less than 1 characters."
    }
  ]
}
```

**Example** (`Email is not valid`)

```json
{
  "errors": [
    {
      "code": 12029003,
      "message": "Email is not valid."
    }
  ]
}
```

**Example** (`Role must be string`)

```json
{
  "errors": [
    {
      "code": 12029005,
      "message": "Role must be string."
    }
  ]
}
```

**Example** (`Incorrect role value`)

```json
{
  "errors": [
    {
      "code": 12030014,
      "message": "Field `role` value should be one of [\"viewer\", \"sender\"], value: [\"...\"] given."
    }
  ]
}
```

**Example** (`Email must be a string`)

```json
{
  "errors": [
    {
      "code": 12029001,
      "message": "Email must be a string."
    }
  ]
}
```

**Example** (`Message must be string`)

```json
{
  "errors": [
    {
      "code": 12029027,
      "message": "Field `message` should be string, value: [...] given."
    }
  ]
}
```

**Example** (`Can't share to yourself`)

```json
{
  "errors": [
    {
      "code": 12029007,
      "message": "You can't share document to yourself."
    }
  ]
}
```

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

```json
{
  "errors": [
    {
      "code": 12029026,
      "message": "Document group not found."
    }
  ]
}
```

**Example** (`Message must not be empty`)

```json
{
  "errors": [
    {
      "code": 12029029,
      "message": "Field `message` must not be empty."
    }
  ]
}
```

### 403

Forbidden. You don't have access to the document group.

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 12029012,
      "message": "You don't have access to the entity."
    }
  ]
}
```

**Example** (`Forbidden`)

```json
{
  "errors": [
    {
      "code": 12029012,
      "message": "You don't have access to the entity."
    }
  ]
}
```

### 404

Incorrect document group ID format (not a 40-character hex string).

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 404,
      "message": "Not found."
    }
  ]
}
```

**Example** (`Not found`)

```json
{
  "errors": [
    {
      "code": 404,
      "message": "Not found."
    }
  ]
}
```

### 409

Conflict. The document group is already shared with the user.

**Example** (`Conflict`)

```json
{
  "errors": [
    {
      "code": 12029031,
      "message": "Sharing entity conflict: parent entity already shared."
    }
  ]
}
```

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 12029031,
      "message": "Sharing entity conflict: parent entity already shared."
    }
  ]
}
```

## Code Examples

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

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/v2/document-groups/{document_group_id}/roles" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"role": "viewer", "email": "user@example.com", "message": "Please review these documents."}'
```

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