Create a cost estimation
Copy page
Create a cost estimation
A cost estimation resolves the repositories you plan to test, detects the applications in them, and returns a predicted credit cost. POST /scans needs a completed or partial cost estimation with a positive total_credits value.
Cost estimations run asynchronously. The POST returns a record in pending or running state. Poll GET /cost-estimations/{id} until status reaches completed, partial, or failed.
Terminal statuses
| Status | Meaning |
|---|---|
completed |
Every repository was estimated. total_credits is populated. |
partial |
Some repositories completed and others failed. repo_results[].status has the details. |
failed |
The whole estimation failed. error holds a message. |
An estimation in a terminal state can’t change. To start the pentest, pass its id as cost_estimation_id to POST /scans. The pentest must use the same repositories, branches, and path scope as the estimate.
Repository scope
Each repository can set include_paths and exclude_paths with path patterns. Empty include paths select the whole repository, and exclude paths remove matches from that selection. For example:
{ "include_paths": ["services/gateway/**"], "exclude_paths": ["**/tests/**", "*.md"]}Pass the same path scope when you start the pentest. To change it, create a new estimate first.
Request
POST /cost-estimations
Send an API key
with the write scope
in the X-Api-Key header.
Body
A required application/json body.
| Field | Description |
|---|---|
name string | Friendly name for this estimation. |
repos array of object, required | Repositories to estimate. |
When source is connected | |
repos[]. string, required | Source type. Always connected. Default connected. |
repos[]. string, required | Repository URL. |
repos[]. string, required | Branch name. |
repos[]. number | GitHub App installation ID. Omitted for PAT-based connections (e.g. GitHub Enterprise), where the installation is resolved from repo_url and the organization instead. |
When source is public | |
repos[]. string, required | Source type. Always public. |
repos[]. string, required | Repository URL. |
repos[]. string, required | Branch name. |
When source is upload | |
repos[]. string, required | Source type. Always upload. |
repos[]. string, required | Scan archive ID. |
Responses
201 Created
| Field | Description |
|---|---|
id string, required | Estimation UUID. |
organization_id string, required | Organization UUID. |
user_id string, required | User UUID. |
name string | Friendly name for this estimation. |
task_id string, required | Task identifier. |
status string, required | Estimation status. One of pending, running, completed, partial, or failed. |
repos array of object, required | Input repositories. |
repos[]. string | Source type. One of connected, public, or upload. |
repos[]. string | Repository URL. |
repos[]. string | Branch name. |
repos[]. string | Resolved commit SHA. |
repos[]. string | Archive ID (for upload sources). |
total_credits number | Total estimated credits across all repos. |
repo_results array of object | Per-repo estimation results. |
repo_results[]. string, required | Repository URL. |
repo_results[]. string | Branch name. |
repo_results[]. string | Commit SHA. |
repo_results[]. string, required | Result status. One of completed or failed. |
repo_results[]. boolean, required | Whether result was served from cache. |
repo_results[]. array of object | Detected applications. |
repo_results[]. string, required | Application name. |
repo_results[]. string, required | Application root path. |
repo_results[]. string | Architecture description. |
repo_results[]. number | Estimated credits for this repo. |
repo_results[]. string | Error message (when status is failed). |
repo_results[]. string | Structured failure reason. One of unsupported_language or scope_no_match. |
repo_results[]. array of string | Detected unsupported languages among the top languages. |
repo_results[]. number | Files that matched the repository's whitebox scope rules, counted on disk before analysis. Absent for unscoped repositories. |
error string | Error message. |
triage_required boolean, required | Whether human triage is mandatory for a scan of this estimation (large app, above the predicted-cost threshold). The customer cannot opt out when true. |
triage_fee_credits number, required | Triage fee in credits (a percentage of the scan base credits) added when triage is enabled. |
created_at string (date-time), required | Timestamp when estimation was created. |
updated_at string (date-time), required | Timestamp when estimation was last updated. |