---
title: "Get user heartbeat spans"
method: GET
path: "/api/v1/users/{username}/heartbeats/spans"
tags: ["Stats"]
---

# Get user heartbeat spans

`GET /api/v1/users/{username}/heartbeats/spans`

Returns heartbeat spans for a user, useful for visualizations. Accessible anonymously when the target user has public stats lookup enabled; otherwise the requester must be the user (authenticated via the User API Key).

## Path parameters

- `username` string, required

## Query parameters

- `start_date` string, date_time
- `end_date` string, date_time
- `project` string
- `filter_by_project` string

## Response `200`

successful

- object
  - `spans` object[]
    - `start_time` number — Span start time (epoch seconds)
    - `end_time` number — Span end time (epoch seconds)
    - `duration` number — Span duration (seconds)

## Other responses

- `403` — forbidden — The target user has disabled public stats lookup and the requester is not that user.
- `404` — user not found
- `422` — invalid date

## Changes

- **2026-06-07** (v1) `10d87f00ef0b` — 2 breaking, 3 warning, 8 info
  - for the `query` request parameter `end_date`, the type/format was changed from `string`/`date` to `string`/`date_time`
  - for the `query` request parameter `start_date`, the type/format was changed from `string`/`date` to `string`/`date_time`
  - removed the optional property `spans/items/end` from the response with the `200` status
  - removed the optional property `spans/items/project` from the response with the `200` status
  - …9 more
- **2026-02-20** (v1) `3b1a9efa4afe` — 1 info
  - added the non-success response with the status `422`
- **2026-01-28** (v1) `a9eaba48a93a` — 2 breaking
  - for the `query` request parameter `end_date`, the type/format was changed from `string`/`` to `string`/`date`
  - for the `query` request parameter `start_date`, the type/format was changed from `string`/`` to `string`/`date`
- **2026-01-27** (v1) `b6d6849481da` — 3 warning, 11 info
  - removed the optional property `spans/items/duration` from the response with the `200` status
  - removed the optional property `spans/items/end_time` from the response with the `200` status
  - removed the optional property `spans/items/start_time` from the response with the `200` status
  - the endpoint scheme security `Bearer AND ApiKeyAuth` was added to the API
  - …10 more

[Change history](https://skmtc.dev/hackclub/apis/hackatime-api/changes/api/v1/users/:username/heartbeats/spans/get.md)

---

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