Skip to content

Start a scan

POST
/v1/scans
curl --request POST \
--url https://api.devsecure.io/v1/scans \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "type": "code", "title": "API scan", "description": "example", "environment": "prod", "repository_id": "example", "repository_url": "example", "branch": "example", "target_url": "example", "dast_profile": "baseline", "api_definition_url": "example", "image_ref": "ghcr.io/acme/app:1.4.2", "registry_credentials": { "username": "example", "password": "example" } }'

Starts a code, DAST, container or pentest scan and returns it with status queued. The scope needed depends on type. DAST targets must be authorised for the workspace and pentest targets approved by a person. Quotas and plan limits apply as in the dashboard.

Idempotency-Key
string
<= 255 characters /^[A-Za-z0-9_\-:.]{1,255}$/

Makes the request safe to retry for 24 hours. Same key and same request: the first response is replayed. Same key, different request: 409 idempotency_conflict.

Media typeapplication/json
ScanCreate

Start a scan. Which fields apply depends on type.

object
type
required
Type
string
Allowed values: code dast container pentest
title
Title
string
default: API scan >= 1 characters <= 200 characters
description
Any of:
string
<= 2000 characters
environment
Any of:
string
Allowed values: prod staging dev
repository_id
Any of:
string
<= 64 characters
repository_url
Any of:
string
<= 500 characters
branch
Any of:
string
<= 255 characters
target_url
Any of:
string
<= 2048 characters
dast_profile
Dast Profile

Dast only.

string
default: baseline
Allowed values: baseline api
api_definition_url
Any of:
string
<= 2048 characters
image_ref
Any of:
string
<= 255 characters
registry_credentials
Any of:
RegistryCredentials
object
username
required
Username
string
>= 1 characters <= 255 characters
password
required
Password
string format: password
>= 1 characters <= 4096 characters

Accepted.

Media typeapplication/json
Scan
object
id
required
Id
string
type
required
Type
string
Allowed values: code upload dast container pentest cms other
provider
Any of:
string
Allowed values: github gitlab bitbucket
title
Any of:
string
description
Any of:
string
status
required
Status
string
Allowed values: queued running completed failed unknown
error_code
Any of:
string
environment
Any of:
string
Allowed values: prod staging dev
repository
Any of:
ScanRepository
object
id
required
Id
string
provider
required
Provider
string
Allowed values: github gitlab bitbucket container
name
required
Name
string
target
Any of:
string
created_at
Any of:
string
updated_at
Any of:
string
completed_at
Any of:
string
Example
{
"id": "1042",
"type": "code",
"provider": "github",
"title": "Nightly scan",
"status": "queued",
"environment": "prod",
"repository": {
"id": "repo_3f9a0c2d4b1e8f7a6c5d4e3f",
"provider": "github",
"name": "acme/payments-api"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

X-RateLimit-Limit
integer

Requests allowed per window.

X-RateLimit-Remaining
integer

Requests left in the window.

X-RateLimit-Reset
integer

Seconds until the window resets.

The request is not valid (validation_error, invalid_cursor).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "validation_error",
"message": "The request is not valid.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Missing, unknown, expired or revoked credential (invalid_credentials).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "invalid_credentials",
"message": "The credential is missing, invalid, expired or revoked.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

The credential may not do this (insufficient_scope, permission_denied, plan_not_allowed, quota_exceeded, target_not_authorized).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "insufficient_scope",
"message": "The credential does not have the scope this operation needs.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Conflicts with the current state or an earlier Idempotency-Key (conflict, idempotency_conflict).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "idempotency_conflict",
"message": "This Idempotency-Key was already used for a different request.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Too many requests (rate_limited).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "rate_limited",
"message": "Too many requests. Retry after the time in Retry-After.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

X-RateLimit-Limit
integer

Requests allowed per window.

X-RateLimit-Remaining
integer

Requests left in the window.

X-RateLimit-Reset
integer

Seconds until the window resets.

Retry-After
integer

Seconds to wait before retrying.

Unexpected error (internal_error). Quote the request id to support.

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "internal_error",
"message": "Something went wrong on our side.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

Not available yet in this deployment (not_implemented).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "not_implemented",
"message": "This operation is not available yet.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.

A DevSecure service this operation needs did not answer (upstream_unavailable).

Media typeapplication/json
ErrorEnvelope
object
error
required
ErrorBody
object
code
required
Code
string
message
required
Message
string
request_id
required
Any of:
string
details
Any of:
Array<object>
ErrorDetail
object
field
Any of:
string
message
required
Message
string
Example
{
"error": {
"code": "upstream_unavailable",
"message": "A service this operation needs is unavailable. Try again later.",
"request_id": "req_3f0c2a9d5b6e4f7a8c1d2e3f4a5b6c7d"
}
}
X-Request-ID
string

Identifies the request; quote it to support.