Skip to main content

Using the API(Pro)

info

The API access is an enterprise feature only available in the professional or custom package.

Generating an API-Key

To access the API you first need to create an API-Key. Click on your profile in the bottom left corner and the pop-up menu on API Key.

https://dashboard.codeshield.io/user/api-keys

On the API Key page, you'll see the URL of the API and your personal API-Key.

Using the API

Trigger a Scan

To trigger a scan for a repository (AWS Stack, Region, or combination of regions) you must have executed at least one scan in the dashboard. Get the id of a the repository by copying the repoId on the dashboard's overview page.

NEW_SCANID=$(curl -X POST \
'<BACKEND_URL>/repository/<REPOID>/scan' \
-H 'api-key: <MY-API-KEY>' | jq -r '.id')

As a response, a scan of the repository is triggered and the id of the new scan object is returned to you.

{
"id": "string",
"updatedAt": "string",
"createdAt": "string",
}

You can get the status of the current scan using.

curl -X GET \
'<BACKEND_URL>/scan/<SCANID>/status' \
-H 'api-key: <MY-API-KEY>'

Once a scan is finished, you can get the results by invoking.

curl -X GET \
'<BACKEND_URL>/scan/<SCANID>' \
-H 'api-key: <MY-API-KEY>'

You can get a full OpenAPI specification if you click the button Open in Swagger.