> ## Documentation Index
> Fetch the complete documentation index at: https://apidocs.royalti.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Template

> **POST /defaultsettings/templates**

## Description

**POST /defaultsettings/templates**

**Description:**
Create a new reusable template for default settings.

**Method:**
`POST`

**Request Body:**

| Parameter   | Type    | Description                       | Required |
| ----------- | ------- | --------------------------------- | -------- |
| name        | string  | Template name                     | Yes      |
| description | string  | Template description              | No       |
| category    | string  | Settings category                 | Yes      |
| entityType  | string  | Target entity type                | Yes      |
| settings    | object  | Template settings                 | Yes      |
| isPublic    | boolean | Public visibility (default: true) | No       |
| tags        | array   | Tags for categorization           | No       |

## Code Examples

<CodeGroup>
  ```javascript Node.js theme={null}
  const response = await fetch('https://api.royalti.io/defaultsettings/templates', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      "name": "sample-name",
      "description": "sample-description",
      "category": "sample-category",
      "entityType": "sample-entityType",
      "isPublic": true,
      "tags": [
        {}
      ]
    })
  });

  const data = await response.json();
  console.log(data);
  ```

  ```python Python theme={null}
  import requests

  response = requests.post(
    'https://api.royalti.io/defaultsettings/templates',
    json={"name":"sample-name","description":"sample-description","category":"sample-category","entityType":"sample-entityType","isPublic":true,"tags":[{}]}
  )

  data = response.json()
  print(data)
  ```

  ```bash cURL theme={null}
  curl -X POST https://api.royalti.io/defaultsettings/templates \
    -H "Content-Type: application/json" \
    -d '{"name":"sample-name","description":"sample-description","category":"sample-category","entityType":"sample-entityType","isPublic":true,"tags":[{}]}'

  ```
</CodeGroup>


## OpenAPI

````yaml post /defaultsettings/templates
openapi: 3.0.0
info:
  title: Royalti.io API
  description: "# Royalti API\r\n\r\nThis is the Royalti music royalty management platform API server.\r\n\r\n## Overview\r\n\r\nThe Royalti API provides comprehensive music royalty management services including:\r\n- Music publishing and writer management\r\n- Royalty processing and analytics\r\n- DDEX integration for music industry standards\r\n- File processing and pattern recognition\r\n- Payment processing and distribution\r\n\r\n## Authentication\r\n\r\nThe API uses JWT-based authentication with multiple protection levels:\r\n- Public endpoints for basic operations\r\n- Protected endpoints requiring valid JWT tokens\r\n- Admin endpoints for administrative functions\r\n\r\n## Features\r\n\r\n- Multi-dimensional royalty analytics\r\n- CWR (Collective Works Registration) support\r\n- DDEX integration for music metadata\r\n- Advanced file processing with pattern recognition\r\n- Real-time data processing with queue system"
  version: 2.6.0
  contact:
    name: Royalti.io Support
    email: support@royalti.io
    url: https://royalti.io
  license:
    name: Proprietary
    url: https://royalti.io/terms
servers:
  - url: https://api.royalti.io
    description: Production server
  - url: https://api-dev.royalti.io
    description: Development server
  - url: http://localhost:8084
    description: Local development
security:
  - bearerAuth: []
tags:
  - name: Accounting
    description: Accounting and financial transaction operations
  - name: DDEX
    description: DDEX operations (ERN/MEAD, messages, delivery, providers)
  - name: Label
    description: Label management operations
  - name: Internal Webhooks
    description: Internal system webhooks for royalty processing and downloads
  - name: Payment Webhooks
    description: Payment processor webhook endpoints
  - name: Billing Webhooks
    description: Stripe billing and subscription webhooks
  - name: Infrastructure Webhooks
    description: Cloudflare domain and SSL webhooks
  - name: Distribution Webhooks
    description: Digital distribution platform webhooks (FUGA)
paths:
  /defaultsettings/templates:
    post:
      tags:
        - Templates
      summary: Create Template
      description: |-
        **POST /defaultsettings/templates**

        **Description:**
        Create a new reusable template for default settings.

        **Method:**
        `POST`

        **Request Body:**

        | Parameter | Type | Description | Required |
        | --- | --- | --- | --- |
        | name | string | Template name | Yes |
        | description | string | Template description | No |
        | category | string | Settings category | Yes |
        | entityType | string | Target entity type | Yes |
        | settings | object | Template settings | Yes |
        | isPublic | boolean | Public visibility (default: true) | No |
        | tags | array | Tags for categorization | No |
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
                - category
                - entityType
                - settings
              properties:
                name:
                  type: string
                  description: Template name
                description:
                  type: string
                  description: Template description
                category:
                  type: string
                  enum:
                    - content
                    - business
                    - ddex
                    - validation
                entityType:
                  type: string
                  enum:
                    - catalog
                    - asset
                    - product
                    - release
                settings:
                  $ref: '#/components/schemas/DefaultSettingsData'
                isPublic:
                  type: boolean
                  default: true
                tags:
                  type: array
                  items:
                    type: string
            example:
              name: Hip-Hop Album Defaults
              description: Standard settings for hip-hop album releases
              category: content
              entityType: release
              settings:
                content:
                  type: Audio
                  format: Album
                  mainGenre:
                    - Hip-Hop
                    - Rap
                  explicit: explicit
                  language: en
              isPublic: true
              tags:
                - hip-hop
                - album
                - explicit
      responses:
        '201':
          description: Template created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: Template created successfully
                  data:
                    $ref: '#/components/schemas/DefaultSettingTemplate'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '409':
          $ref: '#/components/responses/Conflict'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    DefaultSettingsData:
      type: object
      description: The actual settings data organized by category
      properties:
        content:
          type: object
          description: Content-related default settings
          properties:
            type:
              type: string
              enum:
                - Audio
                - Video
                - Ringtone
                - YouTube
              description: Media type
            format:
              type: string
              enum:
                - Single
                - EP
                - Album
                - LP
              description: Release format
            version:
              type: string
              description: Version information (e.g., "Deluxe Edition", "Remastered")
            explicit:
              type: string
              enum:
                - explicit
                - clean
              description: Explicit content flag
            language:
              type: string
              description: Primary language (ISO 639-1 code)
            mainGenre:
              type: array
              items:
                type: string
              description: Primary genre classifications
            subGenre:
              type: array
              items:
                type: string
              description: Secondary genre classifications
            contributors:
              type: object
              additionalProperties:
                type: array
                items:
                  type: string
              description: >-
                Contributors mapped by role (key: role name, value: array of
                contributor names)
        business:
          type: object
          description: Business-related default settings
          properties:
            label:
              type: string
              description: Record label name
            copyright:
              type: string
              description: Copyright notice (e.g., "© 2024 Label Name")
            publisher:
              type: string
              description: Music publisher name
            copyrightOwner:
              type: string
              description: Copyright owner/holder
            distribution:
              type: string
              description: Distribution method or partner
            status:
              type: string
              enum:
                - Live
                - Taken Down
                - Scheduled
                - Pending
                - Error
              description: Default release status
        ddex:
          type: object
          description: DDEX-specific default settings
          properties:
            enableDDEX:
              type: boolean
              description: Enable DDEX message generation
            labelName:
              type: string
              description: Label name for DDEX messages
            resourceReference:
              type: string
              description: Default resource reference pattern
            grid:
              type: string
              description: Global Release Identifier (GRid)
            icpn:
              type: string
              description: International Catalog Product Number
        validation:
          type: object
          description: Validation rules
          properties:
            requireGenre:
              type: boolean
              description: Require genre selection
            requireLyrics:
              type: boolean
              description: Require lyrics for tracks
            requireDescription:
              type: boolean
              description: Require description field
            minimumTrackCount:
              type: integer
              minimum: 0
              description: Minimum number of tracks
            maximumTrackCount:
              type: integer
              minimum: 1
              description: Maximum number of tracks
    DefaultSettingTemplate:
      type: object
      description: A reusable template for default settings
      required:
        - id
        - name
        - category
        - entityType
        - settings
      properties:
        id:
          type: string
          format: uuid
          description: Unique identifier for the template
        name:
          type: string
          description: Template name
        description:
          type: string
          nullable: true
          description: Template description
        category:
          type: string
          enum:
            - content
            - business
            - ddex
            - validation
          description: Category of settings in this template
        entityType:
          type: string
          enum:
            - catalog
            - asset
            - product
            - release
          description: Type of entity this template is designed for
        settings:
          $ref: '#/components/schemas/DefaultSettingsData'
        isPublic:
          type: boolean
          default: true
          description: Whether this template is publicly accessible
        isSystem:
          type: boolean
          default: false
          description: Whether this is a system-provided template
        usageCount:
          type: integer
          default: 0
          description: Number of times this template has been applied
        tags:
          type: array
          items:
            type: string
          description: Tags for categorizing/searching templates
        createdBy:
          type: string
          format: uuid
          nullable: true
          description: User who created this template
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details:
              type: array
              items:
                type: string
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Invalid request parameters
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Unauthorized
    Conflict:
      description: Conflict - Resource already exists or duplicate constraint violation
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            success: false
            error:
              code: CONFLICT
              message: A default setting for this entity and category already exists
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            type: object
            properties:
              status:
                type: string
                example: error
              message:
                type: string
                example: Internal server error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Authorization header using the Bearer scheme. Format: "Bearer
        {token}"

````