> ## 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 all metrics for a user

> Get a single user's progress against all active metrics.



## OpenAPI

````yaml https://api.trophy.so/v1/openapi get /users/{id}/metrics
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}/metrics:
    servers:
      - url: https://api.trophy.so/v1
        description: Application API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    get:
      tags:
        - Users
      summary: Get all metrics for a user
      description: Get a single user's progress against all active metrics.
      operationId: users_all_metrics
      parameters:
        - name: id
          in: path
          description: ID of the user
          required: true
          schema:
            type: string
          example: userId
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MetricResponse'
              examples:
                Successful operation:
                  value:
                    - id: d01dcbcb-d51e-4c12-b054-dc811dcdc623
                      key: words-written
                      name: Words written
                      current: 4500
                      achievements:
                        - id: abe3120f-5ca9-4344-92c8-5b891643a04b
                          trigger: metric
                          name: Novice Writer
                          description: 'null'
                          metricId: d01dcbcb-d51e-4c12-b054-dc811dcdc623
                          metricValue: 500
                          achievedAt: '2021-01-01T00:00:00Z'
                          badgeUrl: https://example.com/badge1.png
                        - id: 8a07f2d0-9c72-4de1-bf92-9530ae82b4b6
                          trigger: metric
                          name: Intermediate Writer
                          description: 'null'
                          metricId: d01dcbcb-d51e-4c12-b054-dc811dcdc623
                          metricValue: 1000
                          achievedAt: '2021-01-02T00:00:00Z'
                          badgeUrl: https://example.com/badge2.png
                        - id: 2090d038-aa04-4048-ab2e-e2b7bf2d3b9f
                          trigger: metric
                          name: Expert Writer
                          description: 'null'
                          metricId: d01dcbcb-d51e-4c12-b054-dc811dcdc623
                          metricValue: 2000
                          achievedAt: null
                          badgeUrl: 'null'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '404':
          description: User 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.allMetrics("user-id");
        - lang: python
          source: |
            from trophy import TrophyApi

            client = TrophyApi(api_key='YOUR_API_KEY')

            response = client.users.all_metrics("user-id")
        - lang: go
          source: |
            import (
              "context"

              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.AllMetrics(context.TODO(), "user-id")
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:
    MetricResponse:
      title: MetricResponse
      type: object
      properties:
        id:
          type: string
          description: The unique ID of the metric.
          example: d01dcbcb-d51e-4c12-b054-dc811dcdc623
        key:
          type: string
          description: The unique key of the metric.
          example: words-written
        name:
          type: string
          description: The name of the metric.
          example: Words written
        current:
          type: number
          format: double
          description: The user's current total for the metric.
          example: 1500
        achievements:
          type: array
          items:
            $ref: '#/components/schemas/UserAchievementResponse'
          description: >-
            A list of the metric's achievements and the user's progress towards
            each.
      required:
        - id
        - key
        - name
        - current
        - achievements
    ErrorBody:
      title: ErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
    UserAchievementResponse:
      title: UserAchievementResponse
      type: object
      allOf:
        - $ref: '#/components/schemas/AchievementResponse'
        - type: object
          properties:
            achievedAt:
              type:
                - string
                - 'null'
              format: date-time
              description: >-
                The date and time the achievement was completed, in ISO 8601
                format. Null if the achievement has not been completed.
          required:
            - achievedAt
    AchievementResponse:
      title: AchievementResponse
      type: object
      properties:
        id:
          type: string
          description: The unique ID of the achievement.
        name:
          type: string
          description: The name of this achievement.
        trigger:
          type: string
          enum:
            - metric
            - streak
            - api
            - achievement
          description: The trigger of the achievement.
        description:
          type:
            - string
            - 'null'
          description: The description of this achievement.
        badgeUrl:
          type:
            - string
            - 'null'
          description: >-
            The URL of the badge image for the achievement, if one has been
            uploaded.
        key:
          type: string
          description: >-
            The key used to reference this achievement in the API (only
            applicable if trigger = 'api')
        streakLength:
          type: integer
          description: >-
            The length of the streak required to complete the achievement (only
            applicable if trigger = 'streak')
        achievementIds:
          type: array
          items:
            type: string
          description: >-
            The IDs of the prerequisite achievements that must be completed to
            earn this achievement (only applicable if trigger = 'achievement')
        metricId:
          type: string
          description: >-
            The ID of the metric associated with this achievement (only
            applicable if trigger = 'metric')
        metricValue:
          type: number
          format: double
          description: >-
            The value of the metric required to complete the achievement (only
            applicable if trigger = 'metric')
        metricName:
          type: string
          description: >-
            The name of the metric associated with this achievement (only
            applicable if trigger = 'metric')
        userAttributes:
          type: array
          description: >-
            User attribute filters that must be met for this achievement to be
            completed.
          items:
            type: object
            properties:
              key:
                type: string
                description: The key of the user attribute.
                example: plan-type
              value:
                type: string
                description: The value of the user attribute.
                example: premium
            required:
              - key
              - value
        eventAttribute:
          type: object
          description: >-
            Deprecated. Event attribute filter that must be met for this
            achievement to be completed. Only present if the achievement 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 value of the event attribute.
              example: mobile-app
          required:
            - key
            - value
        eventAttributes:
          type: array
          description: >-
            Event attribute filters that must be met for this achievement to be
            completed. Omitted for non-metric achievements.
          items:
            type: object
            properties:
              key:
                type: string
                description: The key of the event attribute.
                example: source
              value:
                type: string
                description: The value of the event attribute.
                example: mobile-app
            required:
              - key
              - value
      required:
        - id
        - name
        - trigger
        - description
        - badgeUrl
        - userAttributes
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````