# How to Create or Delete a Custom Template Machines are Linux and Windows virtual machines with persistent storage, GPU options, and free unlimited bandwidth. They’re designed for high-performance computing (HPC) workloads. [Custom templates](https://docs.digitalocean.com/products/paperspace/machines/details/features/index.html.md#custom-templates) are templates of your machines and their configurations. You can use these custom templates to [create new machines](https://docs.digitalocean.com/products/paperspace/machines/how-to/create/index.html.md) with your specifications. You can create or delete custom templates using the [Paperspace console](https://console.paperspace.com), [Paperspace API](https://docs.digitalocean.com/reference/paperspace/api-reference/index.html.md), or [Paperspace CLI](https://docs.digitalocean.com/reference/paperspace/pspace/index.html.md). Before creating a custom template, [take a snapshot of your machine](https://docs.digitalocean.com/products/paperspace/machines/how-to/manage-snapshots/index.html.md) to use as a backup. You can revert to this backup in case your machine malfunctions or disconnects from Paperspace during the custom template process. **Note**: To create custom templates of machines created before August 2022, you need to [connect to the machine](https://docs.digitalocean.com/products/paperspace/machines/how-to/connect/index.html.md), open a terminal, and run the `/usr/local/bin/paperspace-create-template.sh` script to prepare the machine for template creation. After running the script, the machine becomes unusable, and you can follow the rest of the regular process for creating a custom template. ## Create a Custom Template Before you create a custom template, you must [turn off your machine](https://docs.digitalocean.com/products/paperspace/machines/getting-started/quickstart/index.html.md#shutdown-or-restart-machines). Optionally, on machines created after August 2022, you can run the `/usr/local/bin/paperspace-create-template.sh` script to clean up customization and command history. ### Using the Paperspace Console To create a custom template, go to the [Paperspace console](https://console.paperspace.com), in the top-left corner, click the drop-down menu, select **CORE**, click **Machines** tab, then find and select the machine you want to create a custom template of. On the machine’s overview page, click the **Templates** tab to go to the **Templates** page. In the **Create a Template** section, click **CREATE TEMPLATE**. In the window that opens, optionally customize the template’s name, and click **CREATE TEMPLATE** to start the creation process. When the custom template is ready, you can view it on the **Templates** page in the **Templates** section. ### Using the Paperspace API When creating a custom template using the Paperspace API, you need to provide the following values: - `name` (string): The name of the custom template. - `machineId` (string): The ID of the machine you want to create a template of. ## How to Create a Custom Template Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a POST request to `https://api.paperspace.com/v1/custom-templates`. ```bash curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "name": "your-template-name", "machineId": "psm9u09bwu5i" }' \ "https://api.paperspace.com/v1/custom-templates" ``` ### Using the Paperspace CLI When creating a custom template using the Paperspace CLI, you need to provide the following values: - `name` (string): The name of the custom template. - `machine-id` (string): The ID of the machine you want to create a template of. ## How to Create a Custom Template Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace template create -F [flags]`. ```bash pspace template create -F --name your-template-name --machine-id psm9u09bwu5i ``` ## Delete a Custom Template ### Using the Paperspace Console To delete a custom template, go to the [Paperspace console](https://console.paperspace.com), in the top-left corner, click the drop-down menu, select **CORE**, click **Templates** tab. In the **Templates** page, find the template you want to delete. In the template you want to delete, in the top-right corner, click **…**, click **Delete**. ### Using the Paperspace API When deleting a custom template using the Paperspace API, you need to provide the ID of the custom template you want to delete. ## How to Delete a Custom Template Using the Paperspace API 1. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use. 2. Send a DELETE request to `https://api.paperspace.com/v1/custom-templates/{template-id}`. ```bash curl -X DELETE \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $PAPERSPACE_API_KEY" \ -d '{ "id": "tx98gvxz" }' \ "https://api.paperspace.com/v1/custom-templates/tx98gvxz" ``` ### Using the Paperspace CLI When deleting a custom template using the Paperspace CLI, you need to provide the ID of the custom template you want to delete. ## How to Delete a Custom Template Using the Paperspace CLI 1. [Install `pspace`](https://docs.digitalocean.com/reference/paperspace/pspace/install/index.html.md), the Paperspace command-line tool. 2. [Create an API key to authenticate your requests to your Paperspace account](https://docs.digitalocean.com/reference/paperspace/api-keys/index.html.md) and save it for use with `pspace`. 3. Use the API key to grant `pspace` access to your Paperspace account. ```bash pspace login --api-key your-api-key ``` 4. Finally, run `pspace template delete `. ```bash pspace template delete tx98gvxz ```