
## Get template

`GET /v1/doc-templates/:id`

Returns a single document template by identifier.

## Parameters

| Parameter | Type | Req. | Description |
|----------|-----|:-----:|---------|
| `id` (path) | number | yes | Template identifier |

## Examples

### curl — personal key

```bash
curl "https://vibecode.bitrix24.com/v1/doc-templates/209" \
  -H "X-Api-Key: YOUR_API_KEY"
```

### curl — OAuth application

```bash
curl "https://vibecode.bitrix24.com/v1/doc-templates/209" \
  -H "X-Api-Key: YOUR_APP_KEY" \
  -H "Authorization: Bearer USER_SESSION_TOKEN"
```

### JavaScript — personal key

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/209', {
  headers: {
    'X-Api-Key': 'YOUR_API_KEY',
  },
})

const { success, data } = await res.json()
console.log('Template:', data.name)
```

### JavaScript — OAuth application

```javascript
const res = await fetch('https://vibecode.bitrix24.com/v1/doc-templates/209', {
  headers: {
    'X-Api-Key': 'YOUR_APP_KEY',
    'Authorization': 'Bearer USER_SESSION_TOKEN',
  },
})

const { success, data } = await res.json()
```

## Response fields

| Field | Type | Description |
|------|-----|---------|
| `success` | boolean | Always `true` on success |
| `data` | object | Template object |
| `data.id` | number | Template identifier |
| `data.name` | string | Name |
| `data.region` | string | Region |
| `data.code` | string \| null | System code of the template |
| `data.active` | string | Availability: `Y` / `N` |
| `data.moduleId` | string | Source module of the template |
| `data.numeratorId` | number | Numerator identifier |
| `data.withStamps` | string | Stamps and signatures: `Y` / `N` |
| `data.sort` | number | Order in the list |
| `data.users` | object | Mapping of identifiers of employees who have access to the template |
| `data.providers` | object | Template data providers |
| `data.isDeleted` | boolean | Whether the template is marked deleted |
| `data.createTime` | string | Creation date (ISO 8601) |
| `data.updateTime` | string | Change date (ISO 8601) |
| `data.download` | string | Document download URL |
| `data.downloadMachine` | string | Download URL for programmatic access |

Full template field schema — [Template fields](./fields.md).

## Response example

```json
{
  "success": true,
  "data": {
    "id": 209,
    "name": "Contract template",
    "region": "us",
    "code": null,
    "download": "/bitrix/services/main/ajax.php?action=documentgenerator.api.template.download&SITE_ID=s1&id=209",
    "active": "Y",
    "moduleId": "rest",
    "numeratorId": 1,
    "withStamps": "N",
    "providers": {
      "bitrix\\documentgenerator\\dataprovider\\rest": "bitrix\\documentgenerator\\dataprovider\\rest"
    },
    "users": {
      "U1": "U1"
    },
    "isDeleted": false,
    "sort": 500,
    "createTime": "2026-05-12T09:03:38.000Z",
    "updateTime": "2026-05-12T09:03:38.000Z",
    "downloadMachine": "https://<portal>/rest/1/<token>/documentgenerator.api.template.download/?token=<token>"
  }
}
```

## Error response example

404 — template not found:

```json
{
  "success": false,
  "error": {
    "code": "ENTITY_NOT_FOUND",
    "message": "Template not found"
  }
}
```

## Errors

| HTTP | Code | Description |
|------|-----|---------|
| 404 | `ENTITY_NOT_FOUND` | No template with the given `id` (message "Template not found") |
| 403 | `SCOPE_DENIED` | The key lacks the `documentgenerator` scope |
| 401 | `TOKEN_MISSING` | The key has no configured tokens |

Full list of common API errors — [Errors](/docs/errors).

## See also

- [List templates](/docs/entities/doc-templates/list)
- [Update template](/docs/entities/doc-templates/update)
- [Template fields](/docs/entities/doc-templates/fields)
