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

> Lists sessions that you created.

# List sessions

**Example request:**

<CodeGroup>
  ```curl cURL theme={null}
  curl --request GET \
    --url https://ai.data.cloud/api/v2/team/sessions?user_id=tmm-dafasdfasdfasdf  \
    --header 'x-pd-api-key: <api-key>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://ai.data.cloud/api/v2/team/sessions?user_id=tmm-dafasdfasdfasdf"

  headers = {"x-pd-api-key": "<api-key>"}

  response = requests.request("GET", url, headers=headers)

  print(response.text)
  ```
</CodeGroup>

**Example response:**

```json 200 theme={null}
{
  "code": 0,
  "data": {
    "page_number": 1,
    "page_size": 10,
    "total_items": 1,
    "records": [
      {
        "id": "dataset-dasfadsgadsgas",
        "name": "mysql",
        "description": "mysql databases"
      }
    ]
  }
}
```


## OpenAPI

````yaml get /v2/team/sessions
openapi: 3.0.1
info:
  title: Team Open API Snake
  description: ''
  version: 1.0.0
servers:
  - url: https://ai.data.cloud/api
    description: 体验环境
security:
  - apikey-header-x-pd-api-key: []
tags:
  - name: Session
  - name: Dataset
  - name: Data source
  - name: File
  - name: Job
paths:
  /v2/team/sessions:
    get:
      tags:
        - Session
      summary: List sessions
      description: |
        Lists sessions that you created.
      parameters:
        - name: page_number
          in: query
          description: >-
            The page number to start listing. If not specified, the default
            value `1` will be used.
          required: false
          schema:
            type: integer
            default: 1
        - name: page_size
          in: query
          description: >-
            The number of items on a single page. If not specified, the default
            value `10` will be used.
          required: false
          schema:
            type: integer
            default: 10
        - name: search
          in: query
          description: >-
            The search keyword, which can be up to 128 characters in length.
            Sessions with names containing this keyword will be listed. 


            If omitted, all sessions created by you will be listed.
          required: false
          schema:
            type: string
        - name: user_id
          in: query
          description: >-
            Your user ID, which uniquely identifies you within your team. To
            obtain your ID:


            - If you're the team admin, refer to [Check user
            information](/enterprise/users#check-user-information).

            - If you're a system or virtual user, ask your team admin to check
            your user ID by referring to [Check user
            information](/enterprise/users#check-user-information).
          required: true
          schema:
            type: string
        - name: x-pd-external-trace-id
          in: header
          description: >-
            The trace ID you set in your system to trace this request. It can be
            up to 128 characters in length. If the request fails, you can
            provide it to the Powerdrill team to help with troubleshooting.
          required: false
          example: ''
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: integer
                    description: >-
                      Status code. **0** indicates that the operation is
                      successful. Otherwise, the operation fails. For error
                      troubleshooting, refer to [Error
                      Codes](/api-reference/error-codes).
                  data:
                    type: object
                    properties:
                      total_items:
                        type: integer
                        description: The total number of sessions returned in the response.
                      page_number:
                        type: integer
                        description: The page number of the current page.
                      page_size:
                        type: integer
                        description: >-
                          The number of items that are returned in a single
                          page.
                      records:
                        type: array
                        items:
                          type: object
                          properties:
                            id:
                              type: string
                              description: >-
                                The session ID, which uniquely identifies the
                                session in your project.
                            name:
                              type: string
                              description: >-
                                The session name. If it is longer than 128
                                characters, only the first 128 characters will
                                be returned.
                            output_language:
                              type: string
                              enum:
                                - AUTO
                                - EN
                                - ES
                                - AR
                                - PT
                                - ID
                                - JA
                                - RU
                                - HI
                                - FR
                                - DE
                                - VI
                                - TR
                                - PL
                                - IT
                                - KO
                                - ZH-CN
                                - ZH-TW
                              default: AUTO
                              description: >-
                                The language in which the output is generated.
                                Possible values are:

                                - `AUTO`: adaptive recognition

                                - `EN`: English

                                - `ES`: Spanish

                                - `AR`: Arabic

                                - `PT`: Portuguese

                                - `ID`: Indonesian

                                - `JA`: Japanese

                                - `RU`: Russian

                                - `HI`: Hindi

                                - `FR`: French

                                - `DE`: German

                                - `VI`: Vietnamese

                                - `TR`: Turkish

                                - `PL`: Polish

                                - `IT`: Italian

                                - `KO`: Korean

                                - `ZH-CN`: Simplified Chinese

                                - `ZH-TW`: Traditional Chinese
                            job_mode:
                              type: string
                              description: >-
                                Job mode. Possible values are:

                                - `AUTO`: Powerdrill automatically detects your
                                intent and selects the appropriate job mode from
                                data analysis and information retrieval.

                                - `DATA_ANALYTICS`: Powerdrill focuses
                                specifically on data analysis.
                              enum:
                                - AUTO
                                - DATA_ANALYTICS
                              default: DATA_ANALYTICS
                            max_contextual_job_history:
                              type: integer
                              description: >-
                                The maximum number of recent jobs retained as
                                context for your next job run in the session,
                                with a value range from `0` to `10`. The default
                                value is `10`. Value `0` indicates that the jobs
                                run in the session are processed without any
                                context.
                            agent_id:
                              type: string
                              enum:
                                - DATA_ANALYSIS_AGENT
                              default: DATA_ANALYSIS_AGENT
                              description: >-
                                The ID of the agent. A reserved parameter.
                                Ignore it.
                          description: The information about a session.
                          required:
                            - id
                            - name
                        description: A list of sessions returned in a page.
                    required:
                      - total_items
                      - page_number
                      - page_size
                      - records
                    description: A paginated list of sessions.
                required:
                  - data
                  - code
              example:
                code: 0
                data:
                  total_items: 8
                  page_size: 10
                  page_number: 1
                  records:
                    - id: 04b69928-532d-408a-8716-8f5e70fcacc6
                      name: Finding Your Inner Spark
                      output_language: AUTO
                      job_mode: AUTO
                      max_contextual_job_history: 10
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: 7e9941af-ad1b-4834-a421-4b37b54aae19
                      name: session_trade_analyze_001
                      output_language: EN
                      job_mode: AUTO
                      max_contextual_job_history: 1
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: a137ecc8-9554-42c3-b042-2458dd2aeb36
                      name: My first session
                      output_language: AUTO
                      job_mode: AUTO
                      max_contextual_job_history: 10
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: 4440ab38-3df0-465b-a66c-bf6acb0f1bc2
                      name: New name
                      output_language: EN
                      job_mode: AUTO
                      max_contextual_job_history: 10
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: 3eb5e294-11eb-4bf0-8854-7177c415d15c
                      name: trade_analyze_001
                      output_language: ZH-CN
                      job_mode: AUTO
                      max_contextual_job_history: 10
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: ccca6d34-894f-4f6f-a8b5-c9df93126309
                      name: lhtest-old
                      output_language: ZH-CN
                      job_mode: AUTO
                      max_contextual_job_history: 5
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: c28a1f47-da68-4456-bb0b-e85bf5a0e98e
                      name: lhtest-newest
                      output_language: ZH-TW
                      job_mode: AUTO
                      max_contextual_job_history: 6
                      agent_id: DATA_ANALYSIS_AGENT
                    - id: fbde9b45-69cd-408e-97d1-f874236aadac
                      name: General-session
                      output_language: ZH-CN
                      job_mode: AUTO
                      max_contextual_job_history: 10
                      agent_id: DATA_ANALYSIS_AGENT
          headers:
            x-pd-trace-id:
              example: ''
              required: true
              description: >-
                The trace ID returned by Powerdrill. If a failure occurs, you
                can provide it to the Powerdrill team to assist with
                troubleshooting.
              schema:
                type: string
      deprecated: false
      security:
        - apikey-header-x-pd-api-key: []
components:
  securitySchemes:
    apikey-header-x-pd-api-key:
      type: apiKey
      in: header
      name: x-pd-api-key

````