# Create template (/docs/api-reference/templates/create-template)

<!-- agent-signals: reading_time_min: 3 · est_tokens: 2002 · updated: 2026-07-30 -->
Related: [Create template (v3)](/docs/api-reference/templates/create-template-v3.md), [List templates (v2)](/docs/api-reference/templates/list-templates-v2.md), [Create template (v2)](/docs/api-reference/templates/create-template-v2.md), [Get build upload link](/docs/api-reference/templates/get-build-upload-link.md), [List templates](/docs/api-reference/templates/list-templates.md), [Get template](/docs/api-reference/templates/get-template.md)

# Create template

`POST /templates`

> Deprecated

Create a new template

## OpenAPI

```json
{
  "security": [
    {
      "AccessTokenAuth": []
    }
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "required": [
            "dockerfile"
          ],
          "properties": {
            "alias": {
              "description": "Alias of the template",
              "type": "string"
            },
            "dockerfile": {
              "description": "Dockerfile for the template",
              "type": "string"
            },
            "teamID": {
              "type": "string",
              "description": "Identifier of the team"
            },
            "startCmd": {
              "description": "Start command to execute in the template after the build",
              "type": "string"
            },
            "readyCmd": {
              "description": "Ready check command to execute in the template after the build",
              "type": "string"
            },
            "cpuCount": {
              "type": "integer",
              "format": "int32",
              "minimum": 1,
              "description": "CPU cores for the sandbox"
            },
            "memoryMB": {
              "type": "integer",
              "format": "int32",
              "minimum": 128,
              "description": "Memory for the sandbox in MiB"
            }
          },
          "type": "object"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "The build was accepted",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "templateID",
              "buildID",
              "cpuCount",
              "memoryMB",
              "diskSizeMB",
              "public",
              "createdAt",
              "updatedAt",
              "createdBy",
              "lastSpawnedAt",
              "spawnCount",
              "buildCount",
              "envdVersion",
              "aliases"
            ],
            "properties": {
              "templateID": {
                "type": "string",
                "description": "Identifier of the template"
              },
              "buildID": {
                "type": "string",
                "description": "Identifier of the last successful build for given template"
              },
              "cpuCount": {
                "type": "integer",
                "format": "int32",
                "minimum": 1,
                "description": "CPU cores for the sandbox"
              },
              "memoryMB": {
                "type": "integer",
                "format": "int32",
                "minimum": 128,
                "description": "Memory for the sandbox in MiB"
              },
              "diskSizeMB": {
                "type": "integer",
                "format": "int32",
                "minimum": 0,
                "description": "Disk size for the sandbox in MiB"
              },
              "public": {
                "type": "boolean",
                "description": "Whether the template is public or only accessible by the team"
              },
              "aliases": {
                "type": "array",
                "description": "Aliases of the template",
                "items": {
                  "type": "string"
                }
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "Time when the template was created"
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "description": "Time when the template was last updated"
              },
              "createdBy": {
                "oneOf": [
                  {
                    "required": [
                      "id",
                      "email"
                    ],
                    "properties": {
                      "id": {
                        "type": "string",
                        "format": "uuid",
                        "description": "Identifier of the user"
                      },
                      "email": {
                        "type": [
                          "string",
                          "null"
                        ],
                        "deprecated": true,
                        "default": null,
                        "description": "Email of the user"
                      }
                    },
                    "type": "object"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "lastSpawnedAt": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time",
                "description": "Time when the template was last used"
              },
              "spawnCount": {
                "type": "integer",
                "format": "int64",
                "description": "Number of times the template was used"
              },
              "buildCount": {
                "type": "integer",
                "format": "int32",
                "description": "Number of times the template was built"
              },
              "envdVersion": {
                "type": "string",
                "description": "Version of the envd running in the sandbox"
              },
              "names": {
                "type": "array",
                "description": "Names of the template (namespace/alias format when namespaced)",
                "items": {
                  "type": "string"
                }
              },
              "buildStatus": {
                "type": "string",
                "description": "Status of the template build",
                "enum": [
                  "building",
                  "waiting",
                  "ready",
                  "error",
                  "uploaded"
                ]
              }
            },
            "type": "object"
          }
        }
      }
    },
    "400": {
      "description": "Bad request",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "401": {
      "description": "Authentication error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "500": {
      "description": "Server error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    }
  }
}
```
