# Create and Edit Templates

The Templates API allows you to create a new template within a specified portal. You can also provide a template ID to create a copy of an existing template or a product ID to build a template out of an existing product.

#### Use [POST Create template](https://developer.smartbear.com/portal/default/swaggerhub-portal-api#/Templates/createTemplate) to create a new template in your Portal. Below is a sample `cURL` request 

### Sample Request

```text
curl -X POST "https://api.portal.swaggerhub.com/v1/portals/<PORTAL-ID>/templates" -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR-SWAGGER-APIKEY>" -d '{
    "type": "new",
    "name": "API Template",
    "slug": "api-template",
    "productDescription": "Description of the API template",
    "notes": "Additional notes about the template",
    "default": false
}'
```

## Edit Template

You can update the details of a specific template using the [PATCH Patch template](https://developer.smartbear.com/portal/default/swaggerhub-portal-api#/Templates/patchTemplate). Only the properties specified will be modified.

### Sample Request

```text
curl -X PATCH "https://api.portal.swaggerhub.com/v1/templates/<TEMPLATE-ID>" -H "Content-Type: application/json" -H "Authorization: Bearer <YOUR-SWAGGER-APIKEY>" -d '{
    "name": "Updated API Template",
    "notes": "Updated notes about the template",
    "productDescription": "Description of the API template",
    "default": true
}'
```
