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 are templates of your machines and their configurations. You can use these custom templates to create new machines with your specifications. You can create or delete custom templates using the Paperspace console, Paperspace API, or Paperspace CLI.

Before creating a custom template, take a snapshot of your machine 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, 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. 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, in the top-left corner, click the dropdown 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.

The Templates page of the machine with a Create Template option.

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 and save it for use.

  2. Send a POST request to https://api.paperspace.com/v1/custom-templates.

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, the Paperspace command-line tool.

  2. Create an API key to authenticate your requests to your Paperspace account and save it for use with pspace.

  3. Use the API key to grant pspace access to your Paperspace account.

pspace login --api-key your-api-key
  1. Finally, run pspace template create -F [flags].
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, in the top-left corner, click the dropdown 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 and save it for use.

  2. Send a DELETE request to https://api.paperspace.com/v1/custom-templates/{template-id}.

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, the Paperspace command-line tool.

  2. Create an API key to authenticate your requests to your Paperspace account and save it for use with pspace.

  3. Use the API key to grant pspace access to your Paperspace account.

pspace login --api-key your-api-key
  1. Finally, run pspace template delete <template-id>.
pspace template delete tx98gvxz