> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openlayer.com/llms.txt
> Use this file to discover all available pages before exploring further.

# List data source users

> Get aggregated user data for a data source (formerly known as "inference pipeline")



## OpenAPI

````yaml post /inference-pipelines/{inferencePipelineId}/users
openapi: 3.0.3
info:
  contact:
    email: support@openlayer.com
    name: Openlayer
    url: https://openlayer.com/
  description: API for interacting with the Openlayer server.
  title: Openlayer API
  version: '1.0'
  x-logo:
    url: https://logo.clearbit.com/openlayer.com
servers:
  - url: https://api.openlayer.com/v1
    description: Our prod backend
security:
  - bearerAuth: []
paths:
  /inference-pipelines/{inferencePipelineId}/users:
    post:
      tags:
        - Monitoring
      description: >
        Get aggregated user data for an inference pipeline with pagination and
        metadata.


        Returns a list of users who have interacted with the inference pipeline,
        including

        their activity statistics such as session counts, record counts, token
        usage, and costs.
      parameters:
        - $ref: '#/components/parameters/inferencePipelineId'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/perPage'
        - name: sortColumn
          in: query
          description: Name of the column to sort on
          required: false
          schema:
            type: string
        - name: asc
          in: query
          description: Whether or not to sort on the sortColumn in ascending order.
          required: false
          schema:
            type: boolean
            default: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DatasetFilter'
      responses:
        '200':
          description: Response OK.
          content:
            application/json:
              schema:
                type: object
                required:
                  - items
                properties:
                  items:
                    type: array
                    items:
                      $ref: '#/components/schemas/UserAggregation'
                    description: Array of user aggregation data
        '202':
          description: Request accepted, data is being loaded.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
        default:
          $ref: '#/components/responses/UnexpectedError'
      x-codeSamples:
        - lang: python
          source: |
            import os
            from openlayer import Openlayer

            client = Openlayer(
                api_key=os.environ.get("OPENLAYER_API_KEY"),
            )
            response = client.inference_pipelines.retrieve_users(
                inference_pipeline_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(response.items)
        - lang: typescript
          source: |
            import Openlayer from 'openlayer';

            const client = new Openlayer({
              apiKey: process.env['OPENLAYER_API_KEY'],
            });

            const response = await client.inferencePipelines.retrieveUsers(
              '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            );

            console.log(response.items);
        - lang: go
          source: |
            package main

            import (
              "context"
              "fmt"

              "github.com/openlayer-ai/openlayer-go"
              "github.com/openlayer-ai/openlayer-go/option"
            )

            func main() {
              client := openlayer.NewClient(
                option.WithAPIKey("My API Key"),
              )
              response, err := client.InferencePipelines.GetUsers(
                context.TODO(),
                "182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                openlayer.InferencePipelineGetUsersParams{},
              )
              if err != nil {
                panic(err.Error())
              }
              fmt.Printf("%+v\n", response.Items)
            }
        - lang: java
          source: >
            package com.openlayer.api.example;


            import com.openlayer.api.client.OpenlayerClient;

            import com.openlayer.api.client.okhttp.OpenlayerOkHttpClient;

            import
            com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveUsersParams;

            import
            com.openlayer.api.models.inferencepipelines.InferencePipelineRetrieveUsersResponse;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    OpenlayerClient client = OpenlayerOkHttpClient.fromEnv();

                    InferencePipelineRetrieveUsersResponse response = client.inferencePipelines().retrieveUsers("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e");
                }
            }
        - lang: ruby
          source: >
            require "openlayer"


            openlayer = Openlayer::Client.new(api_key: "My API Key")


            response =
            openlayer.inference_pipelines.retrieve_users("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")


            puts(response)
        - lang: curl
          source: |
            curl --request POST \
              --url https://api.openlayer.com/v1/inference-pipelines/{inferencePipelineId}/users \
              --header 'Authorization: Bearer <token>' \
              --header 'Content-Type: application/json' \
              --data '{}'
components:
  parameters:
    inferencePipelineId:
      name: inferencePipelineId
      in: path
      description: The inference pipeline id (a UUID).
      required: true
      schema:
        type: string
        format: uuid
    page:
      name: page
      in: query
      description: The page to return in a paginated query.
      schema:
        type: integer
        minimum: 1
        default: 1
    perPage:
      name: perPage
      in: query
      description: Maximum number of items to return per page.
      schema:
        type: integer
        minimum: 1
        maximum: 100
        default: 25
  schemas:
    DatasetFilter:
      type: object
      nullable: true
      properties:
        columnFilters:
          type: array
          nullable: true
          maxItems: 5
          items:
            oneOf:
              - title: SetColumnFilter
                type: object
                example:
                  measurement: openlayer_token_set
                  operator: contains_none
                  value:
                    - cat
                required:
                  - measurement
                  - operator
                  - value
                properties:
                  measurement:
                    type: string
                    description: The name of the column.
                  operator:
                    type: string
                    enum:
                      - contains_none
                      - contains_any
                      - contains_all
                      - one_of
                      - none_of
                  value:
                    type: array
                    items:
                      oneOf:
                        - type: string
                        - type: number
              - title: NumericColumnFilter
                type: object
                example:
                  measurement: Age
                  operator: '>='
                  value: 25
                required:
                  - measurement
                  - operator
                  - value
                properties:
                  measurement:
                    type: string
                    description: The name of the column.
                  operator:
                    type: string
                    enum:
                      - '>'
                      - '>='
                      - is
                      - <
                      - <=
                      - '!='
                  value:
                    type: number
                    format: float
                    nullable: true
                    example: 0.93
              - title: StringColumnFilter
                type: object
                example:
                  measurement: Geography
                  operator: is
                  value: Germany
                required:
                  - measurement
                  - operator
                  - value
                properties:
                  measurement:
                    type: string
                    description: The name of the column.
                  operator:
                    type: string
                    enum:
                      - is
                      - '!='
                  value:
                    oneOf:
                      - type: string
                        example: Germany
                      - type: boolean
        searchQueryOr:
          type: array
          items:
            type: string
            maxLength: 300
          nullable: true
        searchQueryAnd:
          type: array
          items:
            type: string
            maxLength: 300
          nullable: true
        notSearchQueryOr:
          type: array
          items:
            type: string
            maxLength: 300
          nullable: true
        notSearchQueryAnd:
          type: array
          items:
            type: string
            maxLength: 300
          nullable: true
        rowIdList:
          type: array
          nullable: true
          items:
            type: integer
        excludeRowIdList:
          type: array
          nullable: true
          items:
            type: integer
    UserAggregation:
      type: object
      required:
        - id
        - dateOfFirstRecord
        - dateOfLastRecord
        - sessions
        - records
        - tokens
        - cost
      properties:
        id:
          type: string
          description: The unique user identifier
          example: user123
        dateOfFirstRecord:
          type: string
          format: date-time
          description: Timestamp of the user's first event/trace
          example: '2021-12-31T08:00:00Z'
        dateOfLastRecord:
          type: string
          format: date-time
          description: Timestamp of the user's last event/trace
          example: '2022-01-02T08:00:00Z'
        sessions:
          type: integer
          description: Count of unique sessions for this user
          example: 3
        records:
          type: integer
          description: Total number of traces/rows for this user
          example: 15
        tokens:
          type: number
          format: float
          description: Total token count for this user
          example: 5250
        cost:
          type: number
          format: float
          description: Total cost for this user
          example: 0.125
  responses:
    UnexpectedError:
      description: Unexpected error.
      content:
        application/json:
          schema:
            type: object
            required:
              - code
              - error
            properties:
              code:
                type: integer
                format: int32
              error:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >
        Bearer authentication header of the form `Bearer <token>`, where
        `<token>` is your workspace API key. See [Find your API
        key](https://www.openlayer.com/docs/workspace-and-projects/find-your-api-key)
        for more information.

````