Skip to main content

Pull Requests API

Octokraft analyzes pull requests for code quality issues, merge readiness, scope drift, health impact, and conflicts with other open PRs. Analyses run automatically on PR events or can be triggered manually.

List PR Analyses

Returns paginated PR analyses for a project.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/pr-analyses?limit=20&offset=0" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."

Query Parameters

ParameterTypeDescriptionDefault
limitintegerItems per page (max 100)20
offsetintegerNumber of items to skip0

Get PR Analysis

Returns a full PR analysis by ID, including all analysis sections.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/pr-analyses/c8d9e0f1-2345-6789-abcd-ef0123456789" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."

Response Fields

FieldTypeDescription
classificationobjectPR intent, change categories, and risk signals
merge_readinessobjectMerge status (ready, needs_review, blocked), issue counts, confidence
health_impactobjectNet issue delta and overall impact rating
health_projectionobjectPer-category score projections showing how the PR would affect health scores
graph_impactobjectImpact analysis of changed symbols on the codebase graph
scope_driftarrayDetected changes outside the PR’s stated scope
impact_zonesarrayLogical groupings of changes with risk levels
conflictsobjectDetected conflicts with other open PRs
stacked_prsobjectStacked PR detection (parent/child relationships)
statusstringpending, running, completed, or failed

Merge Readiness Status

StatusMeaning
readyNo blocking or advisory issues found
needs_reviewAdvisory issues found but no blockers
blockedBlocking issues that should be resolved before merging

Get Latest Analysis for PR

Returns the most recent analysis for a specific pull request.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos/f1a2b3c4-5678-9abc-def0-aabbccddeeff/prs/142/analysis" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."
Returns the same response format as Get PR Analysis. Returns 404 if no analysis exists for the PR.

Trigger PR Analysis

Starts a new analysis for a pull request. The analysis runs asynchronously.
curl -X POST "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/repos/f1a2b3c4-5678-9abc-def0-aabbccddeeff/prs/142/analyze" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..." \
  -H "Content-Type: application/json" \
  -d '{
    "head_sha": "a3f8e2d1b4c5"
  }'

Request Body

FieldTypeRequiredDescription
head_shastringnoHEAD commit SHA. If omitted, uses the SHA from the most recently synced PR metadata.
The analysis runs asynchronously. Poll the Get PR Analysis endpoint or use the Get Latest Analysis for PR endpoint to check for completion.

Get PR Statistics

Returns aggregate statistics for PR analyses in a project.
curl "https://app.octokraft.com/api/v1/projects/b3d7f1a2-4e5c-6d8a-9b0c-1e2f3a4b5c6d/pr-analyses/stats" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."

Query Parameters

ParameterTypeDescription
sincestringISO 8601 timestamp. Only count analyses created after this time.
# Stats for the last 30 days
curl "https://app.octokraft.com/api/v1/projects/{id}/pr-analyses/stats?since=2026-02-08T00:00:00Z" \
  -H "Authorization: Bearer ok_live_a1b2c3d4e5f6..."