---
metadata:
  - name: generator
    content: Diplodoc Platform v5.71.0
alternate:
  - https://sourcecraft.dev/portal/docs/en/sec-api-ref/Start-Scan-Rest-Api/v1scans-post.md?version=sourcecraft.dev
  - https://sourcecraft.dev/portal/docs/en/sec-api-ref/Start-Scan-Rest-Api/v1scans-post.md?version=sourcecraft.dev
  - https://sourcecraft.dev/portal/docs/ru/sec-api-ref/Start-Scan-Rest-Api/v1scans-post.md?version=sourcecraft.dev
  - href: https://sourcecraft.dev/portal/docs/en/sec-api-ref/Start-Scan-Rest-Api/v1scans-post.md?version=sourcecraft.dev
    type: text/markdown
    title: Markdown version
  - href: https://sourcecraft.dev/portal/docs/en/llms.txt?revision=de8783063d4606471485fa652148cd48b46abee3&version=sourcecraft.dev
    rel: describedby
---
> **Documentation capabilities:** Search, read sources, and browse this documentation: [agent guide](https://sourcecraft.dev/portal/docs/docs-api/agent/overview?project=dev-sourcecraft&lang=en&version=sourcecraft.dev).

> **Documentation Index:** Fetch the complete configuration index at https://sourcecraft.dev/portal/docs/en/llms.txt?revision=de8783063d4606471485fa652148cd48b46abee3&version=sourcecraft.dev

<div class="openapi">

# Start a repository source scan in CI

<!-- markdownlint-disable-file -->

Pass {} to use the latest successful default-branch scan's commit, falling back to the default branch HEAD. Repository scanning settings apply. Read the new scan via GET /v1/scans/{scanUuid}.

## Request

<div class="openapi__requests">

<div class="openapi__request__wrapper" style="--method: var(--dc-openapi-methods-post);margin-bottom: 12px">

<div class="openapi__request">

POST {.openapi__method}
```text translate=no
https://appsec.sourcecraft.tech/v1/scans
```

</div>

</div>

</div>

### Query parameters

#|
|| **Name** | **Description** ||
||

_gitRepo_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

Repository identifier. Accepts either internal repository ID (e.g., 88769874964302633) or public UUID (e.g., 0199140f-4343-7c06-a7e3-b835c305b629). These values can be obtained from the getRepo API (fields: id and uuid).

_Pattern:_{.json-schema-reset .json-schema-assertion} `\S`

_Example:_{.json-schema-reset .json-schema-example} ``
{.table-cell}
||
|#{.json-schema-properties}

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "commit": "example",
  "scanUuid": "example",
  "engineType": "UNSPECIFIED"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_commit_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string &#124; null

Full 40-character Git commit SHA. Takes precedence over the selected scan's commit.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_engineType_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string

Engine category to run. Omit or use UNSPECIFIED for the repository's configured engines.

_Enum:_{.json-schema-reset .json-schema-value} `UNSPECIFIED`, `SAST`, `SECRETS`, `SCA`, `SBOM_SPDX`, `SBOM_CYCLONEDX`
{.table-cell}
||
||

_scanUuid_{.json-schema-reset .json-schema-property}
{.table-cell}|
**Type**: string &#124; null

UUID of an earlier scan in this repository to use as the commit source.

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

<div class="openapi-entity">

### RepositoryScanEngine {#entity-RepositoryScanEngine}

**Type**: string

_Enum:_{.json-schema-reset .json-schema-value} `UNSPECIFIED`, `SAST`, `SECRETS`, `SCA`, `SBOM_SPDX`, `SBOM_CYCLONEDX`

</div>

## Responses

<div class="openapi__response__code__202">

## 202 Accepted

CI accepted the new scan

<div class="openapi-entity">

### Body

{% cut "application/json" %}

```json translate=no
{
  "scanUuid": "example",
  "fluxId": "example"
}
```

{% endcut %}

#|
|| **Name** | **Description** ||
||

_fluxId_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
||

_scanUuid_{.json-schema-reset .json-schema-property .json-schema-required}
{.table-cell}|
**Type**: string

_Example:_{.json-schema-reset .json-schema-example} `example`
{.table-cell}
||
|#{.json-schema-properties}

</div>

</div>

<div class="openapi__response__code__400">

## 400 Bad Request

Invalid request body, commit, engine type or scan UUID

</div>

<div class="openapi__response__code__401">

## 401 Unauthorized

Authentication required

</div>

<div class="openapi__response__code__403">

## 403 Forbidden

AppSec scan permission denied

</div>

<div class="openapi__response__code__404">

## 404 Not Found

Repository or selected scan not found

</div>

<div class="openapi__response__code__409">

## 409 Conflict

Scanning is disabled or there is no commit to scan

</div>

<div class="openapi__response__code__502">

## 502 Bad Gateway

CI did not accept the scan

</div>

<div class="openapi__response__code__503">

## 503 Service Unavailable

Repository metadata unavailable

</div>

</div>

[*Deprecated]: No longer supported, please use an alternative and newer version.