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

# Get User Segmentation

> **Description:** Retrieves user information based on the specified filters.

**Parameters:**
- `language`: The language. Use country code (ex: 'en', 'ru', 'es', etc.)
- `utm`: The start parameter
- `is_premium`: Whether the user is premium
- `country`: The country
- `city`: The city


**Header**
- `x-api-key`: Your API Key (Dashboard->Settings)

**Returns:**
- `UserSegmentationResponse`: The response containing the user segmentation data. It contains the following fields:
    - `data`: The list of user segmentation entries. It contains the following fields:
        - `telegram_id`: The Telegram ID of the user.
        - `language`: The language of the user. Defaults to None.
        - `utm`: The start parameter of the user. Defaults to None.
        - `is_premium`: Whether the user is premium. Defaults to False.
        - `first_active_at`: The first active date of the user.
        - `country`: The country of the user. Defaults to None.
        - `city`: The city of the user. Defaults to None.
        - `total_events`: The total number of events from the user in your application.
        - `total_sessions`: The total number of sessions from the user in your application.
        - `username`: The username of the user. Defaults to None.
        - `firstname`: The first name of the user. Defaults to None.
        - `lastname`: The last name of the user. Defaults to None.
        - `last_active_at`: The last active date of the user.
        - `device`: The device of the user. Defaults to None.
        - `brand`: The brand of the user. Defaults to None.
        - `model`: The model of the user. Defaults to None.
    - `limit`: The number of items per page.
    - `offset`: The number of items to skip.
    - `status_code`: The status code of the response.
    - `message`: The message of the response.

**Raises:**
- `HTTPException`: If an error occurs during the retrieval process.



## OpenAPI

````yaml https://ebn.telemetree.io/public-api/openapi.json get /users/segmentation
openapi: 3.1.0
info:
  title: Telemetree API
  description: Telemetree Public API endpoints.
  termsOfService: https://docs.telemetree.io/essentials/terms-of-service
  contact:
    name: Chris
    url: https://t.me/telemetree_referral
    email: chris@telemetree.io
  version: 1.0.0
servers:
  - url: https://ebn.telemetree.io/public-api
security: []
paths:
  /users/segmentation:
    get:
      tags:
        - User API
      summary: Get User Segmentation
      description: >-
        **Description:** Retrieves user information based on the specified
        filters.


        **Parameters:**

        - `language`: The language. Use country code (ex: 'en', 'ru', 'es',
        etc.)

        - `utm`: The start parameter

        - `is_premium`: Whether the user is premium

        - `country`: The country

        - `city`: The city



        **Header**

        - `x-api-key`: Your API Key (Dashboard->Settings)


        **Returns:**

        - `UserSegmentationResponse`: The response containing the user
        segmentation data. It contains the following fields:
            - `data`: The list of user segmentation entries. It contains the following fields:
                - `telegram_id`: The Telegram ID of the user.
                - `language`: The language of the user. Defaults to None.
                - `utm`: The start parameter of the user. Defaults to None.
                - `is_premium`: Whether the user is premium. Defaults to False.
                - `first_active_at`: The first active date of the user.
                - `country`: The country of the user. Defaults to None.
                - `city`: The city of the user. Defaults to None.
                - `total_events`: The total number of events from the user in your application.
                - `total_sessions`: The total number of sessions from the user in your application.
                - `username`: The username of the user. Defaults to None.
                - `firstname`: The first name of the user. Defaults to None.
                - `lastname`: The last name of the user. Defaults to None.
                - `last_active_at`: The last active date of the user.
                - `device`: The device of the user. Defaults to None.
                - `brand`: The brand of the user. Defaults to None.
                - `model`: The model of the user. Defaults to None.
            - `limit`: The number of items per page.
            - `offset`: The number of items to skip.
            - `status_code`: The status code of the response.
            - `message`: The message of the response.

        **Raises:**

        - `HTTPException`: If an error occurs during the retrieval process.
      operationId: get_user_segmentation_users_segmentation_get
      parameters:
        - name: language
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Language
            title: Language
          description: Language
          example: en
        - name: utm
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Start parameter
            title: Utm
          description: Start parameter
        - name: is_premium
          in: query
          required: false
          schema:
            anyOf:
              - type: boolean
              - type: 'null'
            description: Is premium user
            title: Is Premium
          description: Is premium user
          example: true
        - name: country
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Country
            title: Country
          description: Country
        - name: city
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: City
            title: City
          description: City
        - name: sort_by
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/UserSortBy'
              - type: 'null'
            description: Sort by
            default: curr_balance
            title: Sort By
          description: Sort by
        - name: sort_order
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/UserSortOrder'
              - type: 'null'
            description: Sort order
            default: desc
            title: Sort Order
          description: Sort order
        - name: limit
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            description: Number of items per page
            default: 20
            title: Limit
          description: Number of items per page
        - 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
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserSegmentationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - api_key: []
components:
  schemas:
    UserSortBy:
      type: string
      enum:
        - is_premium
        - curr_balance
        - curr_volume
        - total_events
        - total_sessions
        - language
        - country
        - city
        - provider
      title: UserSortBy
    UserSortOrder:
      type: string
      enum:
        - asc
        - desc
      title: UserSortOrder
    UserSegmentationResponse:
      properties:
        status_code:
          type: integer
          title: Status Code
          default: 200
        message:
          type: string
          title: Message
          default: Success
        limit:
          type: integer
          title: Limit
        offset:
          type: integer
          title: Offset
        data:
          items:
            $ref: '#/components/schemas/UserSegmentationEntry'
          type: array
          title: Data
      type: object
      required:
        - limit
        - offset
        - data
      title: UserSegmentationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UserSegmentationEntry:
      properties:
        telegram_id:
          type: integer
          title: Telegram Id
        language:
          anyOf:
            - type: string
            - type: 'null'
          title: Language
        utm:
          anyOf:
            - type: string
            - type: 'null'
          title: Utm
        is_premium:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Is Premium
          default: false
        first_active_at:
          type: string
          format: date-time
          title: First Active At
        country:
          anyOf:
            - type: string
            - type: 'null'
          title: Country
        city:
          anyOf:
            - type: string
            - type: 'null'
          title: City
        total_events:
          type: integer
          title: Total Events
        total_sessions:
          type: integer
          title: Total Sessions
        username:
          anyOf:
            - type: string
            - type: 'null'
          title: Username
        firstname:
          anyOf:
            - type: string
            - type: 'null'
          title: Firstname
        lastname:
          anyOf:
            - type: string
            - type: 'null'
          title: Lastname
        last_active_at:
          type: string
          format: date-time
          title: Last Active At
        device:
          anyOf:
            - type: string
            - type: 'null'
          title: Device
        brand:
          anyOf:
            - type: string
            - type: 'null'
          title: Brand
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
      type: object
      required:
        - telegram_id
        - first_active_at
        - total_events
        - total_sessions
        - last_active_at
      title: UserSegmentationEntry
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    api_key:
      type: apiKey
      description: Your API Key (Dashboard->Settings)
      in: header
      name: x-api-key

````