Record a critical defect
Post a critical defect from your incident process whenever something breaks in production. GitKraken computes change failure rate and MTTR from them.
Assumes you already have a GitKraken API key — if not, see Authentication.
Creating or deleting critical defects requires a key issued by an
organization owner or admin. Other roles get 403.
Export your key for the session so the examples below can use it:
export GK_TOKEN="gk_tkn_xxxxxxxxxxxxxxxx"
Record a critical defect
POST /v1/insights/analytics/critical-defects records an incident without an
issue-tracker sync; Change Failure Rate and MTTR read manual defects exactly
like tracker-synced ones.
curl -X POST "https://api.gitkraken.dev/v1/insights/analytics/critical-defects" \
-H "Authorization: Bearer $GK_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"repo": "gitkraken/gitlens",
"gitProvider": "github",
"defectKey": "INC-2026-07-22-01",
"severity": "Critical",
"detectedAt": "2026-07-22T14:30:00Z",
"description": "Checkout flow returned 500 for SSO users",
"fixReleasedAt": "2026-07-22T18:05:00Z"
}'
A successful create returns 201 with an empty body.
Things worth knowing:
defectKeymust be unique within the organization; reusing one returns400. It becomes the path segment used to delete the defect: 1-128 characters of letters, digits,.,_or-, starting with a letter or digit.severityis stored verbatim.CriticalandHighestcount as critical bugs,Highas high bugs, andMedium,LowandLowestfill the remaining tiers. Any other value is accepted and counts toward total bug counts but lands in no tier.detectedAtdetermines which release window the defect falls into.fixReleasedAtresolves the defect for MTTR. Omit it and the defect counts as unresolved.- The defect is attributed to a team at write time. A repository with two or
more assigned teams and no designated attribution team returns
400— designate one first.
Delete a critical defect
DELETE /v1/insights/analytics/critical-defects/{id}, where {id} is the
defectKey you supplied:
curl -X DELETE "https://api.gitkraken.dev/v1/insights/analytics/critical-defects/INC-2026-07-22-01" \
-H "Authorization: Bearer $GK_TOKEN"
Returns 204. Only manually created defects are deletable — a tracker-synced
defect returns 404.
See the API Reference for the full request schemas and every query parameter.