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

# Create points levels

> Create points levels. Maximum 100 levels per request.



## OpenAPI

````yaml https://admin.trophy.so/v1/openapi post /points/{systemId}/levels
openapi: 3.1.0
info:
  title: Trophy
  version: 1.19.0
servers:
  - x-fern-server-name: Admin API
    url: https://admin.trophy.so/v1
    description: Admin API
security: []
paths:
  /points/{systemId}/levels:
    servers:
      - url: https://admin.trophy.so/v1
        description: Admin API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    post:
      tags:
        - Admin
      summary: Create points levels
      description: Create points levels. Maximum 100 levels per request.
      operationId: admin_points_levels_create
      parameters:
        - name: systemId
          in: path
          description: The UUID of the points system.
          required: true
          schema:
            type: string
            format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
      requestBody:
        description: Array of levels to create. Maximum 100 levels per request.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePointsLevelsRequest'
      responses:
        '200':
          description: Successful operation (no levels created)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePointsLevelsResponse'
              examples:
                No levels created:
                  value:
                    created: []
                    issues:
                      - index: 0
                        severity: error
                        message: Key already in use by another level
        '201':
          description: Created (at least one level created)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatePointsLevelsResponse'
              examples:
                Created successfully:
                  value:
                    created:
                      - id: 550e8400-e29b-41d4-a716-446655440000
                        name: Bronze
                        key: bronze
                        points: 100
                        description: Starting level
                        badge:
                          url: https://example.com/bronze.png
                    issues: []
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminErrorBody'
        '404':
          description: Not Found (points system not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminErrorBody'
        '422':
          description: Unprocessible Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AdminErrorBody'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: javascript
          source: >
            import { TrophyApiClient } from '@trophyso/node';


            const trophy = new TrophyApiClient({
              apiKey: 'YOUR_API_KEY'
            });


            const result = await
            trophy.admin.points.levels.create('system-uuid', [
              {
                name: 'Bronze',
                key: 'bronze',
                points: 100,
                description: 'Starting level',
                badge: { url: 'https://example.com/bronze.png' }
              }
            ]);
        - lang: python
          source: |
            from trophy import TrophyApi

            client = TrophyApi(api_key='YOUR_API_KEY')

            result = client.admin.points.levels.create(
              system_id='system-uuid',
              request=[{
                "name": "Bronze",
                "key": "bronze",
                "points": 100,
                "description": "Starting level",
                "badge": {"url": "https://example.com/bronze.png"}
              }]
            )
        - lang: go
          source: >
            import (
              "context"

              api "github.com/trophyso/trophy-go"
              trophyclient "github.com/trophyso/trophy-go/client"
              "github.com/trophyso/trophy-go/option"
            )


            client := trophyclient.NewClient(
              option.WithApiKey("YOUR_API_KEY"),
            )


            response, err := client.Admin.Points.Levels.Create(context.TODO(),
            "system-uuid", api.CreatePointsLevelsRequest{})
components:
  parameters:
    TenantId:
      name: Tenant-ID
      in: header
      description: >-
        The tenant identifier for multi-tenant organisations. Required when the
        organisation has multi-tenancy enabled. Pass your own internal customer
        ID for the tenant. Ignored for single-tenant organisations.
      required: false
      schema:
        type: string
      example: customer_12345
  schemas:
    CreatePointsLevelsRequest:
      title: CreatePointsLevelsRequest
      type: array
      description: Array of points levels to create. Maximum 100 levels per request.
      items:
        $ref: '#/components/schemas/CreatePointsLevelRequestItem'
      maxItems: 100
      minItems: 1
    CreatePointsLevelsResponse:
      title: CreatePointsLevelsResponse
      type: object
      description: Response containing created levels and any per-item issues.
      properties:
        created:
          type: array
          items:
            $ref: '#/components/schemas/AdminPointsLevel'
          description: Array of successfully created levels.
        issues:
          type: array
          items:
            $ref: '#/components/schemas/AdminIssue'
          description: Array of issues encountered during level creation.
      required:
        - created
        - issues
    AdminErrorBody:
      title: AdminErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
    CreatePointsLevelRequestItem:
      title: CreatePointsLevelRequestItem
      type: object
      description: A points level to create.
      properties:
        name:
          type: string
          description: The name of the level.
          example: Bronze
        key:
          type: string
          description: >-
            A unique key for the level. Only alphanumeric characters, hyphens,
            and underscores are permitted.
          pattern: ^[a-zA-Z\d-_]+$
          example: bronze
        points:
          type: integer
          minimum: 0
          description: The threshold points value for the level.
          example: 100
        description:
          type: string
          description: An optional description of the level.
          example: Starting level
        badge:
          type: object
          description: An optional badge for the level.
          properties:
            url:
              type: string
              description: The URL of the badge image.
              example: https://example.com/bronze.png
          required:
            - url
      required:
        - name
        - key
        - points
    AdminPointsLevel:
      title: AdminPointsLevel
      type: object
      description: A points level as returned from admin endpoints.
      properties:
        id:
          type: string
          format: uuid
          description: The UUID of the level.
        name:
          type: string
          description: The name of the level.
        key:
          type: string
          description: The level key.
        points:
          type: integer
          description: The threshold points value for the level.
        description:
          type: string
          description: The level description.
        badge:
          oneOf:
            - type: object
              properties:
                url:
                  type: string
                  description: The URL of the badge image.
              required:
                - url
            - type: 'null'
          description: The badge for the level, or null if no badge is set.
      required:
        - id
        - name
        - key
        - points
        - description
        - badge
    AdminIssue:
      title: AdminIssue
      type: object
      description: An issue encountered while processing an item in an admin API request.
      properties:
        id:
          type: string
          description: The ID of the resource the issue relates to, when applicable.
          example: 550e8400-e29b-41d4-a716-446655440000
        userId:
          type: string
          description: The ID of the user the issue relates to, when applicable.
          example: user-123
        boostId:
          type: string
          description: The ID of the points boost the issue relates to, when applicable.
          example: 550e8400-e29b-41d4-a716-446655440000
        index:
          type: integer
          description: >-
            The zero-based index of the item the issue relates to, when no
            resource ID exists yet.
          example: 0
        severity:
          type: string
          enum:
            - error
            - warning
          description: The severity level of the issue.
          example: warning
        message:
          type: string
          description: A human-readable description of the issue.
          example: Would exceed maximum freeze limit
      required:
        - severity
        - message
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````