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

# Get all sessions

> This endpoint, given a poll ID, returns the metadata of all sessions in a paginated manner. By default, it brings the first 1000 records from the current year. Optional parameters can be used to control the date range and pagination.



## OpenAPI

````yaml open-api-files/treble-api-en.json GET /devapi/poll/{poll_id}/sessions
openapi: 3.0.1
info:
  title: Treble Poll API
  description: Documentation for the poll deployment endpoint in Treble
  version: 1.0.0
servers:
  - url: https://main.treble.ai
    description: Main Treble server
  - url: https://yourdomain.com
    description: >-
      Example server for implementing webhooks. This represents YOUR server
      where you must implement the endpoints that Treble will call.
security: []
tags:
  - name: Webhooks
    description: >-
      Endpoints that Treble will call on your server. These are not real
      endpoints that you can call, but a representation of the webhooks that
      Treble will invoke in your system.
paths:
  /devapi/poll/{poll_id}/sessions:
    get:
      summary: Get session metadata from a poll
      description: >-
        This endpoint, given a poll ID, returns the metadata of all sessions in
        a paginated manner. By default, it brings the first 1000 records from
        the current year. Optional parameters can be used to control the date
        range and pagination.
      parameters:
        - name: poll_id
          in: path
          required: true
          description: ID of the poll from which you want to obtain the sessions
          schema:
            type: string
        - name: Authorization
          in: header
          required: true
          description: >-
            Authorization API Key. Can be obtained at
            https://app.treble.ai/en/dashboard/settings/developers
          schema:
            type: string
          example: API_KEY
        - name: since
          in: query
          required: false
          description: Timestamp UNIX UTC for the start date of the range to query
          schema:
            type: integer
        - name: until
          in: query
          required: false
          description: Timestamp UNIX UTC for the end date of the range to query
          schema:
            type: integer
        - name: limit
          in: query
          required: false
          description: >-
            Integer between 1 and 10,000 that indicates the number of sessions
            to recover
          schema:
            type: integer
            minimum: 1
            maximum: 10000
        - name: after
          in: query
          required: false
          description: >-
            Pagination cursor returned in the 'next_id' property of the previous
            response
          schema:
            type: string
      responses:
        '200':
          description: List of session metadata obtained correctly
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Unique ID of the session
                        created_at:
                          type: string
                          format: date-time
                          description: Date and time when the session was created
                        finished_at:
                          type: string
                          format: date-time
                          description: Date and time when the session was finished
                        user:
                          type: object
                          properties:
                            country_code:
                              type: string
                              description: Country code of the user
                            cellphone:
                              type: string
                              description: User's phone number without the country code
                    description: List of session metadata
                  next_id:
                    type: string
                    description: Cursor to get the next page of results
              example:
                results:
                  - id: dabcf6c0-8150-4231-bafd-a3c331da385f4
                    created_at: '2022-03-09 17:00:28.956422'
                    finished_at: '2022-03-09 19:08:38.808986'
                    user:
                      country_code: '+57'
                      cellphone: '987654321'
                  - id: dabcf6c0-8850-4231-bafd-a3c331da385f9
                    created_at: '2022-03-09 17:11:46.754945'
                    finished_at: '2022-03-09 19:18:41.401605'
                    user:
                      country_code: '+57'
                      cellphone: '123456789'
                next_id: da848b5f-27e2-49f9-8d31-313b791daf8d
        '401':
          description: Unauthorized. Invalid or missing API Key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description
        '404':
          description: Poll not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error code
                  message:
                    type: string
                    description: Error description

````