Reports: screenings and lookups run on demand or attached to an
inquiry, such as watchlist, politically exposed person, adverse media,
and the KYB reports (report/business-lookup, business-watchlist,
business-adverse-media, business-search, ...).
Reports run asynchronously. Create one, then wait for the
report/<type>.ready (or .errored) webhook, or check is-done from
a schedule. Statuses: pending, ready, errored; a ready report
sets has-match.
Functions
add-tag
fn (report-id: Str, tag-name: Str): Map
fn (report-id: Str, tag-name: Str, options: Map): Map
POST /reports/{id}/add-tag - Add a tag by name.
Example
::persona::reports/add-tag("rep_123", "reviewed")
create-body
fn (type-name: Str, template-id: Str?, query: Map, opts: Map): Map
The JSON:API body for create-report. Exposed for testing.
Example
::persona::reports/create-body("watchlist", "rptp_1", {name-last: "Doe"}, {})
// {data: {type: "report/watchlist", attributes: {report-template-id: "rptp_1", query: {name-last: "Doe"}}}}
create-business-lookup-report
fn (template-id: Str, query: Map): Map
fn (template-id: Str, query: Map, options: Map): Map
Run a report/business-lookup (KYB registry lookup). query needs
business-name, address-street-1, address-city,
address-subdivision, address-postal-code; optional ein, website,
phone-number, address-country-code, associated-people.
Example
report ::persona::reports/create-business-lookup-report("rptp_123", {
business-name: "Acme Robotics LLC",
address-street-1: "1 Main St",
address-city: "Austin",
address-subdivision: "TX",
address-postal-code: "78701"
})
report.data.id
create-report
fn (type-name: Str, template-id: Str?, query: Map): Map
fn (type-name: Str, template-id: Str?, query: Map, opts: Map): Map
fn (type-name: Str, template-id: Str?, query: Map, opts: Map, options: Map): Map
POST /reports - Run a report. type-name is the report type
("watchlist", "politically-exposed-person", "adverse-media",
"business-lookup", "business-watchlist", "business-adverse-media",
"email-address", "phone-number", ...); template-id is its report
template (rptp_..., from the dashboard); query holds the inputs,
e.g. {name-first, name-last, birthdate, address-country-code} for a
watchlist or {business-name, address-street-1, address-city, address-subdivision, address-postal-code} for a business lookup.
opts: account-id, meta (e.g. {auto-create-account-reference-id: "user-42"}).
Example
report ::persona::reports/create-report("watchlist", "rptp_...", {
name-first: "Jane", name-last: "Doe", address-country-code: "US"
}, {}, {idempotency-key: "user-42-watchlist"})
create-watchlist-report
fn (template-id: Str, query: Map): Map
fn (template-id: Str, query: Map, options: Map): Map
Run a report/watchlist (sanctions) screening on a person. query as
in create-report; term can replace the name parts.
Example
report ::persona::reports/create-watchlist-report("rptp_123", {
name-first: "Jane",
name-last: "Doe",
birthdate: "1990-01-31",
address-country-code: "US"
}, {idempotency-key: "user-42-watchlist"})
report.data.id
get-report
fn (report-id: Str): Map
fn (report-id: Str, opts: Map): Map
fn (report-id: Str, opts: Map, options: Map): Map
GET /reports/{id} - Retrieve a report. opts takes include and
fields.
Example
report ::persona::reports/get-report("rep_123")
if(::persona::reports/is-done(report), ::persona::reports/has-match(report), "still running")
has-match
fn (doc: Any): Bool
True when a ready report found a match (has-match).
Example
::persona::reports/has-match({data: {id: "rep_1", type: "report/watchlist", attributes: {status: "ready", has-match: true}}}) // true
::persona::reports/has-match({data: {id: "rep_2", type: "report/watchlist", attributes: {status: "ready", has_match: false}}}) // false
is-done
fn (doc: Any): Bool
True when a report has finished: status ready or errored.
Example
::persona::reports/is-done({data: {id: "rep_1", type: "report/watchlist", attributes: {status: "ready"}}}) // true
::persona::reports/is-done({data: {id: "rep_2", type: "report/watchlist", attributes: {status: "pending"}}}) // false
list-reports
fn (filters: Map): Map
fn (filters: Map, opts: Map): Map
fn (filters: Map, opts: Map, options: Map): Map
GET /reports - One page of reports. Filters: reference-id,
account-id. opts takes page-size, after, before.
Example
page ::persona::reports/list-reports({reference-id: "user-42"}, {page-size: 25})
map(page.data, %.id)
print-report
fn (report-id: Str): Bytes
fn (report-id: Str, options: Map): Bytes
GET /reports/{id}/print - The report as a PDF (Bytes).
Example
pdf ::persona::reports/print-report("rep_123")
length(pdf)
redact-report
fn (report-id: Str): Map
fn (report-id: Str, options: Map): Map
DELETE /reports/{id} - Permanently remove a report's PII.
Example
::persona::reports/redact-report("rep_123")
report-type
fn (type-name: Str): Str
The JSON:API type for a report: "watchlist" and "report/watchlist"
both give "report/watchlist". Exposed for testing.
Example
::persona::reports/report-type("watchlist") // "report/watchlist"
::persona::reports/report-type("report/watchlist") // "report/watchlist"
rerun-report
fn (report-id: Str): Map
fn (report-id: Str, options: Map): Map
POST /reports/{id}/run - Re-run a (continuously monitored) report now.
Watch for the next .ready event.
Example
::persona::reports/rerun-report("rep_123")