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

# Get a user's points data

> Get a user's points for a specific points system.



## OpenAPI

````yaml https://api.trophy.so/v1/openapi get /users/{id}/points/{key}
openapi: 3.1.0
info:
  title: Trophy
  version: 1.19.0
servers:
  - x-fern-server-name: Application API
    url: https://api.trophy.so/v1
    description: Application API
security: []
paths:
  /users/{id}/points/{key}:
    servers:
      - url: https://api.trophy.so/v1
        description: Application API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    get:
      tags:
        - Users
      summary: Get a user's points data
      description: Get a user's points for a specific points system.
      operationId: users_points
      parameters:
        - name: id
          in: path
          description: ID of the user.
          required: true
          schema:
            type: string
          example: userId
        - name: key
          in: path
          description: Key of the points system.
          required: true
          schema:
            type: string
          example: points-system-key
        - in: query
          name: awards
          schema:
            type: integer
            default: 10
            minimum: 1
            maximum: 100
          description: The number of recent point awards to return.
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUserPointsResponse'
              examples:
                Successful operation:
                  value:
                    id: 0040fe51-6bce-4b44-b0ad-bddc4e123534
                    key: xp
                    name: XP
                    description: null
                    badgeUrl: null
                    maxPoints: null
                    total: 100
                    level:
                      id: 1140fe51-6bce-4b44-b0ad-bddc4e123534
                      key: silver
                      name: Silver
                      description: Mid-tier level
                      badgeUrl: null
                      points: 50
                    awards:
                      - id: 0040fe51-6bce-4b44-b0ad-bddc4e123534
                        awarded: 10
                        date: '2021-01-01T00:00:00Z'
                        total: 100
                        trigger:
                          id: 0040fe51-6bce-4b44-b0ad-bddc4e123534
                          type: metric
                          points: 10
                          metricName: words written
                          metricThreshold: 1000
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '422':
          description: Unprocessible Entity
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: javascript
          source: >
            import { TrophyApiClient } from '@trophyso/node';


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


            const response = await trophy.users.points("user-id",
            "points-system-key");
        - lang: python
          source: >
            from trophy import TrophyApi


            client = TrophyApi(api_key='YOUR_API_KEY')


            response = client.users.points(id="user-id",
            key="points-system-key")
        - 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.Users.Points(
              context.TODO(),
              "user-id",
              "points-system-key",
              &api.UsersPointsRequest{},
            )
components:
  parameters:
    TenantId:
      name: Tenant-ID
      in: header
      description: >-
        The tenant identifier for multi-tenant organisations. Required when the
        organisation has multi-tenancy enabled. The value should be your
        internal ID for the tenant. Ignored for single-tenant organisations.
      required: false
      schema:
        type: string
      example: customer_12345
  schemas:
    GetUserPointsResponse:
      title: GetUserPointsResponse
      type: object
      allOf:
        - $ref: '#/components/schemas/PointsResponse'
        - type: object
          properties:
            total:
              type: integer
              description: The user's total points
            level:
              description: >-
                The user's current level in this points system, or null if no
                levels are configured or the user hasn't reached any level yet.
              oneOf:
                - $ref: '#/components/schemas/PointsLevel'
                - type: 'null'
            awards:
              type: array
              description: Array of trigger awards that added points.
              items:
                $ref: '#/components/schemas/PointsAward'
          required:
            - total
            - level
            - awards
    ErrorBody:
      title: ErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
    PointsResponse:
      title: PointsResponse
      type: object
      description: Base points system fields shared across responses.
      properties:
        id:
          type: string
          description: The ID of the points system
        key:
          type: string
          description: The key of the points system
        name:
          type: string
          description: The name of the points system
        description:
          type:
            - string
            - 'null'
          description: The description of the points system
        badgeUrl:
          type:
            - string
            - 'null'
          description: The URL of the badge image for the points system
        maxPoints:
          type:
            - number
            - 'null'
          description: >-
            The maximum number of points a user can be awarded in this points
            system
      required:
        - id
        - key
        - name
        - description
        - badgeUrl
        - maxPoints
    PointsLevel:
      title: PointsLevel
      type: object
      description: A level within a points system.
      properties:
        id:
          type: string
          description: The ID of the level
        key:
          type: string
          description: The unique key of the level
        name:
          type: string
          description: The name of the level
        description:
          type: string
          description: The description of the level
        badgeUrl:
          type:
            - string
            - 'null'
          description: The URL of the badge image for the level
        points:
          type: integer
          description: The points threshold required to reach this level
      required:
        - id
        - key
        - name
        - description
        - badgeUrl
        - points
    PointsAward:
      title: PointsAward
      type: object
      properties:
        id:
          type: string
          description: The ID of the trigger award
        awarded:
          type: integer
          description: The points awarded by this trigger
        date:
          type: string
          description: The date these points were awarded, in ISO 8601 format.
        total:
          type: integer
          description: The user's total points after this award occurred.
        trigger:
          $ref: '#/components/schemas/PointsTrigger'
        boosts:
          type: array
          description: Array of points boosts that applied to this award.
          items:
            $ref: '#/components/schemas/PointsBoost'
    PointsTrigger:
      title: PointsTrigger
      type: object
      properties:
        id:
          type: string
          description: The ID of the trigger
        type:
          type: string
          description: The type of trigger
          enum:
            - metric
            - achievement
            - streak
            - time
            - user_creation
        points:
          type: integer
          description: The points awarded by this trigger.
        status:
          type: string
          enum:
            - active
            - inactive
            - archived
          description: The status of the trigger.
        achievementId:
          type: string
          description: >-
            The unique ID of the achievement associated with this trigger, if
            the trigger is an achievement.
        metricId:
          type: string
          description: >-
            The unique ID of the metric associated with this trigger, if the
            trigger is a metric.
        metricName:
          type: string
          description: If the trigger has type 'metric', the name of the metric
        metricThreshold:
          type: integer
          description: >-
            If the trigger has type 'metric', the threshold of the metric that
            triggers the points
        streakLengthThreshold:
          type: integer
          description: >-
            If the trigger has type 'streak', the threshold of the streak that
            triggers the points
        achievementName:
          type: string
          description: If the trigger has type 'achievement', the name of the achievement
        timeUnit:
          type: string
          enum:
            - hour
            - day
          description: >-
            If the trigger has type 'time', the unit of time after which to
            award points
        timeInterval:
          type: integer
          description: >-
            If the trigger has type 'time', the numer of units of timeUnit after
            which to award points
        userAttributes:
          type: array
          description: >-
            User attribute filters that must be met for this trigger to award
            points. Empty when the trigger has no user attribute filters
            configured.
          items:
            type: object
            properties:
              key:
                type: string
                description: The key of the user attribute.
                example: plan-type
              value:
                type: string
                description: The required value of the user attribute.
                example: premium
            required:
              - key
              - value
        eventAttribute:
          type: object
          description: >-
            Deprecated. Event attribute filter that must be met for this trigger
            to award points. Only present if the trigger has an event filter
            configured.
          deprecated: true
          properties:
            key:
              type: string
              description: The key of the event attribute.
              example: source
            value:
              type: string
              description: The required value of the event attribute.
              example: mobile-app
          required:
            - key
            - value
        eventAttributes:
          type: array
          description: >-
            If the trigger has type 'metric', the event attributes that must
            match for the trigger to award points. Empty when the trigger is
            metric-based and has no event attribute filters. Omitted for
            non-metric triggers.
          items:
            type: object
            properties:
              key:
                type: string
                description: The key of the event attribute.
                example: source
              value:
                type: string
                description: The required value of the event attribute.
                example: mobile-app
            required:
              - key
              - value
        created:
          type: string
          format: date-time
          description: The date and time the trigger was created, in ISO 8601 format.
        updated:
          type: string
          format: date-time
          description: The date and time the trigger was last updated, in ISO 8601 format.
      required:
        - id
        - type
        - points
        - status
        - userAttributes
        - created
        - updated
    PointsBoost:
      title: PointsBoost
      type: object
      properties:
        id:
          type: string
          description: The ID of the points boost
        name:
          type: string
          description: The name of the points boost
        status:
          type: string
          enum:
            - active
            - scheduled
            - finished
          description: The status of the points boost
        start:
          type: string
          description: The start date of the points boost
        end:
          type:
            - string
            - 'null'
          description: The end date of the points boost
        multiplier:
          type: number
          description: The multiplier of the points boost
        rounding:
          type: string
          enum:
            - down
            - up
            - nearest
          description: The rounding method of the points boost
      required:
        - id
        - name
        - status
        - start
        - end
        - multiplier
        - rounding
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````