Mendloop Docs Request access

Fix runs and pull requests

Start a fix from an approved plan, follow its attempts and checks, and read the pull requests Mendloop opened.

A fix run turns an approved plan into a verified pull request: it writes the change (up to 3 attempts), runs the checks, applies the safety gate and opens the PR. It never starts without a recorded owner's approval, and it never pushes to a default or protected branch. While it works, fix.updated live events carry its status and progress; PR changes arrive as pull_request.updated.

The fix run object#

Field Type Description
id uuid Fix run id
issue_id uuid The issue
project_id uuid or null The issue's project
rca_id uuid or null The report whose plan it follows
workflow_run_id uuid or null The workflow run that started it
approval_id uuid The recorded approval that allows this run
repo string owner/name
base_branch string Branch the fix is based on
base_sha string Commit the fix is based on
branch string Branch the fix is pushed to
status string queued, fixing, verifying, gated, ready, pr_open, failed or cancelled
attempts object[] Up to 3: {n, diff, verify, notes, cost_usd, source, tier, model, strategy, tokens, reason, at}
gate object The safety gate result
draft boolean The PR opens as a draft (gate flags, or the regression wasn't proven)
needs_second_approver boolean A second approval is needed
pr object or null The pull request: {id, provider, repo, number, url, branch, base, state, ci, head_sha, reviewers, labels, follow_up_commits, simulated, merged_at}
progress object {phase, attempt, max_attempts, current_check, checks, started_at, phase_started_at, updated_at, resumed} while it works; phase is queued, fixing, verifying, gating, opening_pr or done
outcome string Did the fix work: approved, merged, held, came_back, reverted, abandoned or unknown (proposed and deployed are reserved)
outcome_at datetime or null When the outcome was set
outcome_reason string or null Why
cost_usd number Model cost
mode string live or test
simulated boolean Writes went to dry-run adapters (test mode)
error string or null Why it failed, in one sentence
created_at datetime Created
updated_at datetime Last change

Start a fix#

POST/api/v1/orgs/{org_id}/issues/{issue_id}/fix

Starts a fix for the issue from a recorded approval and returns the queued run. The work continues in the background. Audit logged.

Auth: secret key with the issues:write scope, or a session. Either way the role behind it needs issues.triage.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id
issue_id uuid required Issue id

Body (JSON)

Parameter Type Required Description
approval_id uuid optional The approval to act on. Default: the issue's latest approved request.
branch string optional Branch name instead of the template, up to 100 characters

Response

The fix run object, with status: queued.

Errors

Status Code When
404 issue_not_found No such issue in this mode, or it's in a project you can't see
409 fix_not_approved There's no approved request for this issue, or the approval is for another issue
409 fix_running A fix for this approval is already running
409 repository_unreadable The default branch of the repository couldn't be read
423 (the switch's code) The read-only switch or a kill switch is on
Shell
curl -X POST "https://app.getmendloop.com/api/v1/orgs/ORG_ID/issues/ISSUE_ID/fix" \
  -H "Authorization: Bearer sk_test_…" \
  -H "Content-Type: application/json" \
  -d '{}'
Response 202JSON
{
  "id": "0193c6c3-7f80-7b9c-ad0e-2f3a4b5c6d7e",
  "issue_id": "0193b7e2-0a4c-7f19-b8d2-51c3e9a7f604",
  "project_id": "0193a2c4-61b0-7d3e-9a15-7c2e4f8b1d02",
  "rca_id": "0193c5b2-6e7f-7a8b-9c0d-1e2f3a4b5c6d",
  "workflow_run_id": "0193c5a0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
  "approval_id": "0193c5a1-9b0c-7d1e-af23-4b5c6d7e8f90",
  "repo": "acme/rider-web",
  "base_branch": "main",
  "base_sha": "4b8e1f2c9a7d6e5b3c1a0f9e8d7c6b5a4f3e2d1c",
  "branch": "mendloop/rider-12-guard-missing-product",
  "status": "queued",
  "attempts": [],
  "gate": {
    "…": "…"
  },
  "draft": false,
  "needs_second_approver": false,
  "pr": null,
  "progress": {
    "phase": "queued",
    "attempt": 0,
    "max_attempts": 3,
    "current_check": null,
    "checks": [],
    "started_at": null,
    "phase_started_at": null,
    "updated_at": null,
    "resumed": 0
  },
  "outcome": "approved",
  "outcome_at": null,
  "outcome_reason": null,
  "cost_usd": 0.041,
  "mode": "live",
  "simulated": false,
  "error": null,
  "created_at": "2026-11-05T09:41:00Z",
  "updated_at": "2026-11-05T09:44:30Z"
}

List fix runs#

GET/api/v1/orgs/{org_id}/fix-runs

Fix runs, newest first. Returns a plain JSON array, not a page.

Auth: secret key with the issues:read scope, or a session. Either way the role behind it needs issues.view.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id

Query parameters

Parameter Type Required Description
issue_id uuid optional Only this issue
workflow_run_id uuid optional Only the fix runs a workflow run started

Response

An array of fix run objects.

Errors

Status Code When
404 issue_not_found No such issue in this mode, or it's in a project you can't see
Shell
curl "https://app.getmendloop.com/api/v1/orgs/ORG_ID/fix-runs?issue_id=ISSUE_ID" \
  -H "Authorization: Bearer sk_test_…"
Response 200JSON
[
  {
    "id": "0193c6c3-7f80-7b9c-ad0e-2f3a4b5c6d7e",
    "issue_id": "0193b7e2-0a4c-7f19-b8d2-51c3e9a7f604",
    "project_id": "0193a2c4-61b0-7d3e-9a15-7c2e4f8b1d02",
    "rca_id": "0193c5b2-6e7f-7a8b-9c0d-1e2f3a4b5c6d",
    "workflow_run_id": "0193c5a0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
    "approval_id": "0193c5a1-9b0c-7d1e-af23-4b5c6d7e8f90",
    "repo": "acme/rider-web",
    "base_branch": "main",
    "base_sha": "4b8e1f2c9a7d6e5b3c1a0f9e8d7c6b5a4f3e2d1c",
    "branch": "mendloop/rider-12-guard-missing-product",
    "status": "pr_open",
    "attempts": [
      {
        "n": 1,
        "diff": "--- a/src/cart.tsx\n+++ b/src/cart.tsx\n…",
        "verify": {
          "…": "…"
        },
        "notes": "",
        "cost_usd": 0.041,
        "source": "model",
        "tier": "strongest",
        "model": "…",
        "strategy": "tools",
        "tokens": 18200,
        "reason": null,
        "at": "2026-11-05T09:42:10Z"
      }
    ],
    "gate": {
      "…": "…"
    },
    "draft": false,
    "needs_second_approver": false,
    "pr": {
      "id": "0193c7d4-8091-7cad-be1f-3a4b5c6d7e8f",
      "provider": "github",
      "repo": "acme/rider-web",
      "number": 1287,
      "url": "https://github.com/acme/rider-web/pull/1287",
      "branch": "mendloop/rider-12-guard-missing-product",
      "base": "main",
      "state": "open",
      "ci": "passing",
      "head_sha": "9c1e7a3f5b2d4e6c8a0f1b3d5e7a9c2e4f6b8d0a",
      "reviewers": [
        "priya-shah"
      ],
      "labels": [
        "mendloop"
      ],
      "follow_up_commits": 0,
      "simulated": false,
      "merged_at": null
    },
    "progress": {
      "phase": "done",
      "attempt": 1,
      "max_attempts": 3,
      "current_check": null,
      "checks": [],
      "started_at": "2026-11-05T09:41:02Z",
      "phase_started_at": "2026-11-05T09:44:30Z",
      "updated_at": "2026-11-05T09:44:30Z",
      "resumed": 0
    },
    "outcome": "approved",
    "outcome_at": null,
    "outcome_reason": null,
    "cost_usd": 0.041,
    "mode": "live",
    "simulated": false,
    "error": null,
    "created_at": "2026-11-05T09:41:00Z",
    "updated_at": "2026-11-05T09:44:30Z"
  }
]

Get a fix run#

GET/api/v1/orgs/{org_id}/fix-runs/{fix_run_id}

One fix run with its attempts, checks, safety gate result and pull request.

Auth: secret key with the issues:read scope, or a session. Either way the role behind it needs issues.view.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id
fix_run_id uuid required Fix run id

Response

The fix run object.

Errors

Status Code When
404 fix_run_not_found No such fix run in this mode
Shell
curl "https://app.getmendloop.com/api/v1/orgs/ORG_ID/fix-runs/FIX_RUN_ID" \
  -H "Authorization: Bearer sk_test_…"
Response 200JSON
{
  "id": "0193c6c3-7f80-7b9c-ad0e-2f3a4b5c6d7e",
  "issue_id": "0193b7e2-0a4c-7f19-b8d2-51c3e9a7f604",
  "project_id": "0193a2c4-61b0-7d3e-9a15-7c2e4f8b1d02",
  "rca_id": "0193c5b2-6e7f-7a8b-9c0d-1e2f3a4b5c6d",
  "workflow_run_id": "0193c5a0-1a2b-7c3d-8e4f-5a6b7c8d9e0f",
  "approval_id": "0193c5a1-9b0c-7d1e-af23-4b5c6d7e8f90",
  "repo": "acme/rider-web",
  "base_branch": "main",
  "base_sha": "4b8e1f2c9a7d6e5b3c1a0f9e8d7c6b5a4f3e2d1c",
  "branch": "mendloop/rider-12-guard-missing-product",
  "status": "pr_open",
  "attempts": [
    {
      "n": 1,
      "diff": "--- a/src/cart.tsx\n+++ b/src/cart.tsx\n…",
      "verify": {
        "…": "…"
      },
      "notes": "",
      "cost_usd": 0.041,
      "source": "model",
      "tier": "strongest",
      "model": "…",
      "strategy": "tools",
      "tokens": 18200,
      "reason": null,
      "at": "2026-11-05T09:42:10Z"
    }
  ],
  "gate": {
    "…": "…"
  },
  "draft": false,
  "needs_second_approver": false,
  "pr": {
    "id": "0193c7d4-8091-7cad-be1f-3a4b5c6d7e8f",
    "provider": "github",
    "repo": "acme/rider-web",
    "number": 1287,
    "url": "https://github.com/acme/rider-web/pull/1287",
    "branch": "mendloop/rider-12-guard-missing-product",
    "base": "main",
    "state": "open",
    "ci": "passing",
    "head_sha": "9c1e7a3f5b2d4e6c8a0f1b3d5e7a9c2e4f6b8d0a",
    "reviewers": [
      "priya-shah"
    ],
    "labels": [
      "mendloop"
    ],
    "follow_up_commits": 0,
    "simulated": false,
    "merged_at": null
  },
  "progress": {
    "phase": "done",
    "attempt": 1,
    "max_attempts": 3,
    "current_check": null,
    "checks": [],
    "started_at": "2026-11-05T09:41:02Z",
    "phase_started_at": "2026-11-05T09:44:30Z",
    "updated_at": "2026-11-05T09:44:30Z",
    "resumed": 0
  },
  "outcome": "approved",
  "outcome_at": null,
  "outcome_reason": null,
  "cost_usd": 0.041,
  "mode": "live",
  "simulated": false,
  "error": null,
  "created_at": "2026-11-05T09:41:00Z",
  "updated_at": "2026-11-05T09:44:30Z"
}

Summarize fix outcomes#

GET/api/v1/orgs/{org_id}/fix-outcomes/summary

How many fixes shipped and held, came back, were reverted, were abandoned, or are still unknown, for fix runs created in a time range. Unknown outcomes are counted, never folded into held.

Auth: secret key with the issues:read scope, or a session. Either way the role behind it needs issues.view.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id

Query parameters

Parameter Type Required Description
from datetime optional Start. Default: 90 days before to.
to datetime optional End. Default: now.

Response

Field Type Description
from datetime Start of the range
to datetime End of the range
total integer Fix runs created in the range
shipped integer Of those, how many had a PR merged
held integer Merged and didn't come back
came_back integer The issue came back after the fix
reverted integer The fix was reverted
abandoned integer Abandoned
unknown integer Undetermined, including fixes still inside the outcome window
pending_window integer Of unknown: merged and still inside the window
pending_approval integer Of unknown: no pull request merged yet
held_rate number or null held / (held + came_back + reverted); null until one fix is decided

Errors

Status Code When
422 invalid_input from isn't before to
Shell
curl "https://app.getmendloop.com/api/v1/orgs/ORG_ID/fix-outcomes/summary" \
  -H "Authorization: Bearer sk_test_…"
Response 200JSON
{
  "from": "2026-08-07T09:00:00Z",
  "to": "2026-11-05T09:00:00Z",
  "total": 64,
  "shipped": 51,
  "held": 44,
  "came_back": 3,
  "reverted": 1,
  "abandoned": 5,
  "unknown": 11,
  "pending_window": 3,
  "pending_approval": 8,
  "held_rate": 0.9167
}

List pull requests#

GET/api/v1/orgs/{org_id}/pull-requests

Pull requests Mendloop opened (fixes and reverts), newest first. Returns a plain JSON array.

Auth: secret key with the issues:read scope, or a session. Either way the role behind it needs issues.view.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id

Query parameters

Parameter Type Required Description
issue_id uuid optional Only this issue

Response

An array of pull requests: {id, provider, repo, number, url, branch, base, state, ci, head_sha, reviewers, labels, follow_up_commits, simulated, merged_at}. state is draft, open, merged or closed; ci is none, pending, passing or failing; number is null when simulated.

Errors

Status Code When
404 issue_not_found No such issue in this mode, or it's in a project you can't see
Shell
curl "https://app.getmendloop.com/api/v1/orgs/ORG_ID/pull-requests" \
  -H "Authorization: Bearer sk_test_…"
Response 200JSON
[
  {
    "id": "0193c7d4-8091-7cad-be1f-3a4b5c6d7e8f",
    "provider": "github",
    "repo": "acme/rider-web",
    "number": 1287,
    "url": "https://github.com/acme/rider-web/pull/1287",
    "branch": "mendloop/rider-12-guard-missing-product",
    "base": "main",
    "state": "open",
    "ci": "passing",
    "head_sha": "9c1e7a3f5b2d4e6c8a0f1b3d5e7a9c2e4f6b8d0a",
    "reviewers": [
      "priya-shah"
    ],
    "labels": [
      "mendloop"
    ],
    "follow_up_commits": 0,
    "simulated": false,
    "merged_at": null
  }
]

Revert a fix#

POST/api/v1/orgs/{org_id}/pull-requests/{pr_id}/revert

Opens a pull request that reverts a merged Mendloop fix. Audit logged.

Auth: session only. Secret keys get 403 api_key_not_allowed. The role needs fixes.approve.

Note:

Developers can revert only fixes for issues assigned to them.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id
pr_id uuid required Pull request id

Response

The new revert pull request.

Errors

Status Code When
404 pull_request_not_found No such pull request in this mode
409 approval_missing The fix has no recorded approval
409 approval_not_approved The fix's approval isn't approved
403 forbidden Developers: the issue isn't assigned to you
423 (the switch's code) The read-only switch or a kill switch is on
Shell
curl -X POST "https://app.getmendloop.com/api/v1/orgs/ORG_ID/pull-requests/PR_ID/revert" \
  --cookie "ml_session=…"
Response 201JSON
{
  "id": "0193c6c3-7f80-7b9c-ad0e-2f3a4b5c6d7e",
  "provider": "github",
  "repo": "acme/rider-web",
  "number": 1290,
  "url": "https://github.com/acme/rider-web/pull/1290",
  "branch": "mendloop/revert-1287",
  "base": "main",
  "state": "open",
  "ci": "pending",
  "head_sha": "9c1e7a3f5b2d4e6c8a0f1b3d5e7a9c2e4f6b8d0a",
  "reviewers": [
    "priya-shah"
  ],
  "labels": [
    "mendloop"
  ],
  "follow_up_commits": 0,
  "simulated": false,
  "merged_at": null
}

Simulate a merge (test mode)#

POST/api/v1/orgs/{org_id}/pull-requests/{pr_id}/simulate-merge

Test mode only: merges a simulated pull request, so the close loop (ticket sync, regression watch) can be tried without GitHub.

Auth: session only. Secret keys get 403 api_key_not_allowed. The role needs fixes.approve.

Path parameters

Parameter Type Required Description
org_id uuid required Organization id
pr_id uuid required Pull request id

Response

Field Type Description
detail string What happened
pull_request object The pull request after the merge

Errors

Status Code When
404 pull_request_not_found No such pull request in this mode
409 not_simulated The pull request isn't simulated, or the request isn't in test mode
409 pull_request_closed The pull request is already merged or closed
Shell
curl -X POST "https://app.getmendloop.com/api/v1/orgs/ORG_ID/pull-requests/PR_ID/simulate-merge" \
  --cookie "ml_session=…" \
  -H "Mendloop-Mode: test"
Response 200JSON
{
  "detail": "merged",
  "pull_request": {
    "id": "0193c7d4-8091-7cad-be1f-3a4b5c6d7e8f",
    "provider": "github",
    "repo": "acme/rider-web",
    "number": null,
    "url": "https://github.com/acme/rider-web/pull/simulated",
    "branch": "mendloop/rider-12-guard-missing-product",
    "base": "main",
    "state": "merged",
    "ci": "passing",
    "head_sha": "9c1e7a3f5b2d4e6c8a0f1b3d5e7a9c2e4f6b8d0a",
    "reviewers": [
      "priya-shah"
    ],
    "labels": [
      "mendloop"
    ],
    "follow_up_commits": 0,
    "simulated": true,
    "merged_at": "2026-11-05T10:02:00Z"
  }
}