Overview
On-Demand Code Scans let you submit small units of code to ZeroPath for security analysis without starting a full repository scan. Use them when you want fast feedback from a CLI, IDE integration, pre-commit hook, CI job, or custom tool. You can submit:- A Git diff
- A single file
- Multiple files
- One or more code snippets
On-Demand Code Scans are not full repository scans. They analyze only the code
you submit. Results are returned through the async code scan API and expire
after 7 days.
Target Modes
Every scan request includes atarget. The target controls whether ZeroPath
uses repository context or treats the submitted code as standalone.
When a repository is resolved, ZeroPath can use persisted repository,
application, and threat-model context to improve analysis. Standalone scans use
only the submitted code, optional target metadata, and optional supplemental
context.
Submit a Scan
CallPOST /api/v2/async-code-scans/submit with your code input and target.
202 Accepted:
Poll Status
CallPOST /api/v2/async-code-scans/status with the returned jobId.
queuedrunningcompletedfailed
Fetch Results
CallPOST /api/v2/async-code-scans/results after the job completes.
On-Demand Code Scan results are temporary and are meant to be consumed from the
API response for the submitted job.
Input Shapes
Use exactly one input shape per request.Diff
File
Files
Snippets
Supplemental Context
UseadditionalContext for background information that can help the scanner
interpret the submitted code.
CLI Usage
The ZeroPath CLI includesscan-code for On-Demand Code Scans.
target.kind = "auto" and includes your Git remote URL
when available. Use --repository-id to require linked repository context, or
--standalone to force a scan without repository context.
Limits
Requests over these limits return
413.
Authentication
On-Demand Code Scans use the same API token headers as the rest of the ZeroPath API.repository targets, the caller must be able to start scans on the target
repository. For auto targets, ZeroPath uses repository context only when the
submitted remote URL resolves to exactly one accessible repository. For
standalone targets, the caller only needs authenticated organization context.