> ## Documentation Index
> Fetch the complete documentation index at: https://developers.hubspot.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

---
id: 7375dbea-0fa0-45e9-b773-c4b37d0aadbb
---

# Create a new Template

> Create a new coded template object in Design Manager.

export const ScopesList = ({scopes = [], description = "This API requires one of the following scopes:"}) => {
  if (!scopes || scopes.length === 0) {
    return null;
  }
  const sortedScopes = scopes.sort((a, b) => a.localeCompare(b));
  return <div>
      <div className="text-sm mb-2">{description}</div>
      <div>
        {sortedScopes.map((scope, index) => <div key={index}>
            <code>
              <span className="text-xs">{scope}</span>
            </code>
          </div>)}
      </div>
    </div>;
};

<Accordion title="Scope requirements">
  <ScopesList scopes={['content']} />
</Accordion>


## OpenAPI

````yaml specs/legacy/v2/templates-v2.json POST /content/api/v2/templates
openapi: 3.0.1
info:
  title: Templates API
  description: Use the templates API to create and manage CMS templates.
  version: v2
servers:
  - url: https://api.hubapi.com
security: []
tags:
  - name: Templates
paths:
  /content/api/v2/templates:
    post:
      tags:
        - Templates
      summary: Create a new Template
      description: Create a new coded template object in Design Manager.
      operationId: createTemplate
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - category_id
                - folder
                - path
                - source
              properties:
                category_id:
                  type: integer
                  description: >-
                    Template category type: 0=Unmapped, 1=Landing Pages,
                    2=Email, 3=Blog Post, 4=Site Page
                folder:
                  type: string
                  description: >-
                    The name of the folder to save the template in Design
                    Manager
                template_type:
                  type: integer
                  description: >-
                    Template type: 2=Email, 4=Page, 11=Error, 12=Subscription
                    preferences, etc.
                path:
                  type: string
                  description: >-
                    The Design Manager path to the directory that contains the
                    file being created
                source:
                  type: string
                  description: The source code of the file
                is_available_for_new_content:
                  type: boolean
                  description: >-
                    Used to determine if the template should be expected to pass
                    page/content validation
                  default: false
      responses:
        '201':
          description: Template created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
components:
  schemas:
    Template:
      type: object
      properties:
        id:
          type: string
          description: The unique id of the template
        label:
          type: string
          description: The label of the template as it shows up in the template builder
        path:
          type: string
          description: >-
            The path of the template, as should be used for HubL include
            statements
        source:
          type: string
          description: The markup of the template
        category_id:
          type: integer
          description: >-
            The category of content this template can be used for. 1 for landing
            page, 2 for email, 3 for site page
        template_type:
          type: string
          description: The type of template
        folder:
          type: string
          description: The folder this template lives in
        is_available_for_new_content:
          type: boolean
          description: True if this template will show up in the content creation screen
        is_from_layout:
          type: boolean
          description: True if template was generated by publishing a layout
        is_read_only:
          type: boolean
          description: True if the template can only be read
        cdn_url:
          type: string
          description: >-
            For non-HTML templates, the URL to the version of the template that
            has been rendered and uploaded to the HubSpot CDN
        cdn_minified_url:
          type: string
          description: >-
            For JavaScript and CSS, this is the URL of the version of the
            content that has been rendered, minified, and uploaded to our
            Content Delivery Network
        deleted_at:
          type: integer
          description: >-
            When the template was deleted, in milliseconds since the epoch. Zero
            if the template was never deleted.
        generated_from_layout_id:
          type: string
          description: The id of the layout that generated this template
        thumbnail_path:
          type: string
          description: The thumbnail image of the template
        thumbnail_width:
          type: integer
          description: The width of the thumbnail image
        updated:
          type: integer
          description: When the template was last updated, in milliseconds since the epoch
        updated_by:
          type: string
          description: Who last updated the template
        portal_id:
          type: integer
          description: The portal/account ID
        archived:
          type: boolean
          description: >-
            If True, the template will not show up in your dashboard, although
            the template will still be live
        linked_style_id:
          type: string
          description: ID of linked stylesheet
        type:
          type: string
          description: Template type field

````