---
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

---

[API](https://skmtc.net/hackclub/apis/hackatime-api.md) · [All operations](https://skmtc.net/hackclub/apis/hackatime-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/hackclub/hackatime-api/versions/4214f8ab061e/schema)
