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

# Create a new entity from a template

> Create a new entity (community, challenge, achievement, action, post, or reward) from an existing template.



## OpenAPI

````yaml /openapi/admin.json post /templates/create-entity
openapi: 3.1.0
info:
  title: Nudj Admin API
  version: 1.0.0
servers:
  - url: https://{subdomain}.nudj.cx/api/v2/admin
    description: Organization API Server
    variables:
      subdomain:
        description: Your organization's subdomain (required)
        default: your-org
security:
  - ApiToken: []
paths:
  /templates/create-entity:
    post:
      tags:
        - Templates
      summary: Create a new entity from a template
      description: >-
        Create a new entity (community, challenge, achievement, action, post, or
        reward) from an existing template.
      operationId: createEntityFromTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                templateId:
                  type: string
                  description: The ID of the template entity to copy from
                  example: 60f1b3b3b3b3b3b3b3b3b3b3
                entityType:
                  type: string
                  enum:
                    - achievement
                    - action
                    - challenge
                    - community
                    - post
                    - reward
                  description: The type of entity to create
                  example: challenge
                communityId:
                  type: string
                  default: ''
                  description: The ID of the community where the entity will be created
                  example: 60f1b3b3b3b3b3b3b3b3b3b3
              required:
                - templateId
                - entityType
              description: The input required to create an entity from a template
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateEntityFromTemplateResponse'
        '400':
          description: Invalid input data
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.BAD_REQUEST'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error.INTERNAL_SERVER_ERROR'
components:
  schemas:
    CreateEntityFromTemplateResponse:
      description: >-
        The created entity from the template. Returns the appropriate admin
        schema based on entityType with an additional entityType field for
        discrimination.
    error.BAD_REQUEST:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Invalid input data
        code:
          type: string
          description: The error code
          example: BAD_REQUEST
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: BAD_REQUEST
        message: Invalid input data
        issues: []
    error.INTERNAL_SERVER_ERROR:
      type: object
      properties:
        message:
          type: string
          description: The error message
          example: Internal server error
        code:
          type: string
          description: The error code
          example: INTERNAL_SERVER_ERROR
        issues:
          type: array
          items:
            type: object
            properties:
              message:
                type: string
            required:
              - message
          description: An array of issues that were responsible for the error
          example: []
      required:
        - message
        - code
      title: Error
      description: The error information
      example:
        code: INTERNAL_SERVER_ERROR
        message: Internal server error
        issues: []
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: x-api-token

````