> ## Documentation Index
> Fetch the complete documentation index at: https://docs.devin.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 修复代码扫描发现项

> 启动 Devin 会话来修复代码扫描发现项

<div id="permissions">
  ## 权限
</div>

需要具备企业级 `UseAccountCodeScans` 权限的服务用户。

<div id="behavior">
  ## 行为
</div>

启动一个 Devin 会话来修复指定的代码扫描发现项：该会话会分析存在漏洞的代码、完成修复，并发起一个拉取请求。该会话将归属于发起请求的主体 (即发出该请求的服务用户或 PAT) 。

如果该发现项已有关联的修复会话，则返回 `409 Conflict`。


## OpenAPI

````yaml zh/v3-openapi.yaml POST /v3/enterprise/organizations/{org_id}/code-scans/{scan_id}/findings/{finding_id}/remediate
openapi: 3.1.0
info:
  description: 采用 Service User 身份验证和 RBAC 的 Devin v3 API
  title: Devin API v3
  version: 3.0.0
servers: []
security:
  - bearerAuth: []
paths:
  /v3/enterprise/organizations/{org_id}/code-scans/{scan_id}/findings/{finding_id}/remediate:
    post:
      tags:
        - code-scans
      summary: 修复代码扫描发现项
      description: |-
        启动一个 Devin 会话来修复某个代码扫描发现项。

        该会话会分析存在漏洞的代码、实施修复，并创建一个
        拉取请求。该会话归属于发起调用的主体（即发出请求的
        服务用户或 PAT）。如果该发现项
        已有修复会话，则返回 ``409``。
      operationId: >-
        handle_remediate_code_scan_finding_v3_enterprise_organizations__org_id__code_scans__scan_id__findings__finding_id__remediate_post
      parameters:
        - description: 组织 ID（前缀：org-）
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
        - in: path
          name: scan_id
          required: true
          schema:
            title: Scan Id
            type: string
        - in: path
          name: finding_id
          required: true
          schema:
            title: Finding Id
            type: string
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemediateFindingResponse'
          description: 成功响应
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: 验证错误
components:
  schemas:
    RemediateFindingResponse:
      description: 为代码扫描发现项启动的修复会话。
      properties:
        finding_id:
          description: 正在修复的发现项。
          title: Finding Id
          type: string
        session_id:
          description: 为修复该发现项而启动的 Devin 会话 ID。
          title: Session Id
          type: string
      required:
        - finding_id
        - session_id
      title: RemediateFindingResponse
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    bearerAuth:
      description: 服务用户凭据（前缀：cog_）
      scheme: bearer
      type: http

````