---
title: "Upload and Scan"
method: POST
path: "/api/v1/scans/upload-and-scan"
tags: ["Scans"]
---

# Upload and Scan

`POST /api/v1/scans/upload-and-scan`

## Request

- Base URL: `https://zeropath.com`
- URL: `https://zeropath.com/api/v1/scans/upload-and-scan`
- Auth: API key in header `X-ZeroPath-API-Token-Id` and API key in header `X-ZeroPath-API-Token-Secret`

Uploads repository content in chunks and initiates a scan. Use this endpoint multiple times to upload large repositories:

1. First request: Send without fileId, with chunkIndex=0
2. Subsequent requests: Include the fileId returned from the first request
3. Final request: Set chunkIndex to totalChunks-1

The scan will start automatically after the final chunk is received.

## Request body

- object
  - `organizationId` string: Organization ID the repository belongs to
  - `repositoryId` string, required: ID of the repository to scan
  - `chunk` string, required: Base64 encoded content chunk of the repository
  - `chunkIndex` number, required: Index of this chunk in the total set
  - `totalChunks` number, required: Total number of chunks for this scan
  - `fileId` string: File ID returned from the first chunk upload. Do not include for the first request (when chunkIndex is 0)

## Response `200`

Chunk uploaded successfully. If this was the final chunk, scan is also started.

- object
  - `fileId` string, required: File ID to use for subsequent chunk uploads
  - `scanId` string: ID of the created scan. Only returned after the final chunk is uploaded

---

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