> ## 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 challenge group

> Create a new challenge group.



## OpenAPI

````yaml /openapi/admin.json post /challenge-groups
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:
  /challenge-groups:
    post:
      tags:
        - Challenge Group
      summary: Create a new challenge group
      description: Create a new challenge group.
      operationId: trpcCreateChallengeGroup
      parameters:
        - in: header
          name: x-language
          description: >-
            The language to update the challenge group in. This will update the
            challenge group's content for the specified language.
          schema:
            type: string
            description: >-
              The language to update the challenge group in. This will update
              the challenge group's content for the specified language.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                communityId:
                  type: string
                  pattern: ^[0-9a-fA-F]{24}$
                  description: The id of the community the challenge group belongs to
                details:
                  $ref: '#/components/schemas/DetailsCreateInput'
                status:
                  type: string
                  enum:
                    - archived
                    - draft
                    - expired
                    - live
                    - scheduled
                  description: >-
                    Set the challenge group status, by default will be set to
                    draft if not provided
                type:
                  type: string
                  enum:
                    - random
                    - sequential
                  description: The challenge selection type
                period:
                  type: string
                  enum:
                    - daily
                    - weekly
                    - monthly
                    - yearly
                    - open
                  description: The rotation period
                challengeIds:
                  type: array
                  items:
                    type: string
                    pattern: ^[0-9a-fA-F]{24}$
                  description: The challenge IDs in this group
                activeAmount:
                  type: number
                  minimum: 1
                  description: Number of active challenges to show
              required:
                - communityId
                - details
              description: The input required to create a challenge group
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChallengeGroup'
        '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:
    DetailsCreateInput:
      type: object
      properties:
        title:
          type: string
          description: The title of the entity
        description:
          type:
            - string
            - 'null'
          description: The description of the entity
        light:
          type: object
          properties:
            primaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the primary image for this theme mode
            secondaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the secondary image for this theme mode
          description: Light theme images
        dark:
          type: object
          properties:
            primaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the primary image for this theme mode
            secondaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the secondary image for this theme mode
          description: Dark theme images
      required:
        - title
      description: Input for creating entity details with required title
      title: Details Create Input
    ChallengeGroup:
      type: object
      properties:
        id:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the challenge group
        organisationId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the organisation the challenge group belongs to
        communityId:
          type: string
          pattern: ^[0-9a-fA-F]{24}$
          description: The id of the community the challenge group belongs to
        details:
          $ref: '#/components/schemas/Details'
        type:
          type: string
          enum:
            - random
            - sequential
          description: The challenge selection type
        period:
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - yearly
            - open
          description: The rotation period
        challengeIds:
          type: array
          items:
            type: string
            pattern: ^[0-9a-fA-F]{24}$
          description: The challenge IDs in this group
        activeAmount:
          type: number
          minimum: 1
          description: Number of active challenges to show
        status:
          type: string
          enum:
            - archived
            - draft
            - expired
            - live
            - scheduled
          description: The challenge group status
        createdAt:
          type: string
          description: The creation date of the challenge group
        updatedAt:
          type:
            - string
            - 'null'
          description: The update date of the challenge group
      required:
        - id
        - organisationId
        - communityId
        - details
        - type
        - period
        - challengeIds
        - activeAmount
        - status
        - createdAt
      description: A challenge group
      title: Challenge Group
    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: []
    Details:
      type: object
      properties:
        title:
          type: string
          description: The title of the entity
        description:
          type:
            - string
            - 'null'
          description: The description of the entity
        light:
          type: object
          properties:
            primaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the primary image for this theme mode
            secondaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the secondary image for this theme mode
          required:
            - primaryImageUrl
            - secondaryImageUrl
          description: Light theme images
        dark:
          type: object
          properties:
            primaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the primary image for this theme mode
            secondaryImageUrl:
              type:
                - string
                - 'null'
              description: The url of the secondary image for this theme mode
          required:
            - primaryImageUrl
            - secondaryImageUrl
          description: Dark theme images
      required:
        - title
        - description
        - light
        - dark
      description: Used to describe an entity
      title: Details
  securitySchemes:
    ApiToken:
      type: apiKey
      in: header
      name: x-api-token

````