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

# コードスキャンの検出結果を修復する（Devin API）

> v3 組織 API を通じて、コードスキャンの検出結果を修復し、プルリクエストを作成する Devin セッションを開始します

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

組織レベルの`UseCodeScans`権限を持つ[サービスユーザー](/ja/api-reference/v3/service-users/members-service-users)または[パーソナルアクセストークン](/ja/api-reference/personal-access-tokens)が必要です。

<div id="behavior">
  ## 動作
</div>

指定されたコードスキャン検出結果を修復するためのDevinセッションを起動します。このセッションは脆弱なコードを分析し、修正を実装してプルリクエストを作成します。セッションは、呼び出し元のprincipal (リクエストを行ったサービスユーザーまたはPAT) に紐づけられます。

検出結果にすでに修復セッションがある場合は、`409 Conflict` を返します。

<div id="related">
  ## 関連情報
</div>

* [Devin API でコードスキャンをトリガーする](/ja/api-reference/v3/code-scans/triggering-code-scans)では、開始 → ポーリング → 検出結果 → 修復までの一連のフローを説明しています。
* [コードスキャンを開始](/ja/api-reference/v3/code-scans/organizations-code-scans-start)および[インジェスチョンスキャンを開始](/ja/api-reference/v3/code-scans/organizations-code-scans-start-ingestion)では、ここで検出結果を修復できるスキャンを作成します。


## OpenAPI

````yaml ja/v3-openapi.yaml POST /v3/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/organizations/{org_id}/code-scans/{scan_id}/findings/{finding_id}/remediate:
    post:
      tags:
        - code-scans
      summary: コードスキャンの検出結果を修復
      description: >-
        コードスキャンの検出結果を修復するための Devin セッションを起動します。


        このセッションは脆弱なコードを分析し、修正を実装して、PR を作成します。このセッションは、呼び出し元の
        principal（リクエストを行ったサービスユーザーまたは PAT）に関連付けられます。検出結果にすでに修復セッションがある場合は
        ``409`` を返します。
      operationId: >-
        handle_remediate_code_scan_finding_v3_organizations__org_id__code_scans__scan_id__findings__finding_id__remediate_post
      parameters:
        - 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
        - description: '組織 ID（プレフィックス: org-）'
          in: path
          name: org_id
          required: true
          schema:
            example: org-abc123def456
            title: Org Id
            type: string
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RemediateFindingResponse'
          description: 成功レスポンス
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 未認証
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: アクセス禁止
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 見つかりません
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 競合
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          description: 処理できないコンテンツ
        '429':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetail'
          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
    ProblemDetail:
      description: >-
        v3 API 用の RFC 9457 application/problem+json エラーボディ。


        detail は後方互換性のため、レガシーな {"detail": ...}
        ボディから引き継がれます。その他のメンバーは追加式です。errors にはフィールドレベルのバリデーションエラーが含まれます（422
        の場合のみ）。
      properties:
        detail:
          anyOf:
            - type: string
            - type: 'null'
          description: この事象に固有の、人が読める説明。
          title: Detail
        errors:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          description: フィールド単位のバリデーションエラー（422 レスポンスのみ）。
          title: Errors
        instance:
          anyOf:
            - type: string
            - type: 'null'
          description: この発生箇所の URI 参照（リクエストパス）。
          title: Instance
        status:
          description: HTTP ステータスコード。
          title: Status
          type: integer
        title:
          description: 問題タイプを人が読める短い要約。
          title: Title
          type: string
        type:
          default: about:blank
          description: 問題タイプを識別する URI 参照。
          title: Type
          type: string
      required:
        - title
        - status
      title: ProblemDetail
      type: object
  securitySchemes:
    bearerAuth:
      description: 'サービスユーザーの認証情報（接頭辞: cog_）'
      scheme: bearer
      type: http

````