Langfuse Sessions API

The Sessions API from Langfuse — 2 operation(s) for sessions.

OpenAPI Specification

langfuse-sessions-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: langfuse AnnotationQueues Sessions API
  version: ''
  description: '## Authentication


    Authenticate with the API using [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication), get API keys in the project settings:


    - username: Langfuse Public Key

    - password: Langfuse Secret Key


    ## Exports


    - OpenAPI spec: https://cloud.langfuse.com/generated/api/openapi.yml'
tags:
- name: Sessions
paths:
  /api/public/sessions:
    get:
      description: Get sessions
      operationId: sessions_list
      tags:
      - Sessions
      parameters:
      - name: page
        in: query
        description: Page number, starts at 1
        required: false
        schema:
          type: integer
          nullable: true
      - name: limit
        in: query
        description: Limit of items per page. If you encounter api issues due to too large page sizes, try to reduce the limit.
        required: false
        schema:
          type: integer
          nullable: true
      - name: fromTimestamp
        in: query
        description: Optional filter to only include sessions created on or after a certain datetime (ISO 8601)
        required: false
        schema:
          type: string
          format: date-time
          nullable: true
      - name: toTimestamp
        in: query
        description: Optional filter to only include sessions created before a certain datetime (ISO 8601)
        required: false
        schema:
          type: string
          format: date-time
          nullable: true
      - name: environment
        in: query
        description: Optional filter for sessions where the environment is one of the provided values.
        required: false
        schema:
          type: array
          items:
            type: string
            nullable: true
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PaginatedSessions'
        '400':
          description: ''
          content:
            application/json:
              schema: {}
        '401':
          description: ''
          content:
            application/json:
              schema: {}
        '403':
          description: ''
          content:
            application/json:
              schema: {}
        '404':
          description: ''
          content:
            application/json:
              schema: {}
        '405':
          description: ''
          content:
            application/json:
              schema: {}
      security:
      - BasicAuth: []
  /api/public/sessions/{sessionId}:
    get:
      description: Get a session. Please note that `traces` on this endpoint are not paginated, if you plan to fetch large sessions, consider `GET /api/public/traces?sessionId=<sessionId>`
      operationId: sessions_get
      tags:
      - Sessions
      parameters:
      - name: sessionId
        in: path
        description: The unique id of a session
        required: true
        schema:
          type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionWithTraces'
        '400':
          description: ''
          content:
            application/json:
              schema: {}
        '401':
          description: ''
          content:
            application/json:
              schema: {}
        '403':
          description: ''
          content:
            application/json:
              schema: {}
        '404':
          description: ''
          content:
            application/json:
              schema: {}
        '405':
          description: ''
          content:
            application/json:
              schema: {}
      security:
      - BasicAuth: []
components:
  schemas:
    utilsMetaResponse:
      title: utilsMetaResponse
      type: object
      properties:
        page:
          type: integer
          description: current page number
        limit:
          type: integer
          description: number of items per page
        totalItems:
          type: integer
          description: number of total items given the current filters/selection (if any)
        totalPages:
          type: integer
          description: number of total pages given the current limit
      required:
      - page
      - limit
      - totalItems
      - totalPages
    PaginatedSessions:
      title: PaginatedSessions
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/Session'
        meta:
          $ref: '#/components/schemas/utilsMetaResponse'
      required:
      - data
      - meta
    Trace:
      title: Trace
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of a trace
        timestamp:
          type: string
          format: date-time
          description: The timestamp when the trace was created
        name:
          type: string
          nullable: true
          description: The name of the trace
        input:
          nullable: true
          description: The input data of the trace. Can be any JSON.
        output:
          nullable: true
          description: The output data of the trace. Can be any JSON.
        sessionId:
          type: string
          nullable: true
          description: The session identifier associated with the trace
        release:
          type: string
          nullable: true
          description: The release version of the application when the trace was created
        version:
          type: string
          nullable: true
          description: The version of the trace
        userId:
          type: string
          nullable: true
          description: The user identifier associated with the trace
        metadata:
          nullable: true
          description: The metadata associated with the trace. Can be any JSON.
        tags:
          type: array
          items:
            type: string
          description: The tags associated with the trace.
        public:
          type: boolean
          description: Public traces are accessible via url without login
        environment:
          type: string
          description: The environment from which this trace originated. Can be any lowercase alphanumeric string with hyphens and underscores that does not start with 'langfuse'.
      required:
      - id
      - timestamp
      - tags
      - public
      - environment
    SessionWithTraces:
      title: SessionWithTraces
      type: object
      properties:
        traces:
          type: array
          items:
            $ref: '#/components/schemas/Trace'
      required:
      - traces
      allOf:
      - $ref: '#/components/schemas/Session'
    Session:
      title: Session
      type: object
      properties:
        id:
          type: string
        createdAt:
          type: string
          format: date-time
        projectId:
          type: string
        environment:
          type: string
          description: The environment from which this session originated.
      required:
      - id
      - createdAt
      - projectId
      - environment
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic