---
title: "Get heartbeats matching a user_agent segment"
method: GET
path: "/api/admin/v1/heartbeats/by_user_agent_segment"
tags: ["Admin Utils"]
---

# Get heartbeats matching a user_agent segment

`GET /api/admin/v1/heartbeats/by_user_agent_segment`

Returns heartbeats whose user_agent contains the given substring (e.g. "Godot_Super-Wakatime/2.0.0"). Useful for monitoring how a specific editor/plugin behaves over time. Use count_only=true to avoid streaming rows when only the total is needed.

## Query parameters

- `segment` string, required
- `user_id` string
- `start_date` string
- `end_date` string
- `limit` integer
- `offset` integer
- `count_only` boolean

## Response `200`

successful

- union
  - object
    - `segment` string
    - `limit` integer
    - `offset` integer
    - `heartbeats` object[]
      - `id` integer
      - `user_id` integer
      - `time` number
      - `project` string, nullable
      - `language` string, nullable
      - `entity` string, nullable
      - `branch` string, nullable
      - `category` string, nullable
      - `editor` string, nullable
      - `machine` string, nullable
      - `operating_system` string, nullable
      - `user_agent` string, nullable
      - `ip_address` string, nullable
      - `is_write` boolean, nullable
      - `lineno` integer, nullable
      - `cursorpos` integer, nullable
      - `lines` integer, nullable
      - `source_type` string, nullable
    - `has_more` boolean
  - object — Returned when count_only=true
    - `segment` string, required
    - `total_count` integer, required

## Other responses

- `422` — missing segment

---

[API](https://skmtc.dev/hackclub/apis/hackatime-admin-api.md) · [All operations](https://skmtc.dev/hackclub/apis/hackatime-admin-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/hackclub/hackatime-admin-api/revisions/f5a2d53cd28d/schema)
