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

# List sessions

> List and search sessions, including active or archived sessions, with repository, project, creator, and source filters and cursor pagination.



## OpenAPI

````yaml https://api.tembo.io/public-api/openapi/public get /v1/sessions
openapi: 3.1.0
info:
  title: Tembo Public API
  description: >-
    Manage agents, sessions, repositories, and organization resources with the
    Tembo API.
  version: 1.0.0
servers:
  - url: https://api.tembo.io
    description: Tembo API
  - url: https://{deployment-origin}/api/public-api
    description: Self-hosted Tembo
    variables:
      deployment-origin:
        default: tembo.example.com
        description: Hostname of your self-hosted Tembo deployment
security: []
paths:
  /v1/sessions:
    get:
      tags:
        - Sessions
      summary: List sessions
      description: >-
        List and search sessions, including active or archived sessions, with
        repository, project, creator, and source filters and cursor pagination.
      operationId: listSessions
      parameters:
        - in: query
          name: agentId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: Filter sessions created by this automation agent.
        - in: query
          name: createdBy
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by creator IDs, supplied as a comma-separated list.
        - in: query
          name: createdAfter
          schema:
            type: string
            format: date-time
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
          description: Only sessions created after this ISO 8601 timestamp.
        - in: query
          name: cursor
          schema:
            type: string
            maxLength: 500
          description: >-
            Continuation cursor from the previous response nextCursor. Omit for
            the first page; null nextCursor means there are no more pages.
        - in: query
          name: limit
          schema:
            default: 50
            type: integer
            minimum: 1
            maximum: 100
          description: >-
            Maximum number of items to return in one page. Use nextCursor from
            the response to fetch more items.
        - in: query
          name: excludePinned
          schema:
            type: boolean
          description: Exclude sessions pinned by the authenticated user.
        - in: query
          name: excludeTeamId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            Exclude sessions shared with this team. Requires
            organization:team:read.
        - in: query
          name: externalIds
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by external source IDs, supplied as a comma-separated list.
        - in: query
          name: folderId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            Only sessions in this sidebar folder of the authenticated user.
            Takes precedence over inFolder.
        - in: query
          name: hasProject
          schema:
            type: boolean
          description: Filter by whether a session has an assigned project.
        - in: query
          name: includeArchived
          schema:
            default: true
            type: boolean
          description: >-
            Include archived sessions in the all-state view. Defaults to true;
            state=archived explicitly selects archived sessions.
        - in: query
          name: includeTotal
          schema:
            default: false
            type: boolean
          description: Include totalCount. Not supported with state=active.
        - in: query
          name: inFolder
          schema:
            type: boolean
          description: >-
            Filter by whether a session is in one of the authenticated user's
            sidebar folders.
        - in: query
          name: parentSessionId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: Filter sessions created by this session.
        - in: query
          name: participant
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by participant IDs, supplied as a comma-separated list.
        - in: query
          name: pendingReviewerKeys
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by pending reviewer keys, supplied as a comma-separated list.
        - in: query
          name: projectIds
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by project IDs, supplied as a comma-separated list.
        - in: query
          name: pullRequestStatuses
          schema:
            default: []
            type: array
            items:
              type: string
              enum:
                - open
                - merged
                - closed
          description: >-
            Filter by linked pull request statuses: open, merged, or closed,
            supplied as a comma-separated list.
        - in: query
          name: repositoryIds
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by repository IDs, supplied as a comma-separated list.
        - in: query
          name: search
          schema:
            type: string
            minLength: 1
            maxLength: 1000
          description: >-
            Search session titles, task prompts, kinds, and source names or
            types.
        - in: query
          name: sortBy
          schema:
            default: lastQueuedAt
            type: string
            enum:
              - lastQueuedAt
              - createdAt
              - updatedAt
          description: Timestamp used to sort sessions, newest first.
        - in: query
          name: sourceIds
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by session source IDs, supplied as a comma-separated list.
        - in: query
          name: sourceTypes
          schema:
            default: []
            type: array
            items:
              type: string
              minLength: 1
          description: Filter by session source types, supplied as a comma-separated list.
        - in: query
          name: state
          schema:
            default: all
            type: string
            enum:
              - all
              - active
              - archived
          description: >-
            Select all sessions, currently active work, or archived sessions.
            Use archived to find sessions to restore.
        - in: query
          name: teamId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          description: >-
            Only sessions shared with this team. Requires
            organization:team:read.
      responses:
        '200':
          description: List sessions
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        agent:
                          type:
                            - string
                            - 'null'
                        agentId:
                          anyOf:
                            - type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            - type: 'null'
                        createdAt:
                          type: string
                          format: date-time
                          pattern: >-
                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                        externalId:
                          type:
                            - string
                            - 'null'
                        id:
                          type: string
                          format: uuid
                          pattern: >-
                            ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                        kind:
                          type: string
                        lastQueuedAt:
                          anyOf:
                            - type: string
                              format: date-time
                              pattern: >-
                                ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                            - type: 'null'
                        lastSeenAt:
                          type: string
                          format: date-time
                          pattern: >-
                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                        level:
                          type: integer
                          minimum: -9007199254740991
                          maximum: 9007199254740991
                        projectId:
                          type:
                            - string
                            - 'null'
                        title:
                          type: string
                        updatedAt:
                          type: string
                          format: date-time
                          pattern: >-
                            ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z))$
                        visibility:
                          type: string
                          enum:
                            - private
                            - public
                          description: >-
                            Deprecated: `private` when shared with no one,
                            `public` when shared with anyone. List the session’s
                            shares for its exact audiences.
                          deprecated: true
                        artifacts:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                                format: uuid
                                pattern: >-
                                  ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                              pullRequests:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    agent:
                                      type:
                                        - string
                                        - 'null'
                                    codeRepository:
                                      anyOf:
                                        - type: object
                                          properties:
                                            id:
                                              type: string
                                              format: uuid
                                              pattern: >-
                                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                            provider:
                                              type: string
                                          required:
                                            - id
                                            - provider
                                          additionalProperties: false
                                        - type: 'null'
                                    id:
                                      type: string
                                      format: uuid
                                      pattern: >-
                                        ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                    isDraft:
                                      type: boolean
                                    status:
                                      type: string
                                      enum:
                                        - open
                                        - merged
                                        - closed
                                    url:
                                      type: string
                                      format: uri
                                  required:
                                    - agent
                                    - codeRepository
                                    - id
                                    - isDraft
                                    - status
                                    - url
                                  additionalProperties: false
                              type:
                                type: string
                                enum:
                                  - PullRequest
                                  - ToolCall
                                  - Plan
                                  - Response
                                  - File
                                  - Service
                                  - Source
                            required:
                              - id
                              - pullRequests
                              - type
                            additionalProperties: false
                        diffSummary:
                          anyOf:
                            - type: object
                              properties:
                                additions:
                                  type: integer
                                  minimum: -9007199254740991
                                  maximum: 9007199254740991
                                deletions:
                                  type: integer
                                  minimum: -9007199254740991
                                  maximum: 9007199254740991
                              required:
                                - additions
                                - deletions
                              additionalProperties: false
                            - type: 'null'
                        folderId:
                          anyOf:
                            - type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            - type: 'null'
                          description: >-
                            Sidebar folder the authenticated user filed this
                            session in.
                        isPinned:
                          type: boolean
                        project:
                          anyOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                  pattern: >-
                                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                name:
                                  type: string
                                icon:
                                  type: string
                                  enum:
                                    - folder
                                    - code
                                    - terminal
                                    - book
                                    - brain
                                    - bug
                                    - building
                                    - cloud
                                    - globe
                                    - idea
                                    - tools
                                    - magic
                                    - processor
                                    - sandbox
                                    - server
                                    - tasks
                                    - tactics
                                    - images
                                    - database
                                    - api
                                    - mobile
                                    - package
                                color:
                                  type: string
                                  enum:
                                    - neutral
                                    - red
                                    - orange
                                    - yellow
                                    - green
                                    - teal
                                    - blue
                                    - purple
                                    - pink
                              required:
                                - id
                                - name
                                - icon
                                - color
                              additionalProperties: false
                            - type: 'null'
                        sessionSource:
                          type: object
                          properties:
                            id:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                            name:
                              type: string
                            type:
                              type: string
                            repositories:
                              type: array
                              items:
                                type: object
                                properties:
                                  id:
                                    type: string
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                required:
                                  - id
                                additionalProperties: false
                          required:
                            - id
                            - name
                            - type
                            - repositories
                          additionalProperties: false
                        sourcePullRequest:
                          anyOf:
                            - type: object
                              properties:
                                id:
                                  type: string
                                  format: uuid
                                  pattern: >-
                                    ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                                url:
                                  type: string
                                  format: uri
                                title:
                                  type:
                                    - string
                                    - 'null'
                                status:
                                  type: string
                                  enum:
                                    - open
                                    - merged
                                    - closed
                                isDraft:
                                  type: boolean
                              required:
                                - id
                                - url
                                - title
                                - status
                                - isDraft
                              additionalProperties: false
                            - type: 'null'
                        state:
                          type: object
                          properties:
                            current:
                              type: string
                              enum:
                                - inProgress
                                - queued
                                - completed
                                - failed
                                - cancelled
                            isQueued:
                              type: boolean
                            isCancelled:
                              type: boolean
                            isCompleted:
                              type: boolean
                            isFailed:
                              type: boolean
                            inProgress:
                              type: boolean
                          required:
                            - isQueued
                            - isCancelled
                            - isCompleted
                            - isFailed
                            - inProgress
                          additionalProperties: false
                      required:
                        - agent
                        - agentId
                        - createdAt
                        - externalId
                        - id
                        - kind
                        - lastQueuedAt
                        - lastSeenAt
                        - level
                        - projectId
                        - title
                        - updatedAt
                        - visibility
                        - artifacts
                        - diffSummary
                        - folderId
                        - isPinned
                        - project
                        - sessionSource
                        - sourcePullRequest
                        - state
                      additionalProperties: false
                  nextCursor:
                    type:
                      - string
                      - 'null'
                  totalCount:
                    type: integer
                    minimum: 0
                    maximum: 9007199254740991
                required:
                  - items
                  - nextCursor
                additionalProperties: false
        '400':
          description: >-
            Invalid request or missing required organization or user
            information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '401':
          description: The session is private
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '403':
          description: The caller is not permitted to perform this operation
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '404':
          description: Session resource not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '409':
          description: Session operation conflicts with existing data
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: Session operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '502':
          description: Session runtime or provider operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
      security:
        - apiKey: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: |
            import Tembo from '@tembo-io/sdk';

            const client = new Tembo();

            const session = await client.sessions.list({
              limit: 50,
              includeArchived: true,
              includeTotal: false,
              sortBy: 'lastQueuedAt',
              state: 'all',
            });
        - lang: rust
          label: Rust SDK
          source: |
            use tembo_rs::*;

            let client = Tembo::from_env()?;

            let response = client.sessions().list().send().await?;
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.