---
title: "Add template to doc group template"
url: "https://docs.signnow.com/docs/document-group-template/operations/post-v2-document-group-templates-document_group_template_id-templates"
type: "endpoint"
section: "document-group-template"
slug: "document-group-template/operations/post-v2-document-group-templates-document_group_template_id-templates"
method: "POST"
path: "/v2/document-group-templates/{doc_group_template_id}/templates"
operation_id: "post-v2-document-group-templates-document_group_template_id-templates"
authorization: "bearer"
---

# Add template to doc group template

`POST /v2/document-group-templates/{doc_group_template_id}/templates`

This endpoint allows users to add a document or template to the specific document group template.

**Note**: Uploaded documents are automatically converted to templates. Templates or documents added to the document group template are accessible only from the document group template management page.

The successful request returns an ID of the template added to the document group template.


## Authorization

bearer

## Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `doc_group_template_id` | string | Yes | ID of the document group template. |

## Request Body

**Schema**

```json
{
  "type": "object",
  "required": [
    "document_id",
    "template_id"
  ],
  "properties": {
    "document_id": {
      "type": "string",
      "example": "0aa11112b0ed40aab8cab111a76a6eea07f0000e",
      "description": "ID of the document to be added to the document group template. Only one parameter (`document_id` or `template_id`) should be provided per request."
    },
    "template_id": {
      "type": "string",
      "example": "0bb21112b0ed40aab8cab111a76a6eea07f0000e",
      "description": "ID of the template to be added to the document group template. Only one parameter (`document_id` or `template_id`) should be provided per request.",
      "x-stoplight": {
        "id": "xdtovbjnskdp4"
      }
    }
  },
  "x-examples": {
    "Example 1": {
      "document_id": "0aa11112b0ed40aab8cab111a76a6eea07f0000e"
    }
  }
}
```

**Example** (`Add document`)

```json
{
  "document_id": "0aa11112b0ed40aab8cab111a76a6eea07f0000e"
}
```

**Example** (`Add template`)

```json
{
  "template_id": "0aa44442b0ed40aab8cab111a76a6eea07f0000e"
}
```

## Responses

### 200

Success.

**Example** (`Example 1`)

```json
{
  "data": {
    "id": "d7c1697249214e33be1ef5e968822c6d2d505555"
  }
}
```

**Example** (`Successful request`)

```json
{
  "data": {
    "id": "d7c1697249214e33be1ef5e968822c6d2d505555"
  }
}
```

### 400

- Only one of `document_id` or `template_id` can be used.
- `document_id` is not a string.
- `document_id` or `template_id` is required.
- Incorrect `document_id`.
- User is not the owner of the document group template.
- User is not the document owner.
- Authorization is required.
- Document has active signature invites.
- Document is in the document group.
- Document is in the document group template.
- User is not the template owner.
- Template is in the document group template.
- `template_id` is not a string.
- Incorrect `template_id`.
- Document not found.
- Template not found.

**Example** (`Example 1`)

```json
{
  "errors": [
    {
      "code": 13025006,
      "message": "Invalid payload. Only one of `document_id` or `template_id` parameters should be used."
    }
  ]
}
```

**Example** (`Document in DGT`)

```json
{
  "code": 13026009,
  "message": "Document is contained in document group template."
}
```

**Example** (`Template in DGT`)

```json
{
  "code": 13026010,
  "message": "Template is contained in document group template."
}
```

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

```json
{
  "code": 13026006,
  "message": "Document 0aa11112b0ed4aaaaaaaaaaaaaaaaaaaaeea07f1111e not found."
}
```

**Example** (`Template not found`)

```json
{
  "code": 13026007,
  "message": "Template not found."
}
```

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

```json
{
  "code": 13026003,
  "message": "User is not document group template owner."
}
```

**Example** (`Incorrect document_id`)

```json
{
  "errors": [
    {
      "code": 13025003,
      "message": "The `document_id` value is not valid."
    }
  ]
}
```

**Example** (`Incorrect template_id`)

```json
{
  "errors": [
    {
      "code": 13025005,
      "message": "The `template_id` value is not valid."
    }
  ]
}
```

**Example** (`Authorization required`)

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

**Example** (`document_id not string`)

```json
{
  "errors": [
    {
      "code": 13025002,
      "message": "The `document_id` value should be of type string."
    }
  ]
}
```

**Example** (`template_id not string`)

```json
{
  "errors": [
    {
      "code": 13025004,
      "message": "The `template_id` value should be of type string."
    }
  ]
}
```

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

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

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

```json
{
  "code": 13026008,
  "message": "User is not template owner."
}
```

**Example** (`Document in document group`)

```json
{
  "code": 13026005,
  "message": "Document in document group."
}
```

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

```json
{
  "code": 13026004,
  "message": "Document with active invites."
}
```

**Example** (`Only one of document_id or template_id`)

```json
{
  "errors": [
    {
      "code": 13025006,
      "message": "Invalid payload. Only one of `document_id` or `template_id` parameters should be used."
    }
  ]
}
```

**Example** (`document_id or template_id is required`)

```json
{
  "errors": [
    {
      "code": 13025001,
      "message": "One of `document_id` or `template_id` value should not be blank."
    }
  ]
}
```

### 404

- Document group template not found.

**Example** (`Example 1`)

```json
{
  "code": 13026006,
  "message": "Document 0aa11112b0ed4aaaaaaaaaaaaaaaaaaaaeea07f1111e not found"
}
```

**Example** (`DGT not found`)

```json
{
  "code": 23001014,
  "message": "Document Group Template 0aa11112b0ed4aaaaaaaaaaaaaaaaaaaaeea07f1111e not found."
}
```

## Code Examples

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

### cURL

```bash
curl -X POST \
  "https://api.signnow.com/v2/document-group-templates/{doc_group_template_id}/templates" \
  -H "Authorization: Bearer $SIGNNOW_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"document_id": "0aa11112b0ed40aab8cab111a76a6eea07f0000e"}'
```

---
*Full reference: https://docs.signnow.com/docs/document-group-template/operations/post-v2-document-group-templates-document_group_template_id-templates*
