Skip to content

API Reference

Chuck edited this page Nov 13, 2026 · 5 revisions

API Reference

The HTTP endpoints Glint exposes, the GitLab payload fields it reads, the GitLab API calls it makes, and what it writes back.


Endpoints

Method Path Auth Purpose
POST /webhook Required Receives GitLab Merge Request Hook and Release Hook events
GET /health None Liveness check

GET /health

HTTP/1.1 200 OK
Content-Type: application/json

{"status":"ok"}

It reports only that the HTTP server is running; it doesn't check GitLab or Anthropic connectivity.

POST /webhook

Request headers

Header Required Value
Content-Type Yes application/json
X-Gitlab-Event Yes Merge Request Hook or Release Hook; anything else is ignored
webhook-id, webhook-timestamp, webhook-signature When WEBHOOK_SIGNING_TOKEN is set Sent by GitLab's signing token (Standard Webhooks)
X-Gitlab-Token When only WEBHOOK_SECRET is set The webhook's secret token

Signature verification (signing token mode): Glint computes base64(HMAC-SHA256(key, "{webhook-id}.{webhook-timestamp}.{raw body}")), where key is the base64-decoded token without its whsec_ prefix, and accepts the request if any v1,<signature> entry in webhook-signature (space-separated) matches. webhook-timestamp (Unix seconds) must be within 5 minutes of Glint's clock.

Processing order

  1. Authenticate → 401 on failure.
  2. Route on X-Gitlab-Event → 200 Ignored for other events.
  3. Check object_kind → 200 Ignored if it doesn't match the event.
  4. Validate IDs / tag → 400 if invalid.
  5. Check the action → 200 Ignored unless it is handled.
  6. Respond 202 Accepted, then process in the background.

Responses

Status Body Meaning
202 {"message":"Accepted"} Event accepted; work continues in the background
200 {"message":"Ignored: event 'Push Hook'"} Authenticated, but not an event Glint handles
200 {"message":"Ignored: action 'update'"} Merge request action other than open/reopen
200 {"message":"Ignored: release action 'update'"} Release action other than create
200 {"message":"Ignored: not a merge_request event"} object_kind doesn't match the header (likewise for releases)
400 {"error":"Bad Request: invalid project id or merge request iid"} project.id or object_attributes.iid isn't a positive integer
400 {"error":"Bad Request: invalid project id or release tag"} Bad project.id, or tag empty, over 255 characters, or containing whitespace/control characters
401 {"error":"Unauthorized: invalid webhook signature"} Signing token mode: signature missing, wrong or too old
401 {"error":"Unauthorized: invalid webhook token"} Secret token mode: X-Gitlab-Token missing or wrong

A 202 says nothing about the outcome of the background work. Failures there are logged and not reported back to GitLab, and GitLab doesn't redeliver.

Request bodies are parsed with Express's JSON parser and its default 100 KB limit.


Payload fields used

Merge Request Hook

{
  "object_kind": "merge_request",
  "project": { "id": 34 },
  "object_attributes": { "iid": 12, "action": "open" }
}
Field Use
object_kind Must be merge_request
project.id Project for all GitLab API calls
object_attributes.iid The MR's number within the project
object_attributes.action Only open and reopen are processed

Everything else (title, description, author, branches) is fetched fresh from the GitLab API rather than trusted from the payload.

Release Hook

{
  "object_kind": "release",
  "project": { "id": 34 },
  "tag": "v1.4.0",
  "name": "Release 1.4.0",
  "action": "create"
}
Field Use
object_kind Must be release
project.id Project for all GitLab API calls
tag The release's tag; validated as above
name Release name for the prompt; falls back to tag if empty
action Only create is processed

GitLab API calls

All calls go to GITLAB_BASE_URL with the header PRIVATE-TOKEN: <GITLAB_TOKEN>.

Merge request summary

Method Path Notes
GET /api/v4/projects/:id/merge_requests/:iid Title, description, author, branches (in parallel with the next call)
GET /api/v4/projects/:id/merge_requests/:iid/diffs?per_page=100 First 100 changed files
POST /api/v4/projects/:id/merge_requests/:iid/notes Posts the summary comment

Release notes

Method Path Notes
GET /api/v4/projects/:id/releases?per_page=10 Finds the release created before this one (GitLab lists newest first)
GET /api/v4/projects/:id/repository/compare?from=<prev>&to=<tag>&straight=true Commits and diffs between the two tags
GET /api/v4/projects/:id/repository/commits?ref_name=<tag>&per_page=100 First release only: up to 100 commits reachable from the tag, no diff
PUT /api/v4/projects/:id/releases/:tag Replaces the release description

What Glint writes

MR comment

Claude is asked for three sections, and Glint wraps the reply:

## AI-Generated MR Summary

**Summary** — 2–3 sentences on what the MR does and why
**Key Changes** — bullet list
**Review Notes** — areas that deserve extra attention

---
*This summary was generated automatically. Please verify before relying on it.*

The prompt includes the MR title, author, source and target branches, description, and each changed file's diff labelled as new, deleted or renamed. If the combined diff text is over 20,000 characters it is cut and Claude is told so.

Release description

Claude is asked for user-facing Markdown under whichever of these headings apply: 🚀 New Features, 🐛 Bug Fixes, ♻️ Improvements, ⚠️ Breaking Changes, 🔧 Internal / Chores. It infers categories from commit prefixes such as feat: and fix:. Glint appends:

---
*Release notes generated automatically by AI. Please review before publishing.*

The commit log is capped at 15,000 characters and the diff at 20,000. Both replies are limited to 1,024 output tokens.

Clone this wiki locally