> ## 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.

# Assign distribution details to a leaderboard config

> Assign distribution details to a leaderboard config.



## OpenAPI

````yaml /openapi/admin.json post /leaderboards/{leaderboardConfigId}/distribution
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:
  /leaderboards/{leaderboardConfigId}/distribution:
    post:
      tags:
        - Leaderboard
      summary: Assign distribution details to a leaderboard config
      description: Assign distribution details to a leaderboard config.
      operationId: assignDistributionDetailsForLeaderboardConfig
      parameters:
        - in: path
          name: leaderboardConfigId
          description: The id of the leaderboard config
          schema:
            type: string
            description: The id of the leaderboard config
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                rewards:
                  type: array
                  items:
                    type: object
                    properties:
                      pointsToDistribute:
                        type: number
                        minimum: 0
                        description: The amount of points to distribute.
                      bonusXpToDistribute:
                        type: number
                        minimum: 0
                        description: The amount of bonus xp to distribute
                      rewardsConfig:
                        type: object
                        properties:
                          mechanism:
                            type: string
                            enum:
                              - all
                              - priority
                              - random
                              - select
                            description: The mechanism used to distribute the rewards
                          amountToDistribute:
                            type: number
                            minimum: 0
                            description: >-
                              The number of different reward allocations to
                              select from the allocations array. For example, if
                              there are 5 allocations but amountToDistribute is
                              2, only 2 of those 5 allocations will be selected
                              based on the specified mechanism (all, priority or
                              random).
                          allocations:
                            type: array
                            items:
                              type: object
                              properties:
                                id:
                                  type: string
                                  description: The ID of this allocation
                                allocationType:
                                  type: string
                                  enum:
                                    - assets
                                    - entries
                                  description: >-
                                    The type of allocation, either assets or
                                    entries. If the reward has a type of
                                    assets-and-entries, this allocation can have
                                    both assets and entries. Otherwise, it can
                                    only have one type matching the reward's
                                    allocation type.
                                supply:
                                  anyOf:
                                    - type: number
                                      minimum: 0
                                    - type: string
                                      const: Infinity
                                  description: >-
                                    The total supply of this allocation. Only
                                    used if isSharedAssetsSupply or
                                    isSharedEntriesSupply is false on the
                                    reward.
                                amountToDistribute:
                                  type: number
                                  minimum: 1
                                  description: >-
                                    The quantity of this specific reward to
                                    distribute when this allocation is selected.
                                    For example, if amountToDistribute is 3,
                                    then 3 units of this reward will be given to
                                    the recipient.
                                distributed:
                                  type: number
                                  minimum: 0
                                  description: >-
                                    The amount already distributed for this
                                    allocation
                                isLive:
                                  type: boolean
                                  description: Whether this allocation is live
                                rewardId:
                                  type: string
                                  description: >-
                                    The id of the reward the allocation relates
                                    to.
                              required:
                                - id
                                - allocationType
                                - supply
                                - amountToDistribute
                                - distributed
                                - isLive
                                - rewardId
                            description: >-
                              The reward allocations to distribute. If any of
                              the allocations are new, the id field should be
                              null. If any of the allocations are updates to
                              existing allocations, the id field should be the
                              id of the allocation to update. If an existing
                              allocation is not included in the array, it will
                              be removed from the distribution event.
                        required:
                          - mechanism
                          - amountToDistribute
                          - allocations
                      startRank:
                        type: number
                        description: The start rank of the reward distribution
                      endRank:
                        type: number
                        description: The end rank of the reward distribution
                    required:
                      - pointsToDistribute
                      - bonusXpToDistribute
                      - rewardsConfig
                      - startRank
                      - endRank
              required:
                - rewards
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  leaderboardConfigId:
                    type: string
                    description: >-
                      The id of the leaderboard config with assigned
                      distribution details
                  rewards:
                    type: array
                    items:
                      type: object
                      properties:
                        pointsToDistribute:
                          type: number
                          minimum: 0
                          description: The amount of points to distribute.
                        bonusXpToDistribute:
                          type: number
                          minimum: 0
                          description: The amount of bonus xp to distribute
                        rewardsConfig:
                          type: object
                          properties:
                            mechanism:
                              type: string
                              enum:
                                - all
                                - priority
                                - random
                                - select
                              description: The mechanism used to distribute the rewards
                            amountToDistribute:
                              type: number
                              minimum: 0
                              description: >-
                                The number of different reward allocations to
                                select from the allocations array. For example,
                                if there are 5 allocations but
                                amountToDistribute is 2, only 2 of those 5
                                allocations will be selected based on the
                                specified mechanism (all, priority or random).
                            allocations:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    description: The ID of this allocation
                                  allocationType:
                                    type: string
                                    enum:
                                      - assets
                                      - entries
                                    description: >-
                                      The type of allocation, either assets or
                                      entries. If the reward has a type of
                                      assets-and-entries, this allocation can
                                      have both assets and entries. Otherwise,
                                      it can only have one type matching the
                                      reward's allocation type.
                                  supply:
                                    anyOf:
                                      - type: number
                                        minimum: 0
                                      - type: string
                                        const: Infinity
                                    description: >-
                                      The total supply of this allocation. Only
                                      used if isSharedAssetsSupply or
                                      isSharedEntriesSupply is false on the
                                      reward.
                                  amountToDistribute:
                                    type: number
                                    minimum: 1
                                    description: >-
                                      The quantity of this specific reward to
                                      distribute when this allocation is
                                      selected. For example, if
                                      amountToDistribute is 3, then 3 units of
                                      this reward will be given to the
                                      recipient.
                                  distributed:
                                    type: number
                                    minimum: 0
                                    description: >-
                                      The amount already distributed for this
                                      allocation
                                  isLive:
                                    type: boolean
                                    description: Whether this allocation is live
                                  rewardId:
                                    type: string
                                    description: >-
                                      The id of the reward the allocation
                                      relates to.
                                required:
                                  - id
                                  - allocationType
                                  - supply
                                  - amountToDistribute
                                  - distributed
                                  - isLive
                                  - rewardId
                              description: >-
                                The reward allocations to distribute. If any of
                                the allocations are new, the id field should be
                                null. If any of the allocations are updates to
                                existing allocations, the id field should be the
                                id of the allocation to update. If an existing
                                allocation is not included in the array, it will
                                be removed from the distribution event.
                          required:
                            - mechanism
                            - amountToDistribute
                            - allocations
                        startRank:
                          type: number
                          minimum: 1
                          description: The start rank of the reward distribution
                        endRank:
                          type: number
                          minimum: 1
                          description: The end rank of the reward distribution
                      required:
                        - pointsToDistribute
                        - bonusXpToDistribute
                        - rewardsConfig
                        - startRank
                        - endRank
                required:
                  - leaderboardConfigId
                  - rewards
        '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:
    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

````