---
title: "Trigger scan"
method: POST
path: "/scans"
tags: ["Scans"]
---

# Trigger scan

`POST /scans`

## Request

- Base URL: `https://app.codethreat.com/api/v1`
- URL: `https://app.codethreat.com/api/v1/scans`
- Auth: API key in header `X-API-Key`

Trigger a new security scan for a repository

## Request body

- CreateScanRequest
  - `repositoryId` string, required
  - `scanTypes` string[]
  - `branch` string
  - `commit` string

## Response `201`

Scan created

- ScanResponse
  - `success` boolean
  - `data` object
    - `id` string
    - `repositoryId` string
    - `status` 'PENDING' | 'SCANNING' | 'COMPLETED' | 'FAILED'
    - `scanTypes` string[]
    - `branch` string
    - `commit` string
    - `startedAt` string, date-time
    - `completedAt` string, date-time
    - `duration` integer
    - `violationCount` object
      - `critical` integer
      - `high` integer
      - `medium` integer
      - `low` integer
      - `info` integer
  - `pagination` Pagination
    - `page` integer
    - `limit` integer
    - `total` integer
    - `totalPages` integer
    - `hasNext` boolean
    - `hasPrev` boolean
  - `meta` ResponseMeta
    - `timestamp` string, date-time
    - `version` string
    - `requestId` string
    - `organizationId` string

---

[API](https://skmtc.dev/codethreat/apis/codethreat-api.md) - [All operations](https://skmtc.dev/codethreat/apis/codethreat-api/llms.txt) - [OpenAPI document](https://skmtc.dev/codethreat/apis/codethreat-api/revisions/18f11fecbb30?raw)
