API reference
Scan from your own code
Call one endpoint with your lockfile and the API key of a monthly plan. Only files nobody has scanned before count toward your plan; if every file was scanned before, the scan is free and needs no key.
How scanning works
- POST your lockfile or manifest to
/api/paid-scanwith your API key. - The server downloads every package and hashes each file. Files whose exact content was scanned before are free; the rest count toward your plan's tokens.
- The server scans the new files and returns results.
If every file was scanned before, the results come back without a key and cost nothing. New files without an active plan or enough prepaid balance return 402 Payment Required with an error message. A package version whose files changed since its last scan is re-scanned for the changed files only.
Prepaid balance
An account without a plan can pay from a prepaid balance: send your API key and the scan's price comes off the balance before it runs. It costs the quote's balancePriceUsd (GET /api/quotes/:id), and a scan that fails gives it back. A plan's scans never use the balance, and a plan over its token limit gets 429.
Without enough balance the response is 402 with error, balanceUsd (what the account has), priceUsd (what this scan costs from the balance) and topupUrl.
Top-ups happen on the account page, not over the API: sign in, enter at least $20 and pay on Polar's checkout, where VAT or sales tax is added where it applies. The balance needs an account and never expires, and unused balance is refundable from the account page.
Command line and CI
The easiest client is togoder-scan, an open-source (MIT) CLI on npm. It finds the lockfile, waits for the scan, applies .npm-scanner-ignore, exits non-zero on findings and can write SARIF for GitHub code scanning. It uploads only the lockfile and the ignore list, never your code.
npx togoder-scan estimate # what needs scanning, and the price npx togoder-scan login # save an API key (or set NPM_SCANNER_KEY) npx togoder-scan --fail-on high # scan; exit 1 on high or critical findings npx togoder-scan --sarif -o results.sarif
A GitHub Actions workflow is in the README and in Scan your lockfile in CI. The rest of this page is the HTTP API the CLI uses.
/api/paid-scan
Multipart upload with a file field. The file name decides how it's parsed, so keep the original name:
- npm:
package-lock.json,npm-shrinkwrap.json,yarn.lock,pnpm-lock.yaml,bun.lock,package.json - Python:
poetry.lock,uv.lock,Pipfile.lock,requirements*.txt,pyproject.toml - Rust:
Cargo.lock. Go:go.mod,go.sum. Ruby:Gemfile.lock. PHP:composer.lock
The binary bun.lockb is not supported; convert it with bun install --save-text-lockfile --frozen-lockfile --lockfile-only. File contents can also go in a packageLockJson field with the name in fileName.
Manifests with version ranges (package.json, requirements.txt, pyproject.toml) are scanned at the newest matching version, direct dependencies only. Packages outside npm appear in results with an ecosystem prefix, e.g. pypi:requests. With your API key:
curl -X POST https://security.togoder.click/api/paid-scan \ -H "Authorization: Bearer $NPM_SCANNER_KEY" \ -F "file=@package-lock.json"
A single package and its dependencies
Instead of a file, send ecosystem (npm, pypi, cargo, go, gem or composer), packageName and optionally packageVersion (empty means the latest release). The package and its full runtime dependency tree are scanned, resolved the way the installer would pick them:
curl -X POST https://security.togoder.click/api/paid-scan \
-H "Authorization: Bearer $NPM_SCANNER_KEY" \
-H "Content-Type: application/json" \
-d '{"ecosystem":"pypi","packageName":"requests","packageVersion":"2.32.3"}'
To scan an exact list without resolving dependencies, upload a file named packages.list with one ecosystem:name@version per line (the npm: prefix is optional).
Quotes
For large files, see what needs scanning without holding a request open: POST /api/quotes takes the same input as /api/paid-scan and answers 202 with a quoteId while packages download. Poll GET /api/quotes/:id until status is "ready", then call /api/paid-scan with quoteId (form field, JSON field or query). The scan then covers exactly what was quoted, and the request doesn't wait on a download. Quotes are valid for an hour.
curl -X POST https://security.togoder.click/api/quotes -F "file=@package-lock.json" # {"status":"accepted","quoteId":"…","statusUrl":"/api/quotes/…"} curl https://security.togoder.click/api/quotes/<quoteId> # {"status":"ready","free":false,"billableFiles":42,…} curl -X POST "https://security.togoder.click/api/paid-scan?async=1" \ -H "Authorization: Bearer $NPM_SCANNER_KEY" \ -H "Content-Type: application/json" -d '{"quoteId":"<quoteId>"}'
Long scans
Add ?async=1 to answer as soon as the scan starts: the response is 202 with a statusUrl. Poll GET /api/scan-jobs/:id: it returns {"status":"running","progress":{…}} until the scan finishes, then the same body a synchronous scan returns. Results are kept for an hour.
curl -X POST "https://security.togoder.click/api/paid-scan?async=1" ...
# {"status":"accepted","jobId":"…","statusUrl":"/api/scan-jobs/…"}
curl https://security.togoder.click/api/scan-jobs/<jobId>
Example
import { readFile } from 'node:fs/promises'; const form = new FormData(); form.append('file', new Blob([await readFile('package-lock.json')]), 'package-lock.json'); const res = await fetch('https://security.togoder.click/api/paid-scan', { method: 'POST', headers: { Authorization: `Bearer ${process.env.NPM_SCANNER_KEY}` }, body: form, }); console.log(await res.json());
Findings & ignore lists
The response has results (per package: riskLevel, effectiveRiskLevel, ignoredCount, issues), a flat issues list and a summary (packagesScanned, packagesFailed, totalIssues, highSeverityCount, ignoredCount).
Every finding has a stable findingId like NPS-3F9A0C1B2D4E: a hash of the package name, the file's SHA-256, the finding type and line. It stays the same across rescans and across versions that ship the same file.
Send an ignore field with /api/paid-scan (form field, or a string or array in JSON) to set reviewed findings aside. One entry per line, # starts a comment that comes back as the reason:
# .npm-scanner-ignore NPS-3F9A0C1B2D4E # reviewed: documented telemetry NPS-0811DA3A5FA0@2.1.0 # only in this version left-pad@1.3.0 # every finding of this version @acme/internal-tool # every finding of this package
curl -X POST https://security.togoder.click/api/paid-scan -H "Authorization: Bearer $NPM_SCANNER_KEY" -F "file=@package-lock.json" -F "ignore=<.npm-scanner-ignore"
Matched findings get ignored: true, ignoredBy and ignoreReason; they don't count in totalIssues or highSeverityCount, and effectiveRiskLevel drops to the worst remaining finding. Ignoring only changes your response; stored results are untouched. A malformed list returns 400.
Monthly plans & API keys
Sign in with GitHub or Google (the first sign-in creates your account), pick a plan and create an API key
on the same page. Plans: Starter $69/month for 100M LLM tokens per 30 days, Team $199 for 350M, Business $499 for 1B and
Scale $3,999 for 10B (pricing). Payment is by card, Apple Pay or Google Pay, handled by Polar. Access starts
as soon as the payment is confirmed and renews monthly; change plan or cancel any time from the account page.
Send the key with /api/paid-scan and the scan runs on your plan:
curl -X POST https://security.togoder.click/api/paid-scan \ -H "Authorization: Bearer $NPM_SCANNER_KEY" \ -F "file=@package-lock.json"
X-API-Key: <key> works too. Your plan's tokens are counted
from what the model actually processed over the last 30 days; files scanned before are free. Over the limit, scans return 429.
Without access, it pays from your prepaid balance if that covers the scan. Without access, a scan with new files returns 402 with an error message; files scanned before stay free. An unknown or revoked key returns 401.
The endpoints below take an API key, or the sign-in cookie when called from this site.
/api/accountAccess end date, plan, token limit (monthlyTokenLimit, and subscription.tokenLimit after a plan change this period), subscription status and management links, claim code and LLM token usage over the last 30 days.
/api/keysList the account's keys (prefix only; full keys are never shown again).
/api/keysCreate a key. JSON body {"name": "CI"}. The response holds the key once. Up to 20 active keys.
/api/keys/:idRevoke a key. An account with a sign-in can revoke all its keys; an older key-only account keeps its last one.
Sign-in & billing
These are what the account page uses. Upgrades are charged the prorated difference right away, and the extra tokens are prorated for the rest of the billing period; downgrades charge nothing now and keep the higher limit until renewal. Requests made with the sign-in cookie must come from this site.
/auth/:providerSign in with github or google; ?next=/path is where to return. Signed in, it links the provider to your account. POST /auth/logout signs out.
/api/meWhether this browser is signed in, with the account and its GitHub / Google logins. DELETE /api/me/logins/:provider unlinks one (never the last); POST /api/account/link-key claims an account made with an API key before sign-in existed.
/api/plansPlans on offer with their token limits and prices, your current plan, and which checkout provider is in use.
/api/billing/checkoutSigned-in browser only: JSON body {"plan": "team"} returns the url of a hosted Polar checkout to send the customer to.
/api/billing/change-planSwitch plan: JSON body {"plan": "team"}. ?preview=1 returns the charge due now, the next renewal and the token limit without changing anything.
/api/billing/cancelCancel at the end of the paid period ({"immediately": true} ends access now, without a refund). POST /api/billing/resume-cancel undoes a scheduled cancel.
/api/billing/portalA signed-in link into Polar's customer portal for invoices and the payment method.
Free endpoints
Read cached data or see what needs scanning. These never run a scan.
/api/package/:name/:versionCached scan results for one package.
/api/package/:name/rangesEvery version of a package grouped into ranges by verdict (flagged, warning, clean, failed, not_scanned), with ecosystem-native and semver constraints and the flagged files traced across versions. Also GET /api/package-ranges?name=. Names may be scoped or prefixed (pypi:requests); ?registry=0 skips the registry lookup, ?prereleases=exclude drops prereleases.
/api/packagesEvery scanned package version with overall stats. Query q, risk (safe…critical or issues), limit (max 200), offset. Findings of one: GET /api/packages/:id/issues.
/api/analyzeWhich packages in a lockfile are cached and which need scanning.
/api/uploadParse a lockfile, or resolve a package entered by name (ecosystem, packageName, packageVersion) with its dependency tree, and list the dependencies (htmx partial).
/api/estimate-costDownload packages and count tokens for a quote (htmx partial). Answers right away with a partial that polls GET /api/estimate-cost/jobs/:id until the quote is ready.
Guarantees
- Server-side counting. Plan usage comes from what the model actually processed. Clients cannot set it.
- Checked before work. Access and the plan's token limit are checked before any scan of new files runs.
- Failures are explicit. Packages that couldn't be analyzed come back as
failed, never as safe.