> ## 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 the streak lengths of a list of users

> Get the streak lengths of a list of users, ranked by streak length from longest to shortest.



## OpenAPI

````yaml https://api.trophy.so/v1/openapi get /streaks
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:
  /streaks:
    servers:
      - url: https://api.trophy.so/v1
        description: Application API
    parameters:
      - $ref: '#/components/parameters/TenantId'
    get:
      tags:
        - Streaks
      summary: Get the streak lengths of a list of users
      description: >-
        Get the streak lengths of a list of users, ranked by streak length from
        longest to shortest.
      operationId: streaks_list
      parameters:
        - name: userIds
          in: query
          description: A list of up to 100 user IDs.
          required: true
          schema:
            type: array
            items:
              type: string
          example: user-123,user-456,user-789
      responses:
        '200':
          description: Successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BulkStreakResponse'
              examples:
                Successful operation:
                  value:
                    - userId: user-123
                      streakLength: 15
                      extended: '2025-01-01T05:03:00Z'
                    - userId: user-456
                      streakLength: 12
                      extended: '2025-01-01T08:43:00Z'
                    - userId: user-789
                      streakLength: 0
                      extended: null
        '401':
          description: Unauthorized
          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 response = await trophy.streaks.list({
              userIds: ['user-123', 'user-456', 'user-789']
            });
        - lang: python
          source: >
            from trophy import TrophyApi


            client = TrophyApi(api_key='YOUR_API_KEY')


            response = client.streaks.list(user_ids=["user-123", "user-456",
            "user-789"])
        - 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.Streaks.List(
              context.TODO(),
              &api.StreaksListRequest{
                UserIds: []*string{api.String("user-123"), api.String("user-456"), api.String("user-789")},
              },
            )
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:
    BulkStreakResponse:
      title: Bulk Streak Response
      type: array
      items:
        properties:
          userId:
            type: string
            description: The ID of the user.
          streakLength:
            type: integer
            description: The length of the user's streak.
          extended:
            type:
              - string
              - 'null'
            description: >-
              The timestamp the streak was extended, as a string. Null if the
              streak is not active.
        required:
          - userId
          - streakLength
          - extended
    ErrorBody:
      title: ErrorBody
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````