Before you start
You need an API key. Create one in the app under Settings, API keys. The key is shown once; store it as a secret in your CI. A key belongs to one workspace and can do what the scan pages of that workspace can do.
Every request goes to https://atomicsecurity.app/api/v1 and carries the key in a header:
export ATOMIC_API_KEY=ask_live_...
API=https://atomicsecurity.app/api/v1
curl -sS "$API/me" -H "Authorization: Bearer $ATOMIC_API_KEY"
If that prints your workspace, the key works. The API is meant for servers and pipelines: keep keys out of code that runs in a browser.
Run a scan
A scan is three calls. The file (an APK, an App Bundle .aab, or a split bundle .xapk / .apks) goes straight to storage, not through the API.
1. Create the scan. Say what you are about to upload:
APK=app-release.apk
SIZE=$(wc -c < "$APK" | tr -d ' ')
curl -sS -X POST "$API/scans" \
-H "Authorization: Bearer $ATOMIC_API_KEY" \
-H "Content-Type: application/json" \
-d "{\"filename\": \"$APK\", \"size_bytes\": $SIZE}"
{
"scan_id": "0b9f7c52-4f0e-4c7a-9a43-5d0d6f1e2a10",
"status": "pending_upload",
"upload_url": "https://...",
"upload_expires_at": "2026-11-14T09:15:00Z",
"upload_headers": { "Content-Type": "application/vnd.android.package-archive" }
}
2. Upload the file to upload_url with a PUT, before upload_expires_at. Send the headers from upload_headers exactly: the URL is signed for them and for the size you declared, and a request with another content type or another length is refused. This request takes no Authorization header.
curl -sS -X PUT "$UPLOAD_URL" \
-H "Content-Type: application/vnd.android.package-archive" \
--upload-file "$APK"
3. Start it:
curl -sS -X POST "$API/scans/$SCAN_ID/start" \
-H "Authorization: Bearer $ATOMIC_API_KEY"
Starting a scan uses one scan of your plan. A scan that fails or times out on our side is not charged.
Follow the scan
Findings arrive while the scan runs. Ask for them with a cursor:
curl -sS "$API/scans/$SCAN_ID/findings?since=0&limit=200" \
-H "Authorization: Bearer $ATOMIC_API_KEY"
The answer has items (the findings after since), next_cursor and scan_status. Call again every few seconds with since set to the last next_cursor, until scan_status is one of succeeded, failed, timeout or cancelled. The same answer carries the progress (plugins_done of plugins_total) and, at the end, an error if there was one.
A finding has a rule_id, a kind (vulnerability or observation), a severity (critical, high, medium, low, info), a title, a description, a recommendation and its evidence. Observations describe the app (permissions, libraries, posture); only vulnerabilities should gate a build. A finding you marked as a false positive carries false_positive.
Get the report
curl -sS "$API/scans/$SCAN_ID/export?format=sarif" \
-H "Authorization: Bearer $ATOMIC_API_KEY" -o scan.sarif
format is json, csv, sarif, html or pdf. For SARIF that you hand to another service, add profile=code-scanning: it holds the open vulnerabilities only and leaves the evidence out, so a secret the scan found is not copied elsewhere. Each result then links back to the finding here.
In GitHub Actions
- uses: atomicsecurity/scan-action@v1
with:
api-key: ${{ secrets.ATOMIC_API_KEY }}
apk-path: app/build/outputs/apk/release/app-release.apk
fail-on: critical
The step uploads the APK, waits for the scan and fails the build when a vulnerability is at or above fail-on (default critical). Most apps have findings at high on their first scan, many of them in bundled SDKs. Start at the default, mark what does not apply as a false positive in the app, then lower the threshold to high. To see the findings as alerts in the repository's Security tab, write SARIF and upload it:
permissions:
contents: read
security-events: write
steps:
- uses: atomicsecurity/scan-action@v1
with:
api-key: ${{ secrets.ATOMIC_API_KEY }}
apk-path: app/build/outputs/apk/release/app-release.apk
sarif-output: atomic.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always() && hashFiles('atomic.sarif') != ''
with:
sarif_file: atomic.sarif
category: atomic
Code scanning is free on public repositories. On a private one, GitHub accepts the upload only with its paid Code Security add-on; without it, leave the upload step out: the gate and the job summary work on their own.
apk-path can also point at an App Bundle, for example app/build/outputs/bundle/release/app-release.aab. The scan reads every module of the bundle and lists anything it could not read. Its signature is your upload key's, so the report names that key (or says the bundle is unsigned or debug-signed) instead of rating APK signing.
Inputs, outputs and troubleshooting are in the action's README.
In any other CI
The action is one Python file without dependencies. It runs wherever Python 3.9 or newer does:
curl -fsSLO https://raw.githubusercontent.com/atomicsecurity/scan-action/v1/atomic_scan.py
ATOMIC_API_KEY="$ATOMIC_API_KEY" \
ATOMIC_APK_PATH=app/build/outputs/apk/release/app-release.apk \
ATOMIC_FAIL_ON=critical \
python3 atomic_scan.py
| Exit code | Meaning |
|---|---|
0 |
Passed: nothing at or above the threshold |
1 |
A vulnerability is at or above the threshold |
2 |
The scan could not be started: key, credits, upload or inputs |
3 |
The scan did not finish in time or did not succeed |
Mark a false positive
A finding you mark stops gating the next build, and the mark is listed with who set it and why.
curl -sS -X POST "$API/scans/$SCAN_ID/findings/$FINDING_ID/false-positive" \
-H "Authorization: Bearer $ATOMIC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"reason": "test fixture, not shipped"}'
DELETE on the same path removes the mark.
Compare two versions
curl -sS "$API/scans/$SCAN_ID/diff?from=$EARLIER_SCAN_ID" \
-H "Authorization: Bearer $ATOMIC_API_KEY"
The answer lists the findings that are new in this scan and the ones that were fixed since the earlier one, for two scans of the same app. A finding that only moved inside its method counts as unchanged. GET /scans/{id}/versions lists the scans of the same app.
Endpoints
| Method | Path | What it does |
|---|---|---|
GET |
/api/v1/me |
check a key |
POST |
/api/v1/scans |
create a scan and get the upload URL |
GET |
/api/v1/scans |
list scans |
GET |
/api/v1/scans/{id} |
scan status and metadata |
POST |
/api/v1/scans/{id}/start |
queue the scan after the upload |
POST |
/api/v1/scans/{id}/cancel |
cancel a scan |
POST |
/api/v1/scans/{id}/rescan |
scan the same file again |
GET |
/api/v1/scans/{id}/findings |
findings, cursor-paginated |
GET |
/api/v1/scans/{id}/export |
JSON, CSV, SARIF, HTML or PDF |
GET |
/api/v1/scans/{id}/history |
earlier scans of the same file |
GET |
/api/v1/scans/{id}/versions |
scans of the same app |
GET |
/api/v1/scans/{id}/diff |
new and fixed findings against another scan |
POST |
/api/v1/scans/{id}/findings/{id}/false-positive |
mark a finding as a false positive |
DELETE |
/api/v1/scans/{id}/findings/{id}/false-positive |
remove the mark |
GET |
/api/v1/false-positives |
list the marks |
GET |
/api/v1/applications |
apps of the workspace |
{id} is the id of a scan or of a finding. Lists take page and page_size.
Errors and limits
Errors are JSON with a detail that says what happened.
| Status | Meaning |
|---|---|
401 |
No key, or the key is wrong or revoked |
402 |
The workspace has no scans left |
403 |
A free workspace must verify its email address before its first scan |
404 |
No such route, or the scan belongs to another workspace |
409 |
The scan is not in a state for this call, for example started before the upload arrived |
413 |
The file is larger than 500 MB, or a request body is over 64 KB |
415 |
A request body that is not application/json |
422 |
A field is missing or malformed |
429 |
The workspace already has 5 scans in progress: wait for one to finish |
503 |
The scan queue is full: try again in a few minutes |
Two things that surprise clients:
- Python's built-in
urllibidentifies itself asPython-urllib, which our network edge refuses with403and the texterror code: 1010. Set your ownUser-Agentheader. Other HTTP libraries are not affected. - The upload URL only accepts the request it was signed for. If storage answers
SignatureDoesNotMatch, compare the content type and the file size with what you declared.