API, CLI and CI gate
Everything the app does over HTTP, the command line client, the gate for your pipeline, and how webhooks are signed.
On this page
The API
Base URL https://app.enfoa.com/api/v1. The version is part of the address. Nothing answers under /api without it. Authenticate with Authorization: Bearer <key>. An admin or owner creates API keys. Each key has a name and can be revoked. It has a scope and expires after a year, or after 1 to 365 days if you set that. An owner can make a key that never expires.
fullcan run scans, manage targets and schedules and read everything.scanreads everything and starts, cancels and retests scans, which is what a pipeline needs.readcan only read.
A scan or read key is not shown a target's system prompt, request body or headers. That holds on the target, on its scans and schedules and on the suggested fix. No key can change billing, members or security policy. The interactive reference with every route and schema is at https://app.enfoa.com/api/v1/docs.
Every response carries an X-Request-Id. Quote it when you write to us. Every error has a detail text and an error object. The object holds a stable code (such as unauthenticated, plan_limit, forbidden, not_found, validation_error, rate_limited, key_scope), a message and the request id. An error about one field names it in error.field. A target address on a local or private network answers HTTP 422 with error.field set to url, base_url or git_url.
Every list answers with one object: data (the rows), next_cursor and has_more. Ask with limit (50 by default, 200 at most). To get the next page, send next_cursor back as cursor, exactly as you received it. Repeat until it is null. A cursor is opaque, so do not build or change one. Some lists carry more beside their rows, such as the totals by status on GET /api/v1/findings and total on GET /api/v1/scans.
Anything that starts a scan (POST /api/v1/scans, a retest of failed cases, a retest of one finding and running a schedule now) accepts an Idempotency-Key header. Use any string of up to 255 characters that is unique to this attempt, such as your CI job's id. The same key may arrive again within 24 hours, because an answer was lost or a step was retried. You then get the scan the first call started, with the header Idempotent-Replayed: true. Nothing is started or counted twice. The same key with a different request is refused with HTTP 409. The command-line tool sends one on its own, and so does the app for every scan it starts.
Anything outside your plan answers HTTP 402 with a JSON body that names the feature or the quota, the limit and your usage. Create a scan like this:
export ENFOA_API_KEY=...
# list targets to find the id (and verification state)
curl -s https://app.enfoa.com/api/v1/targets -H "Authorization: Bearer $ENFOA_API_KEY"
# dry run: case count, charge, quota position and every blocker, charges nothing
curl -s https://app.enfoa.com/api/v1/scans/estimate \
-H "Authorization: Bearer $ENFOA_API_KEY" -H "Content-Type: application/json" \
-d '{"target_id":"TARGET_ID",
"plugins":["prompt-extraction","pii-direct","indirect-injection"],
"strategies":["plain","base64"],
"config":{"attempts":1,"purpose":"support agent for invoices"}}'
# the same body creates the scan
curl -s https://app.enfoa.com/api/v1/scans \
-H "Authorization: Bearer $ENFOA_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{"target_id":"TARGET_ID",
"plugins":["prompt-extraction","pii-direct","indirect-injection"],
"strategies":["plain","base64"],
"config":{"attempts":1,"purpose":"support agent for invoices"}}'
# afterwards
curl -s https://app.enfoa.com/api/v1/scans/SCAN_ID/findings -H "Authorization: Bearer $ENFOA_API_KEY"
curl -s "https://app.enfoa.com/api/v1/scans/SCAN_ID/report?format=md" -H "Authorization: Bearer $ENFOA_API_KEY"
curl -s "https://app.enfoa.com/api/v1/scans/SCAN_ID/gate?fail_on=new&min_severity=medium" -H "Authorization: Bearer $ENFOA_API_KEY"
The gate does not pass a scan that tested too little. A case gives no verdict when it ended in an error (the agent did not answer). The same goes for a case that did not apply to the agent (it called no tool, for example). With min_tested you set the share of cases that must have given one: 0 to 100, default 50, --min-tested in the CLI. The answer says how many did under tested. A scan in which no case gave a verdict never passes.
GET /api/v1/catalog/presetslists the presets and what your plan lacks.GET /api/v1/scans/{id}/eventsstreams progress.GET /api/v1/scans/{id}/diffclassifies cases as new, fixed, still failing, still passing or removed against the previous completed full scan of the target. A retest is never that scan.againstnames another scan and is taken as given.POST /api/v1/scans/{id}/replaystarts a retest of the failed cases.POST /api/v1/scans/{id}/cancelstops a scan. Its charge is final oncestats.settledis true.GET /api/v1/targets/{id}/historyreturns every scan of a target with its attack success rate. A retest hasasr: nulland aretest_outcome.full_scansandretestscount the two apart.GET /api/v1/catalogalso returnsbenchmark_sources, the public datasets behind the benchmark sets with their versions and licences.GET /api/v1/scans/{id}/guardrail-policytakesformat=json,md,bedrockorbedrock-cli.GET /api/v1/cataloggives each probe and each strategy aname, its name for people, beside itsid.POST /api/v1/scans/bulkstarts up to 20 scans in one request. The body isscans, a list of bodies asPOST /api/v1/scanstakes them. Each is checked like a single scan, and each check counts the scans before it in the list. They all start or none does. A refusal names the scan that did not fit byindexandtarget_id, and nothing is started or charged. The trial scan cannot be in the list. Ascankey may call it, and it takes anIdempotency-Keylike a single start.
Scans: search, filters and order
GET /api/v1/scans lists the organisation's scans, newest first. It takes these parameters and returns total, the number of scans that match, beside the rows. It also returns counts: scans, retests, drafts and cancelled, which add up to total.
| Parameter | Meaning |
|---|---|
q | The target's name, the preset, a size such as 9 probes × 6 strategies, the word for what the scan is (retest, proof run, prompt test) or the start of the id. Up to 200 characters |
state | queued, running, vulnerable, resisted, review, failed or cancelled. It may be sent several times |
target_id | It may be sent several times |
kind | full, retest, scheduled, ci, prompt or proof. It may be sent several times |
sort | started (the default), duration, failed or rate |
order | asc or desc. Every sort starts with desc |
The rate is failed cases over tested cases. A scan with nothing tested has no rate, and neither has a retest, so both sort last in either order. A scan started with an API key carries config.via_key, and kind=ci finds it. A cursor belongs to the sort and order it was made with.
Findings: filters, order and export
GET /api/v1/findings takes these parameters beside status and severity. Without status it lists the open and reopened findings.
| Parameter | Meaning |
|---|---|
q | Text in the title, probe, strategy, case, owner or target name. Up to 200 characters |
target_id, agent_id, owner | Each may be sent several times. An empty owner means unassigned |
exclude | target, agent or owner: that filter then means "is not" |
due | overdue, week, month or none (no due date) |
sort | risk (the default), severity, opened, due or last_seen |
order | asc or desc. Each sort has its own default |
group | Only the findings of one group. The value is the key of a row of GET /api/v1/findings/groups |
GET /api/v1/findings/groupstakes the same filters, sort and cursor. It returns one row for each vulnerability on a target, counted over every finding that matches. A row carrieskey,title,findings, the worstseverity, the highestrisk,due_first,owners,unassigned,statusesandtop, its finding with the highest risk. Beside the rows it returnstotalandgroups.GET /api/v1/findings/ownerstakes an optionalq. It returns up to 20 owners used on your findings, the most used first, each with its number of findings.
A cursor belongs to the sort and order it was made with. Sent with another, it is refused with HTTP 422, and you start again without a cursor. Each finding carries trend (new, returned or null) and retest_scan_id while a retest of it runs. comments is the number of comments on it, and 0 on a plan without comments. The list carries overdue_total beside the totals by status. It also carries practice_open, the number of open findings that are on the practice agent. Those findings are inside every total.
GET /api/v1/findings/export.csv takes the same parameters and returns the list as a CSV file (Team and above). It holds at most 10,000 rows. The headers X-Export-Limit, X-Export-Total and X-Export-Truncated say whether the file stops early. The file has a comments column, and probe_name and strategy_name as its last two columns. PATCH /api/v1/findings/{id}/assignment refuses a due_at on a day before today (UTC) with HTTP 422.
GET /api/v1/findings/{id}/detail returns one finding with its meaning, its fix, its evidence and its activity. history lists the latest 50 scans that tested it, newest first, each with a scan_label. history_truncated says when there are more. timeline holds the same scans oldest first, each with an outcome (failed, resisted or not tested) and its marks (opened, fixed, came back). An accepted risk is an entry of its own with kind: "change". held is the exchange of the latest scan that resisted the test after its last failure, or null. last_failed_at is when the newest failing scan finished. failed_after_fix names a scan that failed after the recorded fix, and is null in the ordinary course.
Comments on a finding
Comments need Team or above. A plan without them answers HTTP 402.
GET /api/v1/findings/{id}/commentslists the comments, oldest first, as a cursor list. Beside the rows it carriestotal,max_charsandedit_minutes. A removed comment stays in the list withremoved: trueand an emptybody.POST /api/v1/findings/{id}/commentsadds one frombody, plain text of up to 4,000 characters. It needs the member role or afullkey.PATCH /api/v1/findings/{id}/comments/{comment_id}changes the text. Only the author may, within 15 minutes of writing it. Later it answers HTTP 409.DELETE /api/v1/findings/{id}/comments/{comment_id}removes a comment. The author may, and so may an admin, an owner or afullkey.POST /api/v1/findings/{id}/comments/{comment_id}/restoreputs a comment back. Only the person who removed it may, within 15 minutes.
Each comment carries by, by_key, mine, created_at, edited_at, removed_at, editable_until, removable and restorable_until. A read or scan key reads comments and gets by: null. A comment of another organisation or of another finding answers HTTP 404.
Audit log
GET /api/v1/auth/audit lists the organisation's security events, newest first. It is for owners, admins and full keys. It takes these parameters and returns total, the number of events that match, beside the rows.
| Parameter | Meaning |
|---|---|
q | Text in the event's name, the address, the details or the person's e-mail, in any case. Up to 200 characters. % and _ are taken as text |
event | An event name, and it may be sent several times. Alone it is the filter. With q, an event matches when the text or one of the names does |
since, until | The first and the last moment in ISO 8601, both included. until before since answers HTTP 422 |
GET /api/v1/auth/audit/export.csv takes the same parameters and returns the events as a CSV file (Team and above). It holds at most 50,000 rows. The headers X-Export-Limit, X-Export-Total and X-Export-Truncated say whether the file stops early. The export is written to the log as audit.exported.
Search, trends and saved views
GET /api/v1/searchtakesqandlimit(5 by default, 20 at most). It returns the best hits in four groups:targets,agents,scansandfindings. A finding carriesprobe_name, the probe's name for people. A group your plan does not include is left out. Areadorscankey may search. A relay or tracing key may not. Every plan.GET /api/v1/trendstakesdays(30or90) and an optionalagent_idortarget_id. It returnsscans(each finished scan with its attack success rate) anddaily(open findings by severity, opened and fixed, for each UTC day). A retest is not inscans, andretestssays how many the period holds.practicegives the practice agent's share of the scans and of the open findings.targetsgives each target's latest rates,risingandnew_open.new_opencounts the open findings that the target's latest full scan was the first to find.approximate.reopenedcounts the findings that were reopened after a fix, which read as open from the day they were first seen. Withtarget_idit is on every plan. Without, it needs Team or above.GET /api/v1/viewslists your saved views of the Findings list.POST /api/v1/viewscreates one from anameandfilters.PATCH /api/v1/views/{id}changes its name, its filters oris_default.DELETE /api/v1/views/{id}removes it. Views belong to a signed-in person, 30 at most, so an API key is answered with HTTP 403. Every plan.
CLI and CI gate
The enfoa command wraps the API for pipelines. It starts a scan, waits, writes the report and exits with a gate verdict. It is one Python file with no dependencies and comes bundled with the GitHub Action and the GitLab template. Download them in the app under Account, Integrations, in the CI pipelines card. The CLI needs an API key on any plan. The gate itself is a Team feature.
enfoa scan --target NAME --fail-on new --min-severity medium --report report.md
enfoa scan-repo .
enfoa scan takes --probes, --strategies (default plain,base64, both in every plan), --attempts, --tailored, --policy, --max-turns, --purpose, --prompt-file (a model API target: test the system prompt in that file instead of the saved one), --fail-on new|any|none, --min-severity, --min-tested, --report file.md|.html|.json and --verbose. The earlier names --plugins, the action input plugins and ENFOA_PLUGINS are still accepted.
Without --verbose the gate names the probe, strategy and severity of each failure. It keeps the judge's reason out of the pipeline log, because the reason quotes the agent's reply. The report file has it.
--fail-on new fails only on failures that were not in the previous full scan of the same target, so a known backlog never blocks a deploy. A scan the gate turned down does not count as the previous one for the scans after it. A retest never counts as the previous one either, because it ran one test and every other failure would look new beside it. Running a failed pipeline again fails again, until the failure is fixed, accepted or marked a false positive. The answer names the full scan it compared with (compared_with) and how many it passed over (passed_over), retests not counted. An explicit against is taken as given. To set a first baseline with known failures, run one scan with --fail-on none or from the app.
The gate also fails while the scan holds replies the judge declined to assess, at or above the chosen severity (needs_review in the answer). Read them in the scan and label each case, and the gate passes.
enfoa scan-repo PATH checks a local checkout for poisoned agent instruction files (hidden Unicode, exfiltration instructions, auto-approve settings, hooks that run shell, MCP configurations with inline credentials). It needs no API.
enfoa targets, enfoa gate --scan ID and enfoa report --scan ID --format md|html|json complete the set.
The gate's verdict is recorded on the scan only when the caller may act in the pipeline: a member or above with a full or scan key. Once the verdict is recorded, a scan the gate turned down is not what the next one is compared with. A viewer or a read-only key is told the verdict and records nothing.
Exit codes
| Code | Meaning |
|---|---|
0 | Gate passed |
1 | Gate failed: new (or any, per --fail-on) failures at or above --min-severity, replies the judge declined to assess, or fewer than --min-tested percent of the cases reached a verdict |
2 | Any error: unreachable API, HTTP error, unknown target, a feature your plan lacks. A broken pipeline never reads as a passed gate |
GitHub Actions
A ready-made action runs the scan and uploads the report as an artifact. It writes a job summary with the verdict, the counts and the probes that failed the gate. Save the API address and an API key with the scope "Run scans and read" as repository secrets. The step fails the pull request only on new failures of medium severity or higher.
name: enfoa-gate
on:
pull_request:
workflow_dispatch:
jobs:
agent-security-scan:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write # for the result comment
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/enfoa-gate
with:
api-url: ${{ secrets.ENFOA_API_URL }}
api-key: ${{ secrets.ENFOA_API_KEY }}
target: staging-support-agent
strategies: plain,base64,unicode-tags,crescendo-scripted
attempts: "2"
fail-on: new
min-severity: medium
GitLab CI
The same gate comes as a template you include. A job extends .enfoa-gate and sets ENFOA_TARGET. ENFOA_PROBES, ENFOA_STRATEGIES and ENFOA_ATTEMPTS choose what runs. The exit codes are the same, and the report is kept as a job artifact.
Comment on the pull or merge request
Both integrations can post the result as one comment, which later runs update in place. It gives the verdict, what must be fixed before merging (new, or reopened) and what was fixed since the previous full scan. It also says how many findings were not counted because they are accepted or marked false positive. GitHub uses the job token and needs pull-requests: write. GitLab needs a project access token in ENFOA_GITLAB_TOKEN. The comment never contains a prompt, a reply or the judge's reasoning, and never changes the gate's result.
Code scanning (SARIF)
On Team and above a scan's result is available as SARIF 2.1.0. Get it with GET /api/v1/scans/{id}/report?format=sarif, enfoa scan --report result.sarif or the SARIF row of the "Report" tab on the scan page. Repository findings then appear beside your other code scanning alerts, with their file as the location.
The ready-made GitHub Action and the GitLab template each come with the CLI bundled. Download them in the app under Account, Integrations, in the CI pipelines card.
Webhooks and signing
Continuous mode posts alerts to webhooks in two ways. The first is a webhook_url on a schedule, signed with the organisation's webhook secret (GET /api/v1/schedules/webhook-secret, admins). The second is webhook alert destinations. Each is signed with its own secret, which is shown once at creation and can be rotated with POST /api/v1/alerts/sinks/{id}/rotate-secret. Both use the same headers.
| Header | Value |
|---|---|
X-Enfoa-Timestamp | Unix time of sending |
X-Enfoa-Signature | v1=<hex>, HMAC-SHA256 over timestamp + "." + raw body with the secret |
Alert destination payloads are JSON {tenant, scan_url, alerts}. The alert types are new_failures (with the diff), mcp_drift (the MCP server's tools or prompts changed since the last scan), model_drift (the provider's model id or fingerprint changed), scan_failed and schedule_disabled (the plan no longer covers the schedule, or its target is gone). Verify the signature before you trust a payload:
import hmac, hashlib
def verify(secret: str, headers, body: bytes) -> bool:
ts = headers["X-Enfoa-Timestamp"]
sig = headers["X-Enfoa-Signature"] # "v1=<hex>"
expected = hmac.new(secret.encode(), f"{ts}.".encode() + body, hashlib.sha256).hexdigest()
return hmac.compare_digest(sig, f"v1={expected}")
Compare the timestamp with your clock and reject old messages to stop replays. Destinations must be public HTTPS hosts. Each destination records its last delivery or last error, and the Test button delivers one synthetic alert.