# Update finding statuses (https://docs.capy.ai/api-reference/reviews/update-finding-statuses)

`POST https://api.capy.ai/api/v1/reviews/findings/status`

## Authorization

Send an API key as a bearer token: `Authorization: Bearer $CAPY_API_KEY`. See https://docs.capy.ai/api-reference/authentication.md.

## Request body

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `repo` | string | yes |  |
| `prNumber` | integer | yes |  |
| `updates` | FindingStatusUpdate[] | yes |  |

## Responses

- `200` PullReviewState: `PullReviewStateEncoded`
- `400` capy/InvalidRequest: `capy_InvalidRequestEncoded`
- `401` capy/Unauthorized: `capy_UnauthorizedEncoded`
- `403` capy/Forbidden: `capy_ForbiddenEncoded \| capy_ForbiddenEncoded`
- `422` capy/ReviewRefused: `capy_ReviewRefusedEncoded`
- `429` capy/RateLimited: `capy_RateLimitedEncoded`

## Example

```bash
curl -X POST "https://api.capy.ai/api/v1/reviews/findings/status" \
  -H "Authorization: Bearer $CAPY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"repo":"<repo>","prNumber":1,"updates":[]}'
```

## Referenced schemas

```json
{
  "PullReviewStateEncoded": {
    "type": "object",
    "properties": {
      "threadId": {
        "type": "string"
      },
      "reviewedHeadSha": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "currentRequestId": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "rounds": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PullReviewRoundEncoded"
        }
      },
      "findings": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/PullFindingEncoded"
        }
      }
    },
    "required": [
      "threadId",
      "reviewedHeadSha",
      "currentRequestId",
      "rounds",
      "findings"
    ],
    "additionalProperties": false
  },
  "PullReviewRoundEncoded": {
    "type": "object",
    "properties": {
      "requestId": {
        "type": "string"
      },
      "tier": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "baselineSha": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "enum": [
          "pending",
          "running",
          "completed",
          "failed",
          "stale"
        ]
      },
      "trigger": {
        "type": "string",
        "enum": [
          "automatic",
          "manual",
          "force_refresh"
        ]
      },
      "githubReviewId": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": [
                  "Infinity",
                  "-Infinity",
                  "NaN"
                ]
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "title": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "headSha": {
        "type": "string"
      },
      "failureReason": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "failureMessage": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "memory": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PullReviewRoundMemoryEncoded"
          },
          {
            "type": "null"
          }
        ]
      },
      "memoryReason": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "no_project",
              "several_projects",
              "memory_off",
              "empty"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "memorySelection": {
        "type": "string",
        "enum": [
          "index",
          "paths",
          "select"
        ]
      },
      "createdAt": {
        "type": "string"
      },
      "settledAt": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      }
    },
    "required": [
      "requestId",
      "tier",
      "baselineSha",
      "status",
      "trigger",
      "githubReviewId",
      "title",
      "headSha",
      "failureReason",
      "failureMessage",
      "memory",
      "memoryReason",
      "memorySelection",
      "createdAt",
      "settledAt"
    ],
    "additionalProperties": false
  },
  "PullReviewRoundMemoryEncoded": {
    "type": "object",
    "properties": {
      "projectId": {
        "type": "string"
      },
      "volumeId": {
        "type": "string",
        "pattern": "^vol_[0-9A-Z]{26}$"
      },
      "versionId": {
        "type": "string",
        "pattern": "^vver_[0-9A-Z]{26}$"
      }
    },
    "required": [
      "projectId",
      "volumeId",
      "versionId"
    ],
    "additionalProperties": false
  },
  "PullFindingEncoded": {
    "type": "object",
    "properties": {
      "id": {
        "type": "string"
      },
      "ruleId": {
        "anyOf": [
          {
            "type": "string",
            "allOf": [
              {
                "minLength": 32
              },
              {
                "maxLength": 32
              }
            ],
            "pattern": "^rrule_"
          },
          {
            "type": "null"
          }
        ]
      },
      "memory": {
        "anyOf": [
          {
            "$ref": "#/components/schemas/PullFindingMemoryEncoded"
          },
          {
            "type": "null"
          }
        ]
      },
      "telemetry": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "window": {
                "anyOf": [
                  {
                    "type": "string"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "note": {
                "type": "string"
              }
            },
            "required": [
              "window"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "requestId": {
        "type": "string"
      },
      "observingHeadSha": {
        "type": "string"
      },
      "githubAnchor": {
        "anyOf": [
          {
            "type": "object",
            "properties": {
              "headSha": {
                "type": "string"
              },
              "file": {
                "type": "string"
              },
              "line": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "startLine": {
                "anyOf": [
                  {
                    "type": "integer"
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "side": {
                "type": "string",
                "enum": [
                  "LEFT",
                  "RIGHT"
                ]
              },
              "outdated": {
                "type": "boolean"
              }
            },
            "required": [
              "headSha",
              "file",
              "line",
              "startLine",
              "side",
              "outdated"
            ],
            "additionalProperties": false
          },
          {
            "type": "null"
          }
        ]
      },
      "kind": {
        "type": "string",
        "enum": [
          "issue",
          "note"
        ]
      },
      "severity": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "low",
              "medium",
              "high"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "confidence": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "confirmed",
              "investigate"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "category": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "bug",
              "risk",
              "maintainability",
              "refactor"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "summary": {
        "type": "string"
      },
      "detail": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "suggestion": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "file": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "line": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "startLine": {
        "anyOf": [
          {
            "type": "integer"
          },
          {
            "type": "null"
          }
        ]
      },
      "files": {
        "anyOf": [
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "null"
          }
        ]
      },
      "status": {
        "type": "string",
        "enum": [
          "open",
          "resolved",
          "irrelevant"
        ]
      },
      "statusSource": {
        "anyOf": [
          {
            "type": "string",
            "enum": [
              "review",
              "jam",
              "user"
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "statusReason": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "githubCommentId": {
        "anyOf": [
          {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "string",
                "enum": [
                  "Infinity",
                  "-Infinity",
                  "NaN"
                ]
              }
            ]
          },
          {
            "type": "null"
          }
        ]
      },
      "githubCommentUrl": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "humanResolvedAt": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "githubDeliveryExpired": {
        "type": "boolean"
      },
      "humanResolvedBy": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "humanResolvedHeadSha": {
        "anyOf": [
          {
            "type": "string"
          },
          {
            "type": "null"
          }
        ]
      },
      "createdAt": {
        "type": "string"
      },
      "updatedAt": {
        "type": "string"
      }
    },
    "required": [
      "id",
      "ruleId",
      "memory",
      "telemetry",
      "requestId",
      "observingHeadSha",
      "githubAnchor",
      "kind",
      "severity",
      "confidence",
      "category",
      "summary",
      "detail",
      "suggestion",
      "file",
      "line",
      "startLine",
      "files",
      "status",
      "statusSource",
      "statusReason",
      "githubCommentId",
      "humanResolvedAt",
      "githubDeliveryExpired",
      "humanResolvedBy",
      "humanResolvedHeadSha",
      "createdAt",
      "updatedAt"
    ],
    "additionalProperties": false
  },
  "PullFindingMemoryEncoded": {
    "type": "object",
    "properties": {
      "volumeId": {
        "type": "string",
        "pattern": "^vol_[0-9A-Z]{26}$"
      },
      "versionId": {
        "type": "string",
        "pattern": "^vver_[0-9A-Z]{26}$"
      },
      "path": {
        "type": "string"
      },
      "title": {
        "type": "string"
      }
    },
    "required": [
      "volumeId",
      "versionId",
      "path",
      "title"
    ],
    "additionalProperties": false
  },
  "capy_InvalidRequestEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/InvalidRequest"
        ]
      },
      "message": {
        "type": "string"
      }
    },
    "required": [
      "_tag",
      "message"
    ],
    "additionalProperties": false
  },
  "capy_UnauthorizedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Unauthorized"
        ]
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ForbiddenEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/Forbidden"
        ]
      },
      "mfaRequiredOrgId": {
        "type": "string"
      },
      "ssoRequired": {
        "type": "boolean"
      },
      "passkeyRequired": {
        "type": "boolean"
      }
    },
    "required": [
      "_tag"
    ],
    "additionalProperties": false
  },
  "capy_ReviewRefusedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/ReviewRefused"
        ]
      },
      "reason": {
        "type": "string"
      }
    },
    "required": [
      "_tag",
      "reason"
    ],
    "additionalProperties": false
  },
  "capy_RateLimitedEncoded": {
    "type": "object",
    "properties": {
      "_tag": {
        "type": "string",
        "enum": [
          "capy/RateLimited"
        ]
      },
      "retryAfterSeconds": {
        "type": "integer"
      }
    },
    "required": [
      "_tag",
      "retryAfterSeconds"
    ],
    "additionalProperties": false
  },
  "UpdateFindingStatusesRequest": {
    "type": "object",
    "properties": {
      "repo": {
        "type": "string"
      },
      "prNumber": {
        "type": "integer"
      },
      "updates": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/FindingStatusUpdate"
        },
        "minItems": 1,
        "maxItems": 100
      }
    },
    "required": [
      "repo",
      "prNumber",
      "updates"
    ],
    "additionalProperties": false
  },
  "FindingStatusUpdate": {
    "type": "object",
    "properties": {
      "findingId": {
        "type": "string"
      },
      "status": {
        "type": "string",
        "enum": [
          "open",
          "resolved",
          "irrelevant"
        ]
      },
      "reason": {
        "type": "string",
        "maxLength": 2000
      }
    },
    "required": [
      "findingId",
      "status"
    ],
    "additionalProperties": false
  }
}
```

Full document: https://docs.capy.ai/openapi.json