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

# List Sessions



## OpenAPI

````yaml /api-v2.json get /agents/{agent_id}/sessions
openapi: 3.1.0
info:
  title: Meibel AI API
  summary: Meibel Gateway Service
  description: >-
    Our API allows you to interact with our services. Read the
    [docs](https://docs.meibel.ai) to learn how to use it.
  version: 0.6.4
servers:
  - url: https://api.meibel.ai/v2
    description: Meibel API (v2)
  - url: https://api.dev.meibel.ai/v2
    description: Meibel Dev API (v2)
  - url: http://localhost:8000/v2
    description: Local Development
security: []
tags:
  - name: Datasources
    description: v2 datasource management
  - name: Data Elements
    description: v2 data element CRUD and search
  - name: File Upload
    description: Upload files to a datasource and track upload progress
  - name: Ingest
    description: Trigger and monitor datasource ingestion
  - name: Datasource Downloads
    description: Export all datasource content as a zip archive
  - name: Table Descriptions
    description: v2 table and column descriptions
  - name: Metadata Model Catalog
    description: v2 metadata model catalog
  - name: Confidence Scoring
    description: v2 confidence scoring jobs and summaries
  - name: Documents
    description: Parse and transform documents into structured data
  - name: Agents
    description: Agent definition management
  - name: Sessions
    description: Agent session (execution) management and chat
  - name: Artifact Schemas
    description: Agent artifact schema management
paths:
  /agents/{agent_id}/sessions:
    get:
      tags:
        - Agents
      summary: List Sessions
      operationId: listSessions
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
        - name: offset
          in: query
          required: false
          schema:
            type: integer
            minimum: 0
            description: Number of items to skip
            default: 0
            title: Offset
          description: Number of items to skip
        - name: limit
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
                minimum: 1
              - type: 'null'
            description: Maximum number of items to return
            title: Limit
          description: Maximum number of items to return
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            description: 'Field to sort by: start_time, status'
            default: start_time
            title: Sort By
          description: 'Field to sort by: start_time, status'
        - name: sort_order
          in: query
          required: false
          schema:
            type: string
            pattern: ^(asc|desc)$
            description: 'Sort order: asc or desc'
            default: desc
            title: Sort Order
          description: 'Sort order: asc or desc'
        - name: status
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              Filter by execution status: RUNNING, COMPLETED, FAILED, CANCELED,
              TERMINATED
            title: Status
          description: >-
            Filter by execution status: RUNNING, COMPLETED, FAILED, CANCELED,
            TERMINATED
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionListResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          label: Python
          source: |-
            from meibel import MeibelClient

            client = MeibelClient(api_key="your-api-key")

            # Pagination - iterate over all items
            for item in client.agents.sessions.list("agent_id_value"):
                print(item)
        - lang: TypeScript
          label: TypeScript
          source: >-
            import { MeibelClient } from 'meibel';


            const client = new MeibelClient({ apiKey: 'your-api-key' });


            // Pagination - iterate over all items

            for await (const item of
            client.agents.sessions.list('agent_id_value')) {
              console.log(item);
            }
        - lang: Go
          label: Go
          source: |-
            import v2 "github.com/meibel-ai/meibel-go/v2"

            client := v2.NewClient(v2.WithAPIKey("your-api-key"))
            ctx := context.Background()

            // Pagination - iterate over all items
            iter := client.Agents.Sessions.List(ctx, "agent_id_value")
            for iter.Next(ctx) {
                item := iter.Item()
                fmt.Println(item)
            }
            if err := iter.Err(); err != nil {
                log.Fatal(err)
            }
components:
  schemas:
    SessionListResponse:
      properties:
        data:
          items:
            $ref: '#/components/schemas/SessionSummary'
          type: array
          title: Data
        total:
          type: integer
          title: Total
      type: object
      required:
        - data
        - total
      title: SessionListResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SessionSummary:
      properties:
        session_id:
          type: string
          title: Session Id
        status:
          type: string
          title: Status
        start_time:
          type: string
          format: date-time
          title: Start Time
        end_time:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End Time
        agent_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Name
        agent_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Version
        messages_count:
          type: integer
          title: Messages Count
          default: 0
        token_usage:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Token Usage
        result:
          items:
            additionalProperties: true
            type: object
          type: array
          title: Result
          default: []
      type: object
      required:
        - session_id
        - status
        - start_time
      title: SessionSummary
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Meibel-API-Key

````