> For the complete documentation index, see [llms.txt](https://help.aikido.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.aikido.dev/docs/docs-ja/pr-torirsunogtingu/cli-for-pr-and-release-gating/aikido-ci-api.md).

# Aikido CI API

**ベースURL** `https://app.aikido.dev`

Aikido CI APIを使用すると、リポジトリ内の特定ブランチに対して新しいスキャンを開始できます。スキャンの状態をポーリングできるため、CI/CDプラットフォーム内にゲーティング機構を構築できます。

Aikidoでは、特定のスキャンを自分で管理することもできます。独自のCheckov SARIFやカスタムSBOMをAikidoに直接アップロードして、feature branchスキャンに貢献できます。

## 認証 <a href="#authentication" id="authentication"></a>

1. 次へ移動 [CI統合の詳細ページ](https://app.aikido.dev/settings/integrations/continuous-integration).
2. 認証トークンを生成してコピーします。このトークンは一度しか表示できないことに注意してください。
3. ヘッダーを追加 `X-AIK-API-SECRET` をすべてのリクエストに付与し、その値として認証トークンを設定します。

## 新しいfeature branchスキャンを開始 <a href="#start-a-new-feature-branch-scan" id="start-a-new-feature-branch-scan"></a>

この非同期APIは、特定のコミットに対して新しいfeature branchスキャンを起動します。

`POST /api/integrations/continuous_integration/scan/repository`

**本文:**

```
{
    "version": "1.0.5",
    "branch_name": "branch-name",
    "repository_id": "R_kgDOJf6H8g", 
    "base_commit_id": "1c5a7dda074aa19ebc6aa9f25884b5e0b6bb3662",
    "head_commit_id": "b7deb06d8be6bc4c62277e0a28911b2284cab6da",
    "minimum_severity": "HIGH",
    "fail_on_sast_scan": true,
    "fail_on_dependency_scan": true,
    "fail_on_iac_scan": true,
    "fail_on_secrets_scan": true,
    "fail_on_malware_scan": false,
    "pull_request_metadata": {
        "url": "https://github.com/AikidoSec/some-repo/pull/12",
        "title": "checkov"
    },
    "self_managed_scanners": ["checkov", "json-sbom"],
    "expected_amount_json_sboms": 1,
}
```

**必須フィールド:**

* repository\_id: 内部GitHub/Gitlab/Bitbucket/..リポジトリID
* base\_commit\_id: ベースコミット（PRのために分岐したコミット - PRに関連しない場合は、end\_commit\_idの直前のコミット）
* head\_commit\_id: スキャン対象の最新コミット（ブランチの最後のコミット）
* branch\_name: ブランチ名

**任意フィールド:**

* pull\_request\_metadata.url: プルリクエストURL
* pull\_request\_metadata.title: プルリクエストのタイトル
* self\_managed\_scanners: カスタムスキャンタイプの配列（サポート対象 `checkov` および `json-sbom`）。デフォルトは空の配列\[]です。
* expected\_amount\_json\_sboms: 待機しているカスタムjson-sbomアップロード数の整数。
* fail\_on\_dependency\_scan（デフォルト `true`）：Aikidoが新しい依存関係の問題（CVE）でブロックするかどうかを決定します
* fail\_on\_sast\_scan（デフォルト `false`）：Aikidoが新しいSASTの問題でブロックするかどうかを決定します
* fail\_on\_iac\_scan（デフォルト: `false`）：Aikidoが新しいIaCスキャンでブロックするかどうかを決定します
* fail\_on\_secrets\_scan（デフォルト `false`）：Aikidoが新しい漏えいしたシークレットの問題でブロックするかどうかを決定します
* fail\_on\_malware\_scan（デフォルト `false`）：Aikidoが新しいマルウェアの問題でブロックするかどうかを決定します。
  * **注意：** この機能は全員が利用できるわけではありません。有効化したい場合はAikidoにお問い合わせください。
* minimum\_severity（デフォルト `CRITICAL`）：Aikidoが応答すべき（最低）重大度を決定します `FAILED`。この値には次のいずれかを指定できます `LOW`, `MEDIUM`, `HIGH`, `CRITICAL`.

**レスポンス:**

```
{
    "scan_id": 22
}
```

## feature branchスキャンのステータスをポーリング <a href="#poll-for-feature-branch-scan-status" id="poll-for-feature-branch-scan-status"></a>

スキャンの現在の状態を取得します。CI/CDでゲーティングを実装するには、ポーリング機構（例: 5秒ごと）を使用します。

`GET /api/integrations/continuous_integration/scan/repository?scan_id=1`

**パラメータ:**

* scan\_id (int)

**レスポンス:**

feature branchの例 *スキャン進行中*

```
{
    "all_scans_completed": false,
    "dependency_scan_completed": true,
    "sast_scan_completed": false,
    "iac_scan_completed": false,
    "secrets_scan_completed": false,
    "malware_scan_completed": false,
    "sbom_scan_completed": false // if 'json-sbom' in self_managed_scanners
}
```

feature branchスキャン完了の例

```
{
    "all_scans_completed": true,
    "dependency_scan_completed": true,
    "sast_scan_completed": true,
    "iac_scan_completed": true,
    "secrets_scan_completed": true,
    "malware_scan_completed": true,
    "sbom_scan_completed": true, // if 'json-sbom' in self_managed_scanners
    "new_issues_found": 1,
    "new_dependency_issues_found": 1,
    "new_sast_issues_found": 0,
    "new_iac_issues_found": 0,
    "new_leaked_secret_issues_found": 0,
    "diff_url": "https://app.aikido.dev/featurebranch/scan/1?groupId=1",
    "gate_passed": false
}
```

デ*フォルトブランチスキャン完了*

```
{
    "all_scans_completed": false,
    "dependency_scan_completed": true,
    "sast_scan_completed": false,
    "iac_scan_completed": false,
    "secrets_scan_completed": false,
    "malware_scan_completed": false,
    "open_issues_found": 2,
    "issue_links": [
        "https://app.aikido.dev/queue?sidebarIssue=1",
        "https://app.aikido.dev/queue?sidebarIssue=2",
    ],
    "gate_passed": false
}
```

```
{
    "all_scans_completed": false,
    "dependency_scan_completed": true,
    "sast_scan_completed": false,
    "iac_scan_completed": false,
    "secrets_scan_completed": false,
    "malware_scan_completed": false,
    "open_issues_found": 2,
    "issue_links": [
        "https://app.aikido.dev/queue?sidebarIssue=1",
        "https://app.aikido.dev/queue?sidebarIssue=2",
    ],
    "gate_passed": false,
}
```

```
{
    "all_scans_completed": false,
    "dependency_scan_completed": true,
    "sast_scan_completed": false,
    "iac_scan_completed": false,
    "secrets_scan_completed": false,
    "malware_scan_completed": false,
    "open_issues_found": 2,
    "issue_links": [
        "https://app.aikido.dev/queue?sidebarIssue=1",
        "https://app.aikido.dev/queue?sidebarIssue=2",
    ],
    "gate_passed": false,
}
```

## カスタムスキャン結果をアップロード <a href="#upload-custom-scan-results" id="upload-custom-scan-results"></a>

このAPIを使用して、Syftで生成した独自のCheckov SARIFまたはカスタムSBOMをアップロードできます。Syft SBOMを生成する場合はJSON形式を使用してください。

`POST /api/integrations/continuous_integration/scan/custom`

**本文:**

の例 *Checkov*

```
{
    "scan_id": 22, // optional
    "repository_id": 12,
    "payload_type": "checkov",
    "payload": <checkov_sarif_response>
}
```

の例 *Syft SBOM*

```
{
    "scan_id": 22, // optional
    "repository_id": 12,
    "container_image_name": "image-name",
    "payload_type": "json-sbom",
    "payload": <syft_json_sbom_response>
}
```

**必須フィールド:**

* container\_image\_name: json-sbomに必須です。これにはイメージタグを含めず、イメージの一意な名前のみを指定してください。
* payload\_type
* payload

**任意フィールド:**

* scan\_id: （から取得） *スキャンを開始*）。ペイロードをAikidoのライブフィードに送信したい場合は、これを設定しないでください。
* repository\_id: 内部GitHub/Gitlab/Bitbucket/..リポジトリID（scan\_idが設定されていない場合のみ必須）

**レスポンス:**

```
{
    "success": 1
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://help.aikido.dev/docs/docs-ja/pr-torirsunogtingu/cli-for-pr-and-release-gating/aikido-ci-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
