API Endpoints
Complete reference for all brin API endpoints
Base URL: https://api.brin.sh
Auth: None required.
##Look up an artifact
/{origin}/{identifier}Look up a single artifact and get its security score.
Supported origins:
| Origin | What it scans | Identifier format | Example |
|---|---|---|---|
npm | npm packages | package or package@version | /npm/express |
pypi | PyPI packages | package | /pypi/requests |
crate | Cargo crates | package | /crate/tokio |
repo | GitHub repositories | owner/repo | /repo/expressjs/express |
domain | Domains | hostname | /domain/example.com |
page | Web pages | hostname/path | /page/example.com/docs |
mcp | MCP servers | owner/repo or registry name | /mcp/owner/repo |
skill | AI agent skills | owner/repo or owner/repo/skill | /skill/owner/repo |
email | Emails | Message-ID (returned after POST) | /email/msg-id@example.com |
commit | Git commits | owner/repo@sha | /commit/owner/repo@abc123 |
contributor | GitHub contributors | username or github:username | /contributor/homanp |
Query parameters:
| Param | Type | Default | Description |
|---|---|---|---|
format | string | json | Response format. Supported values: json, simple, badge. |
details | boolean | false | Include sub_scores in the response. Also forces threats to be included even for non-flagged results. |
refresh | boolean | false | If the existing record is older than 24 hours, enqueue a fresh scan and return the current record with pending_deep_scan: true. |
webhook | string | none | Optional callback URL for scan progress events. Accepted values must start with https://, http://localhost, or http://127.0.0.1. |
tolerance | string | conservative | Controls how the score maps to a verdict. Supported values: conservative, lenient, yolo. See Safety tolerance. |
mode | string | none | If set to full, wait for the worker deep scan to complete and return a non-preliminary result. This does not force Tier 3/LLM; Tier 3 still follows each scanner's normal trigger rules. |
Response:
With ?details=true:
When verdict is suspicious or dangerous, a threats array is included:
##Scan a pull request
/pr/{owner}/{repo}/{number}Scan a GitHub pull request by repository owner, repository name, and pull request number.
Brin stores the repository slug as name and the pull request number as version in the response.
###Request modes
By default, a cache miss returns a provisional response immediately and queues the full pull request scan in the background:
That fast response sets pending_deep_scan: true. The worker then fetches the pull request from GitHub and runs the full scanner asynchronously.
For CI or blocking workflows, use mode=full:
With mode=full, the API enqueues the job and polls until the worker has replaced the pending placeholder with the final pull request result.
###How the PR scanner works
The full scanner combines GitHub metadata, aggregate diff analysis, and conditional LLM review.
| Tier | What it does | Notes |
|---|---|---|
| Tier 1 | Scores the PR author's identity using GitHub account age, contribution history, org memberships, prior commits to the target repo, email-domain reputation, and review status. | Always runs |
| Tier 2 | Scores PR behavior and content using total change size, sensitive-file count, PR title/body quality, agent config changes, security tooling changes, CI workflow tampering, secret detection, comment injection, PR-description injection, and obfuscation heuristics. | Always runs |
| Tier 3 | Prepares a workspace with pr-description.txt, diff.patch, and metadata.json, then asks OpenCode to look for backdoors, agent targeting, sabotage, and other semantic risk. | Runs only when triggered |
Tier 3 is triggered when any of these are true:
- Agent config files were touched
- A critical deterministic threat was found
- Sensitive files were changed
- Lower-trust authors need deeper review
###GitHub data used
The worker pulls these GitHub resources during the full scan:
GET /repos/{owner}/{repo}/pulls/{number}for PR metadataGET /repos/{owner}/{repo}/pulls/{number}/reviewsfor approval state and reviewersGET /repos/{owner}/{repo}/pulls/{number}/filesfor changed files and per-file patchesGET /repos/{owner}/{repo}/pulls/{number}withAccept: application/vnd.github.difffor the aggregate diff- Contributor profile and org lookups for the PR author
- Repo-specific prior commit count for the PR author
###Response
Pass details=true to include sub-scores and all detected threats:
Notes:
pending_deep_scan: truemeans you are still looking at a provisional or stale-refresh result.graphis currentlynullfor pull requests. The scanner emits graph edges, but PR graph scoring is not active yet.
###Webhooks
For async integrations, pass a webhook URL:
Accepted webhook URLs are:
https://...http://localhost/...http://127.0.0.1/...
Events arrive in this order:
| Event | Description |
|---|---|
tier1_complete | Author identity scoring finished |
tier2_complete | Deterministic PR behavior and content checks finished |
tier3_complete | LLM review finished, when Tier 3 ran |
scan_complete | Final stored result |
Each event includes score, verdict, confidence, sub_scores, threats, and tiers_completed.
###Threat types
The PR scanner currently emits these deterministic threat types, plus any matching Tier 3 findings:
| Threat | Severity | Meaning |
|---|---|---|
first_time_contributor | Low | Author has no prior commits to the target repository |
agent_config_tampering | High / Critical | Agent instruction files were modified or newly added |
security_sabotage | Medium | Security tooling config was modified |
supply_chain_mod | Critical | CI workflow patch contains remote script execution patterns |
credential_exposure | Critical | Added lines contain secret or credential patterns |
obfuscation | High | High-entropy additions suggest hidden or encoded payloads |
code_comment_injection | High | Added comments target AI reviewers or agents |
pr_injection | Critical | PR title or body contains AI-targeting instructions |
scan_error | Critical | The PR could not be fetched or parsed correctly |
###CI example
Use mode=full in GitHub Actions when you want a single blocking response:
###Safety tolerance
Tolerance changes verdict thresholds without changing the raw score:
conservative— strictest, best for external or high-risk pull requestslenient— treats scores60+as safeyolo— treats scores40+as safe
##Batch lookup
/bulkLook up up to 100 artifacts in a single request.
Response:
##List and search artifacts
/List and search all scanned artifacts with filtering, sorting, and pagination.
Query parameters:
| Param | Default | Description |
|---|---|---|
origin | — | Filter by origin type (npm, pypi, crate, repo, mcp, skill, domain, page, email, commit, contributor) |
verdict | — | Filter by verdict (safe, caution, suspicious, dangerous) |
confidence | — | Filter by confidence (low, medium, high) |
min_score | — | Minimum score (0–100) |
max_score | — | Maximum score (0–100) |
has_threats | — | true to only return artifacts with threats |
q | — | Full-text search on identifier |
sort | scanned_at | Sort field: scanned_at, score, origin, identifier |
order | desc | Sort direction: asc, desc |
limit | 50 | Results per page (max 200) |
offset | 0 | Pagination offset |
Response:
##Query the trust graph
/graph/{origin}/{identifier}Query the artifact's neighborhood in the trust graph.
Query parameters:
| Param | Default | Description |
|---|---|---|
depth | 2 | Traversal depth (1–5) |
Returns nodes and edges arrays for graph visualization.
##Webhooks
When a webhook URL is provided, brin POSTs progress events as each scan tier completes. Events are delivered with up to 3 retries.
Events: tier1_complete, tier2_complete, tier3_complete, scan_complete
##Response headers
Every response includes:
##Error responses
| Status | Description |
|---|---|
200 | Success |
400 | Bad request |
404 | Entity not found |
500 | Server error |
On this page