---
title: "Ingest API"
description: "The HTTP API behind the inlinr plugins (device sign-in, heartbeats, commits) and the public package API: npm releases, upgrade digests, dependency checks."
url: https://inlinr.com/docs/api
lang: en
---

Developers

# The ingest API

The same HTTP API the official plugins use. Write a plugin for an editor we do not support, or send time from a script. Field names follow WakaTime's snake\_case. An editor that already has a WakaTime plugin needs no code at all: see [WakaTime plugins](#wakatime-plugins).

Every path is on `https://inlinr.com`. Hover a field name in an example to read what it means. The same reference for a code generator or an AI assistant: [OpenAPI](https://inlinr.com/openapi.json) and [Markdown](https://inlinr.com/docs/api.md).

## 1\. Get a device token

Each editor on each machine is its own device, with its own token, revocable from Settings. There are no account-wide API keys. Start a device sign-in, show the user the link, and poll until they approve it with GitHub:

POST /api/auth/device

```
Content-Type: application/json

{ "client_name": "my-plugin", "editor": "vscode", "platform": "linux" }
```

200

```
{
  "device_code": "…",
  "user_code": "ABCD-1234",
  "verification_uri": "https://inlinr.com/activate",
  "verification_uri_complete": "https://inlinr.com/activate?code=ABCD-1234",
  "expires_in": 900,
  "interval": 5
}
```

POST /api/auth/device/token

```
Content-Type: application/json

{ "device_code": "…" }
```

400 Not approved yet. Poll again after interval seconds.

```
{ "error": "authorization_pending" }
```

400 The code expired. Start again.

```
{ "error": "expired_token" }
```

200 Approved. Keep the token.

```
{ "access_token": "in_d_…", "device": { … }, "user": { … } }
```

Send the token as `Authorization: Bearer in_d_…` on every call below. `POST /api/auth/device/revoke` with the same header signs the device out.

## 2\. Send heartbeats

A heartbeat says “this file was active at this time”. Send one about every two minutes of activity per file, plus one on each save. Durations are computed on the server from consecutive beats, so never send a duration. Up to 1000 beats per request.

POST /api/v1/heartbeats

```
Authorization: Bearer in_d_…
Content-Type: application/json

[
  {
    "entity": "src/routes/index.tsx",
    "time": 1734523920.123,
    "project_git_remote": "git@github.com:you/app.git",
    "type": "file",
    "category": "coding",
    "language": "typescript",
    "branch": "main",
    "is_write": false,
    "lineno": 42,
    "cursorpos": 1023,
    "lines": 180,
    "lines_added": 14,
    "lines_deleted": 2,
    "ai_tool": "copilot",
    "ai_lines_added": 12,
    "ai_lines_deleted": 1,
    "editor": "vscode",
    "editor_version": "1.99.3",
    "plugin": "my-plugin/0.1.0"
  }
]
```

200

```
{ "responses": [[{ "id": "hb_0" }, 201]], "accepted": 1 }
```

### Heartbeat fields

- **entity, Required**: File path relative to the repository, a URL or an app name.  
string · 1–2,000 chars
- **time, Required**: Unix seconds; fractions are kept.  
number · > 0
- **project\_git\_remote**: The repository's remote. The project is created or found from it. This or project is required.  
string · 1–500 chars
- **project**: Instead of project\_git\_remote, for a folder with no git remote: its name, matched to a project by name. Only the last path segment is kept.  
string · ≤ 500 chars
- **type**: What entity names.  
"file" | "app" | "domain" · default "file"
- **category**: What the time was spent on. Other values are kept and shown as sent.  
"coding" | "debugging" | "building" | "code-reviewing" | "writing-tests" | "ai-coding" | string · nullable · ≤ 64 chars
- **is\_write**: true when the beat comes from a save.  
boolean · default false
- **lines\_added, lines\_deleted**: Lines added and removed since the previous beat. 0 means none; leave them out if you do not count.  
integer · nullable · ≥ 0
- **ai\_tool**: The assistant that wrote the change. Send it only when you saw the assistant edit; any other value is rejected.  
"copilot" | "cursor" | "claude-code" | "codeium" | "windsurf" | "aider" | "codex" | "gemini-cli" | "opencode" · nullable
- **ai\_lines\_added, ai\_lines\_deleted**: The part of those line counts the assistant wrote.  
integer · nullable · ≥ 0
- **ai\_session**: One assistant conversation, as the assistant names it.  
string · nullable · ≤ 128 chars
- **ai\_model**: The model the assistant used.  
string · nullable · ≤ 128 chars
- **ai\_input\_tokens, ai\_output\_tokens, ai\_cache\_read\_tokens, ai\_cache\_write\_tokens**: Token counts: uncached input, output, and the context read from and written to the prompt cache, which bill at different rates.  
integer · nullable · 0–1e12
- **editor**: The host editor, e.g. vscode, cursor, windsurf.  
string · nullable · ≤ 64 chars
- **editor\_version**: The host editor's version. In a VS Code fork, the VS Code build it embeds.  
string · nullable · ≤ 32 chars
- **plugin**: Your client, user-agent style: name/version.  
string · nullable · ≤ 128 chars
- **branch**: The git branch.  
string · nullable · ≤ 256 chars
- **language**: The file's language. Inferred from the file name if left out.  
string · nullable · ≤ 64 chars
- **lineno, cursorpos, lines**: The cursor's line and offset, and the file's line count. Accepted for WakaTime compatibility, not stored.  
integer · nullable · ≥ 0

### Status codes

- 200Stored. The `responses` array has one entry per beat, in order, so you can drop exactly what was accepted from your queue.
- 400Malformed. Do not retry the same payload.
- 401The token is missing or revoked. Ask the user to sign in again.
- 5xxOr a network error: keep the beats and retry later.

## 3\. Commit line counts (optional)

Counts only, read from `git log --numstat` on the machine: no commit message, no author email. Up to 1000 commits per request.

POST /api/v1/commits

```
Authorization: Bearer in_d_…
Content-Type: application/json

{
  "project_git_remote": "git@github.com:you/app.git",
  "commits": [
    {
      "sha": "9f2c1ab",
      "committed_at": "2026-10-14T09:12:00Z",
      "files_changed": 3,
      "insertions": 120,
      "deletions": 14
    }
  ]
}
```

200 New commits stored, and commits already known with no line counts filled in.

```
{ "accepted": 1, "backfilled": 0 }
```

200 No heartbeat has created this project yet. Not worth retrying.

```
{ "accepted": 0, "reason": "unknown project" }
```

## 4\. Your time and upgrades

For a status bar clock: time tracked today in the user's own time zone, with the same counting rule as the dashboard.

GET /api/v1/me/today

```
Authorization: Bearer in_d_…
```

200

```
{
  "seconds": 12840,
  "beats": 214,
  "top_projects": […],
  "by_category": […]
}
```

A period's totals, by project and language, and the time, lines and cost of AI assistants, as the AI usage page shows them. `period` takes the dashboard's presets (`today`, `7d`, `month`…) or `custom` with `from` and `to`; `project` takes a project name or its git remote.

GET /api/v1/me/summary?period=7d&project=acme-app

```
Authorization: Bearer in_d_…
```

200 400 ambiguous\_project when two of your projects share the name; use the git remote.

```
{
  "period": "Last 7 days",
  "since": "2026-10-09T00:00:00.000Z",
  "until": null,
  "project": "acme-app",
  "total_seconds": 44940,
  "by_project": [
    { "name": "acme-app", "seconds": 44940, "ai_seconds": 9120 }
  ],
  "by_language": [{ "name": "typescript", "seconds": 38100 }],
  "ai": {
    "seconds": 9120,
    "sessions": 14,
    "lines_added": 1820,
    "total_lines_added": 2410,
    "tokens": { … },
    "cost_usd": 18.42,
    "unpriced_tokens": 0,
    "prices_verified_on": "2026-10-01",
    "by_tool": […]
  }
}
```

Logs a manual entry. Only `minutes` is required (1 to 1440). `type` is one of meeting, call, review, doc, research, testing, email or custom (the default), and `started_at` defaults to that many minutes ago.

POST /api/v1/me/entries

```
Authorization: Bearer in_d_…
Content-Type: application/json

{
  "minutes": 45,
  "type": "meeting",
  "label": "Kick-off",
  "billable": true,
  "project": "acme-app"
}
```

201 400 invalid\_entry names the field that is wrong.

```
{
  "id": "cm…",
  "type": "meeting",
  "label": "Kick-off",
  "started_at": "2026-10-15T09:15:00.000Z",
  "minutes": 45,
  "billable": true,
  "project": "acme-app"
}
```

What to upgrade in the projects whose dependencies you follow, in the order of the Upgrades tab: security first, then deprecated packages, majors and the rest, each from the version your range starts at to the one to move to, with the page that says what changes.

GET /api/v1/me/upgrades?project=acme-app

```
Authorization: Bearer in_d_…
```

200 dev=0 leaves dev dependencies out; limit goes up to 200 (50 by default).

```
{
  "project": "acme-app",
  "followed_projects": 3,
  "counts": { "security": 1, "deprecated": 0, "major": 2, "minor": 14 },
  "truncated": false,
  "upgrades": [
    {
      "name": "next",
      "reason": "security",
      "from": "15.0.3",
      "to": "15.0.7",
      "latest": "16.4.3",
      "dev": false,
      "deprecated": null,
      "advisories": [
        { "id": "GHSA-…", "summary": "…", "severity": "HIGH" }
      ],
      "unfixed": false,
      "projects": [
        { "name": "acme-app", "range": "^15.0.3", "kind": "prod" }
      ],
      "notes_url": "https://inlinr.com/packages/next/upgrade/15.0.3-15.0.7"
    },
    …
  ]
}
```

## 5\. Package releases

What the public package pages say, as JSON, for a script, a bot or an AI agent: an npm package's releases with their notes and advisories, what changes between two of its versions, and a check of a whole package.json. No token needed. Scoped names go in the path as they are: `/api/v1/packages/@tanstack/react-router/releases`.

GET /api/v1/packages/react/releases?limit=1

```
No body.
```

200

```
{
  "name": "react",
  "latest_version": "19.2.0",
  "deprecated": null,
  "license": "MIT",
  "repository_url": "https://github.com/facebook/react",
  "homepage": "https://react.dev/",
  "history_refreshed_at": "2026-10-15T08:00:00.000Z",
  "history_stale": false,
  "releases": [
    {
      "version": "19.2.0",
      "published_at": "2026-10-01T16:00:00.000Z",
      "prerelease": false,
      "notes": "## 19.2.0 …",
      "notes_url": "https://github.com/facebook/react/releases/tag/v19.2.0"
    }
  ],
  "advisories": []
}
```

`limit` goes up to 100, `since` takes an ISO date, and `prereleases=1` keeps release candidates. Leave `to` out of an upgrade to go to the latest release:

GET /api/v1/packages/react/upgrade?from=18.3.1&to=19.0.0

```
No body.
```

200

```
{
  "name": "react",
  "latest_version": "19.2.0",
  "history_refreshed_at": "2026-10-15T08:00:00.000Z",
  "history_stale": false,
  "from": "18.3.1",
  "to": "19.0.0",
  "releases": 1,
  "releases_with_notes": 1,
  "releases_without_notes": [],
  "prereleases_read": [],
  "majors_without_breaking": [],
  "breaking": [
    { "version": "19.0.0", "markdown": "Remove propTypes …" }
  ],
  "deprecations": [],
  "fixed_advisories": [],
  "remaining_advisories": [],
  "security": [],
  "features": [{ "version": "19.0.0", "markdown": "Actions …" }],
  "fixes": [],
  "other": [],
  "internal_lines": 0,
  "guides": [
    { "label": "React 19 upgrade guide", "url": "https://react.dev/…" }
  ]
}
```

404

```
{
  "error": "not_found",
  "message": "No published release 19.9.9 after 18.3.1."
}
```

POST /api/v1/check

```
Content-Type: application/json

{ "packages": ["react@^18.2.0", "request"] }
```

200 With a device token, each dependency also lists your\_projects.

```
{
  "summary": {
    "checked": 2,
    "with_advisories": 1,
    "deprecated": 1,
    "majors_behind": 1,
    "behind": 1,
    "unchecked": 0
  },
  "truncated": 0,
  "dependencies": [
    {
      "name": "request",
      "range": null,
      "kind": "prod",
      "resolved_name": null,
      "status": "checked",
      "unchecked_reason": null,
      "latest": "2.88.2",
      "gap": null,
      "floor": null,
      "deprecated": "request has been deprecated …",
      "advisories": [
        {
          "id": "GHSA-p8p7-x288-28g6",
          "summary": "…",
          "severity": "moderate",
          "url": "…",
          "fixed_in": null
        }
      ],
      "advisories_unknown": false
    }
  ]
}
```

The advisories inlinr has newly seen on widely used packages, newest first, each with its page on inlinr: for a bot that announces them, or a script that watches the packages everyone depends on. An advisory counts from the day a refresh found it, so one indexed days after its publication is still news.

GET /api/v1/advisories?severity=critical,high&min\_downloads=1000000

```
No body.
```

200 since defaults to a week ago (90 days at most); limit goes up to 50, 20 by default.

```
{
  "since": "2026-11-13T12:00:00.000Z",
  "advisories": [
    {
      "id": "GHSA-xxxx-xxxx-xxxx",
      "package": "example-lib",
      "weekly_downloads": 4200000,
      "severity": "HIGH",
      "summary": "Prototype pollution in merge()",
      "fixed_in": "2.4.1",
      "published_at": "2026-11-18T09:00:00.000Z",
      "first_seen_at": "2026-11-18T10:37:00.000Z",
      "url": "https://inlinr.com/advisories/GHSA-xxxx-xxxx-xxxx",
      "source_url": "https://github.com/advisories/GHSA-xxxx-xxxx-xxxx"
    }
  ]
}
```

Without a token, an address gets 60 reads and 10 checks every ten minutes. A device token raises that to 600 and 60, and each answer then lists `your_projects`: your own followed projects that declare the package, with the range and the installed version. Past the limit the answer is `429` with `Retry-After`. `503 busy` means npm could not be read for a package we had never seen; try again in a minute. A range we cannot read, like `workspace:*`, is reported as unchecked, never as up to date.

## AI assistants (MCP)

The same answers, inside Claude Code, Cursor, Claude Desktop or any MCP client: `inlinr mcp` serves them over stdio. Install the [inlinr CLI](https://github.com/inlinrhq/inlinr-cli/releases/latest), sign in once with `inlinr activate`, then add it to the assistant:

```
claude mcp add inlinr -- inlinr mcp
```

or, in a client's JSON config:

```
{ "mcpServers": { "inlinr": { "command": "inlinr", "args": ["mcp"] } } }
```

Its tools call the endpoints above: `time_summary` (your time by project and language, AI time and cost), `log_time` (a manual entry), `check_dependencies` (the package.json of the folder the assistant runs in; only its four dependency blocks are sent), `package_releases`, `upgrade_notes`, `my_upgrades` (your Upgrades list, from the endpoint above) and `find_usages` (the lines of your code that import a package, searched on your machine; nothing is sent). The package tools work without signing in.

## WakaTime plugins

Any stock WakaTime plugin can send time here, unchanged. Create a WakaTime key in Settings → Editors (it starts with `waka_`), then point the plugin at inlinr in `~/.wakatime.cfg`:

```
[settings]
api_url = https://inlinr.com/api/compat/wakatime/v1
api_key = waka_…
```

The key travels as HTTP Basic auth, the way wakatime-cli sends it. Projects are matched by name, or by one of a project's other names, since WakaTime plugins do not send a git remote, and the plugin's status bar shows today's time from inlinr. Setup for each editor is on the [WakaTime integration page](https://inlinr.com/integrations/wakatime).

The same key reads what the tools around WakaTime read: `users/current/summaries` (`start` and `end`, or a named `range` such as `Last 7 Days`, and an optional `project`), `users/current/stats/<range>` (`last_7_days`, `last_30_days`, `last_6_months`, `last_year`, `all_time`) and `users/current/all_time_since_today`, in WakaTime's shapes. Operating systems, machines and dependencies come back empty: inlinr does not collect them. Moving over is in the [switching guide](https://inlinr.com/guides/switch-from-wakatime). inlinr is not affiliated with or endorsed by WakaTime.

## Before you write a client

The [inlinr CLI](https://github.com/inlinrhq/inlinr-cli) already does sign-in, an offline queue and retries. Most plugins only spawn `inlinr heartbeat` with flags, which is how the VS Code extension works. How time is computed from beats is in [this guide](https://inlinr.com/guides/how-coding-time-is-counted), and what we store is on the [security page](https://inlinr.com/security).
