# Application templates
URL: https://docs.datarobot.com/en/docs/api/reference/sdk/application-templates.html

# Custom templates

### class datarobot.models.custom_templates.CustomTemplate

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

#### classmethod create(name, description, template_type, template_sub_type, template_metadata, default_environment, file, default_resource_bundle_id=None, enabled=None, is_hidden=None)

Create the custom template.

Added in version v3.9.

- Parameters:
- Return type: 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',
> )
> ```

#### classmethod list(search=None, order_by=None, tag=None, template_type=None, template_sub_type=None, publisher=None, category=None, show_hidden=None, offset=None, limit=None)

List all custom templates.

Added in version v3.7.

- Parameters:
- Returns: templates
- Return type: List[CustomTemplate]

#### classmethod get(template_id)

Get a custom template by ID.

Added in version v3.7.

- Parameters: template_id ( str ) – ID of the template.
- Returns: template
- Return type: CustomTemplate

#### update(name=None, description=None, default_resource_bundle_id=None, template_type=None, template_sub_type=None, template_metadata=None, default_environment=None, file=None, enabled=None, is_hidden=None)

Update the custom template.

Added in version v3.7.

- Parameters:
- 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(index=None, filename=None)

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:
- Return type: Bytes content of the file.

#### upload_preview(filename)

Upload the custom template preview image file.

Added in version v3.10.

- Parameters: filename ( str ) – The preview image filename.
- Return type: None

### class datarobot.models.custom_templates.DefaultEnvironment

Default execution environment.

### class datarobot.models.custom_templates.CustomMetricMetadata

Metadata for custom metrics.

### class datarobot.models.custom_templates.TemplateMetadata

Metadata for the custom templates.

---
