# Application templates

> Application templates - Template for custom activity (e.g., custom-metrics, applications).

This Markdown file sits beside the HTML page at the same path (with a `.md` suffix). It summarizes the topic and lists links for tools and LLM context.

Companion generated at `2026-07-27T18:44:30.507356+00:00` (UTC).

## Primary page

- [Application templates](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md): Full documentation for this topic (Markdown sidecar).

## Sections on this page

- [CustomTemplate](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate): In-page section heading.
- [create()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.create): In-page section heading.
- [list()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.list): In-page section heading.
- [get()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.get): In-page section heading.
- [update()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.update): In-page section heading.
- [delete()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.delete): In-page section heading.
- [download_content()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.download_content): In-page section heading.
- [upload_preview()](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate.upload_preview): In-page section heading.
- [DefaultEnvironment](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.DefaultEnvironment): In-page section heading.
- [CustomMetricMetadata](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomMetricMetadata): In-page section heading.
- [TemplateMetadata](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.TemplateMetadata): In-page section heading.

## Documentation content

### CustomTemplate

Template for custom activity (e.g., custom-metrics, applications).

#### create()

Create the custom template.

Added in version v3.9.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| name | str | The template name. |
| description | str | A description of the template. |
| template_type | str | The template type. |
| template_sub_type | str | The template sub-type. |
| template_metadata | TemplateMetadata\\|dict[str, Any]\\|str | The metadata associated with the template, provided as TemplateMetadata or a JSON-encoded string. |
| default_environment | DefaultEnvironment\\|dict[str, Any]\\|str | The default environment associated with the template, provided as DefaultEnvironment or a JSON-encoded string. |
| file | str | The path to the template directory or file, or the contents of the template. |
| default_resource_bundle_id | Optional[str] | The default resource bundle ID. |
| enabled | Optional[bool] | Whether the template is enabled (default is true). |
| is_hidden | Optional[bool] | Whether the template is hidden (default is false). |

Return type: [CustomTemplate](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate)

> [!NOTE] Examples
> ```
> from datarobot import CustomTemplate
> from datarobot.models.custom_templates import DefaultEnvironment
> def_env = DefaultEnvironment(
>     environment_id='679d47c8ce1ecd17326f3fdf',
>     environment_version_id='679d47c8ce1ecd17326f3fe3',
> )
> template = template.create(
>     name="My new template",
>     default_environment=def_env,
>     description='Updated template with environment v17',
> )
> ```

#### list()

List all custom templates.

Added in version v3.7.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| search | Optional[str] | Search string. |
| order_by | Optional[ListCustomTemplatesSortQueryParams] | Ordering field. |
| tag | Optional[str] | Tag associated with the template. |
| template_type | Optional[str] | Type of the template. |
| template_type |  | Sub-type of the template. |
| publisher | Optional[str] | Only return custom templates with this publisher. |
| category | Optional[str] | Only return custom templates with this category (use case). |
| show_hidden | Optional[bool] | Whether the template is hidden (default is false). |
| offset | Optional[int] | Offset for pagination. |
| limit | Optional[int] | Limit for pagination. |

Returns

| Returns | Description |
| --- | --- |
| templates |  |

Return type: `List[CustomTemplate]`

#### get()

Get a custom template by ID.

Added in version v3.7.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| template_id | str | ID of the template. |

Returns

| Returns | Description |
| --- | --- |
| template |  |

Return type: [CustomTemplate](https://docs.datarobot.com/ja/docs/api/reference/sdk/application-templates.html.md#datarobot.models.custom_templates.CustomTemplate)

#### update()

Update the custom template.

Added in version v3.7.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| name | Optional[str] | The template name. |
| description | Optional[str] | A description of the template. |
| default_resource_bundle_id | Optional[str] | The default resource bundle ID. |
| template_type | Optional[str] | The template type. |
| template_sub_type | Optional[str] | The template sub-type. |
| template_metadata | Optional[TemplateMetadata\\|str] | The metadata associated with the template, provided as TemplateMetadata or a JSON encoded string. |
| default_environment | Optional[DefaultEnvironment\\|str] | The default environment associated with the template, provided as DefaultEnvironment or a JSON encoded string. |
| file | str | The path to the template directory or file, or the contents of the template. |
| enabled | Optional[bool] | Whether the template is enabled (default is true). |
| is_hidden | Optional[bool] | Whether the template is hidden (default is false). |

Return type: `None`

> [!NOTE] Examples
> ```
> from datarobot import CustomTemplate
> from datarobot.models.custom_templates import DefaultEnvironment
> new_env = DefaultEnvironment(
>     environment_id='679d47c8ce1ecd17326f3fdf',
>     environment_version_id='679d47c8ce1ecd17326f3fe3',
> )
> template = CustomTemplate.get(template_id='5c939e08962d741e34f609f0')
> template.update(default_environment=new_env, description='Updated template with environment v17')
> ```

#### delete()

Delete this custom template.

Added in version v3.7.

Return type: `None`

#### download_content()

Retrieve the file content for the given item.

The item can be identified by filename or index in the array of items.

Added in version v3.9.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| filename | Optional[str] | The file name to retrieve. |
| index | Optional[int] | Index of the item to retrieve. |

Return type: `Bytes content` of `the file.`

#### upload_preview()

Upload the custom template preview image file.

Added in version v3.10.

Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| filename | str | The preview image filename. |

Return type: `None`

### DefaultEnvironment

Default execution environment.

### CustomMetricMetadata

Metadata for custom metrics.

### TemplateMetadata

Metadata for the custom templates.
