/api/attack-surface. They use the same authentication as the console: a signed-in session, and the workspace in the X-Workspace-Id header.
To query a workspace from an external tool with the workspace API key, use the MCP server: its
query_attack_surface tool takes the same JSON. See AI agent and MCP.Endpoints
Run a query
1
Write the batch
This batch lists the targets of the workspace and counts the hosts under each one.
2
Send it
The session cookie is the one the console sets when you sign in (named
session, or __Secure-session when OASM is served over HTTPS).3
Read the response
Each query comes back under its name in
data. meta carries the time the batch was evaluated at and per-query statistics.Reading results
- Every row has an
id. Keep it for follow-up queries ("field": "id", "op": "eq") and for other API calls. - Related rows are nested.
select: ["host.value"]returns{ "host": { "value": "…" } }. A related row that does not exist (a service with no HTTP response) isnull. - Times are ISO 8601 in UTC.
nextCursoris set when more rows exist; send the same query again with"cursor"to get the next page. See Paging, limits and cost.truncated: truemeans a long string was cut or the response size limit was reached.- A failed query comes back as
{ "error": { "code", "message" } }under its name while the others still return rows. A batch that is invalid as a whole is refused with HTTP 400 — see Errors.
Check a query before running it
POST /api/attack-surface/explain takes the same body. It validates the batch and returns, per query, the static cost and the database planner’s estimate, with hints when a query is too broad:
budget is the most a query may cost for you. Hints are suggestions, not errors: this query is well within its budget. See Paging, limits and cost.
Discover the schema
GET /api/attack-surface/schema returns the resources you may read, with each field’s type, operators, enum values and whether it can be sorted or grouped, and the relations of each resource. The Resources and fields page is the same information in readable form.