> ## 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 streak status

> Get a user's streak data.



## OpenAPI

````yaml https://api.trophy.so/v1/openapi get /users/{id}/streak
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}/streak:
    servers:
      - url: https://api.trophy.so/v1
        description: Application API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    get:
      tags:
        - Users
      summary: Get a user's streak status
      description: Get a user's streak data.
      operationId: users_streak
      parameters:
        - name: id
          in: path
          description: ID of the user.
          required: true
          schema:
            type: string
          example: userId
        - in: query
          name: historyPeriods
          schema:
            type: integer
            default: 7
          description: >-
            The number of past streak periods to include in the streakHistory
            field of the  response.
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StreakResponse'
              examples:
                Successful operation:
                  value:
                    length: 1
                    frequency: weekly
                    started: '2025-04-02'
                    periodStart: '2025-03-31'
                    periodEnd: '2025-04-05'
                    expires: '2025-04-12'
                    extended: '2025-04-03T14:30:00Z'
                    streakHistory:
                      - periodStart: '2025-03-30'
                        periodEnd: '2025-04-05'
                        length: 1
                      - periodStart: '2025-04-06'
                        periodEnd: '2025-04-12'
                        length: 2
                      - periodStart: '2025-04-13'
                        periodEnd: '2025-04-19'
                        length: 3
                      - periodStart: '2025-04-20'
                        periodEnd: '2025-04-26'
                        length: 0
                      - periodStart: '2025-04-27'
                        periodEnd: '2025-05-03'
                        length: 1
                      - periodStart: '2025-05-04'
                        periodEnd: '2025-05-10'
                        length: 2
                      - periodStart: '2025-05-11'
                        periodEnd: '2025-05-17'
                        length: 3
        '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.streak("user-id", {
              historyPeriods: 14
            });
        - lang: python
          source: |
            from trophy import TrophyApi

            client = TrophyApi(api_key='YOUR_API_KEY')

            response = client.users.streak(id="user-id", history_periods=14)
        - 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.Streak(
              context.TODO(),
              "user-id",
              &api.UsersStreakRequest{},
            )
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:
    StreakResponse:
      title: Streak Response
      type: object
      description: An object representing the user's streak.
      allOf:
        - $ref: '#/components/schemas/BaseStreakResponse'
        - type: object
          properties:
            extended:
              type:
                - string
                - 'null'
              format: date-time
              description: >-
                The timestamp the streak was most recently extended. Null if the
                streak is not active.
            streakHistory:
              type: array
              description: >-
                A list of the user's past streak periods up through the current
                period. Each period includes the start and end dates and the
                length of the streak.
              items:
                type: object
                description: An object representing a past streak period.
                properties:
                  periodStart:
                    type: string
                    format: date
                    description: The date this streak period started.
                    example: '2025-03-31'
                  periodEnd:
                    type: string
                    format: date
                    description: The date this streak period ended.
                    example: '2025-04-05'
                  length:
                    type: integer
                    description: The length of the user's streak during this period.
                    example: 1
                  usedFreeze:
                    type: boolean
                    description: >-
                      Whether the user used a streak freeze during this period.
                      Only present if the organization has enabled streak
                      freezes.
                    example: false
                required:
                  - periodStart
                  - periodEnd
                  - length
          required:
            - extended
            - streakHistory
    ErrorBody:
      title: ErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
    BaseStreakResponse:
      title: Base Streak Response
      type: object
      properties:
        length:
          type: integer
          description: The length of the user's current streak.
        frequency:
          $ref: '#/components/schemas/StreakFrequency'
          description: The frequency of the streak.
        started:
          type:
            - string
            - 'null'
          format: date
          description: The date the streak started.
        periodStart:
          type:
            - string
            - 'null'
          format: date
          description: The start date of the current streak period.
        periodEnd:
          type:
            - string
            - 'null'
          format: date
          description: The end date of the current streak period.
        expires:
          type:
            - string
            - 'null'
          format: date
          description: >-
            The date the streak will expire if the user does not increment a
            metric.
        freezes:
          type: integer
          description: >-
            The number of available streak freezes. Only present if the
            organization has enabled streak freezes.
        maxFreezes:
          type: integer
          description: >-
            The maximum number of streak freezes a user can have. Only present
            if the organization has enabled streak freezes.
        freezeAutoEarnInterval:
          type: integer
          description: >-
            The interval at which the user will earn streak freezes, in days.
            Only present if the organization has enabled streak freeze
            auto-earn.
        freezeAutoEarnAmount:
          type: integer
          description: >-
            The amount of streak freezes the user will earn per interval. Only
            present if the organization has enabled streak freeze auto-earn.
      required:
        - length
        - frequency
        - started
        - periodStart
        - periodEnd
        - expires
    StreakFrequency:
      title: StreakFrequency
      type: string
      enum:
        - daily
        - weekly
        - monthly
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````