AWS.FraudDetector reference
DeleteEvent
Section titled “DeleteEvent”Source:
src/AWS/FraudDetector/DeleteEvent.ts
Delete a stored event from Amazon Fraud Detector — the effectful erasure
call made from a deployed Lambda or Task, e.g. to honor a data-deletion
request. Set deleteAuditHistory to also remove the event’s prediction
history.
DeleteEvent: Deleting Stored Events
Section titled “DeleteEvent: Deleting Stored Events”Provide the DeleteEventHttp implementation layer on the Function effect,
bind the event type in the init phase, then call the returned client at
runtime. The binding grants frauddetector:DeleteEvent on the event type
and injects its eventTypeName automatically.
// initconst deleteEvent = yield* FraudDetector.DeleteEvent(eventType);
return { fetch: Effect.gen(function* () { // runtime yield* deleteEvent({ eventId: "order-123", deleteAuditHistory: true }); return HttpServerResponse.json({ ok: true }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.DeleteEventHttp))DeleteEventsByEventType
Section titled “DeleteEventsByEventType”Source:
src/AWS/FraudDetector/DeleteEventsByEventType.ts
Start an asynchronous bulk delete of ALL events stored for a bound Amazon
Fraud Detector event type — the effectful cleanup call (e.g. a data-privacy
purge) made from a deployed Lambda or Task. Track progress with the
companion GetDeleteEventsByEventTypeStatus binding.
DeleteEventsByEventType: Purging Stored Events
Section titled “DeleteEventsByEventType: Purging Stored Events”Provide the DeleteEventsByEventTypeHttp implementation layer on the
Function effect, bind the event type in the init phase, then call the
returned client at runtime. The binding grants
frauddetector:DeleteEventsByEventType on the event type and injects its
eventTypeName automatically.
// initconst deleteEventsByEventType = yield* FraudDetector.DeleteEventsByEventType(eventType);const getDeleteStatus = yield* FraudDetector.GetDeleteEventsByEventTypeStatus(eventType);
return { fetch: Effect.gen(function* () { // runtime yield* deleteEventsByEventType({}); const { eventsDeletionStatus } = yield* getDeleteStatus({}); return HttpServerResponse.json({ status: eventsDeletionStatus }); }),};// on the Function effect:// .pipe(Effect.provide(Layer.mergeAll(// FraudDetector.DeleteEventsByEventTypeHttp,// FraudDetector.GetDeleteEventsByEventTypeStatusHttp,// )))Detector
Section titled “Detector”Source:
src/AWS/FraudDetector/Detector.ts
An Amazon Fraud Detector detector — the container that binds an event type to versioned rule sets and models used to evaluate fraud. Creating the detector is cheap; the rules, models, and detector versions that produce predictions are provisioned separately.
Detector: Creating a Detector
Section titled “Detector: Creating a Detector”Basic Detector
const detector = yield* FraudDetector.Detector("checkout", { eventTypeName: purchase.name,});Detector with an Active Version
const detector = yield* FraudDetector.Detector("checkout", { eventTypeName: purchase.name,});
const version = yield* FraudDetector.DetectorVersion("v1", { detectorId: detector.detectorId, status: "ACTIVE", rules: [ { ruleId: "high_risk", expression: '$email == "fraud@example.com"', outcomes: [review.name], }, ],});Detector: Runtime Predictions
Section titled “Detector: Runtime Predictions”Bind GetEventPrediction in the init phase (providing the
GetEventPredictionHttp layer on the Function effect) and score events at
runtime against the detector’s ACTIVE version.
// initconst getEventPrediction = yield* FraudDetector.GetEventPrediction(detector);
// runtimeconst { ruleResults } = yield* getEventPrediction({ eventId: "order-123", eventTypeName: "purchase", eventTimestamp: new Date().toISOString(), entities: [{ entityType: "customer", entityId: "cust-1" }], eventVariables: { email: "buyer@example.com", ip: "1.2.3.4" },});DetectorVersion
Section titled “DetectorVersion”Source:
src/AWS/FraudDetector/DetectorVersion.ts
An Amazon Fraud Detector detector version — the deployable revision of a
detector. It bundles a set of rules (owned inline here) over the detector’s
event type and, when ACTIVE, serves real-time predictions via
getEventPrediction. Rules and the version are cheap, rule-based
configuration objects — no model training is involved.
DetectorVersion: Creating a Detector Version
Section titled “DetectorVersion: Creating a Detector Version”const version = yield* FraudDetector.DetectorVersion("v1", { detectorId: detector.detectorId, status: "ACTIVE", ruleExecutionMode: "FIRST_MATCHED", rules: [ { ruleId: "high_risk", expression: '$email == "fraud@example.com"', outcomes: ["review"], }, ],});EntityType
Section titled “EntityType”Source:
src/AWS/FraudDetector/EntityType.ts
An Amazon Fraud Detector entity type — the classification of who or what an
event is about (e.g. customer, merchant). Event types reference entity
types; they are cheap metadata objects.
EntityType: Creating an Entity Type
Section titled “EntityType: Creating an Entity Type”const customer = yield* FraudDetector.EntityType("customer", { description: "the buyer placing an order",});EventType
Section titled “EventType”Source:
src/AWS/FraudDetector/EventType.ts
An Amazon Fraud Detector event type — the schema of an event (its variables, labels, and entity types) that detectors evaluate. Event types are cheap metadata objects.
EventType: Creating an Event Type
Section titled “EventType: Creating an Event Type”const purchase = yield* FraudDetector.EventType("purchase", { eventVariables: ["email", "ip"], entityTypes: ["customer"], labels: ["fraud", "legit"],});GetDeleteEventsByEventTypeStatus
Section titled “GetDeleteEventsByEventTypeStatus”Source:
src/AWS/FraudDetector/GetDeleteEventsByEventTypeStatus.ts
Check the status of an asynchronous bulk event delete started by
DeleteEventsByEventType on a bound Amazon Fraud Detector event type — the
effectful status poll made from a deployed Lambda or Task.
GetDeleteEventsByEventTypeStatus: Purging Stored Events
Section titled “GetDeleteEventsByEventTypeStatus: Purging Stored Events”Provide the GetDeleteEventsByEventTypeStatusHttp implementation layer on
the Function effect, bind the event type in the init phase, then call the
returned client at runtime. The binding grants
frauddetector:GetDeleteEventsByEventTypeStatus on the event type and
injects its eventTypeName automatically.
// initconst getDeleteStatus = yield* FraudDetector.GetDeleteEventsByEventTypeStatus(eventType);
return { fetch: Effect.gen(function* () { // runtime const { eventsDeletionStatus } = yield* getDeleteStatus({}); return HttpServerResponse.json({ status: eventsDeletionStatus }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.GetDeleteEventsByEventTypeStatusHttp))GetEvent
Section titled “GetEvent”Source:
src/AWS/FraudDetector/GetEvent.ts
Read a stored event (its entities and variable values) back from Amazon
Fraud Detector — the effectful lookup call made from a deployed Lambda or
Task. Events are stored by SendEvent or by predictions on an event type
with ingestion enabled.
GetEvent: Reading Stored Events
Section titled “GetEvent: Reading Stored Events”Provide the GetEventHttp implementation layer on the Function effect,
bind the event type in the init phase, then call the returned client at
runtime. The binding grants frauddetector:GetEvent on the event type and
injects its eventTypeName automatically.
// initconst getEvent = yield* FraudDetector.GetEvent(eventType);
return { fetch: Effect.gen(function* () { // runtime const { event } = yield* getEvent({ eventId: "order-123" }); return HttpServerResponse.json({ variables: event?.eventVariables }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.GetEventHttp))GetEventPrediction
Section titled “GetEventPrediction”Source:
src/AWS/FraudDetector/GetEventPrediction.ts
Submit an event to a bound Amazon Fraud Detector detector and receive the real-time model scores and rule outcomes for it — the effectful prediction call made from a deployed Lambda or Task.
GetEventPrediction: Scoring Events
Section titled “GetEventPrediction: Scoring Events”Provide the GetEventPredictionHttp implementation layer on the Function
effect, bind the detector in the init phase, then call the returned client
at runtime. The binding grants frauddetector:GetEventPrediction on the
detector and injects its detectorId automatically.
// initconst getEventPrediction = yield* FraudDetector.GetEventPrediction(detector);
return { fetch: Effect.gen(function* () { // runtime const { ruleResults } = yield* getEventPrediction({ eventId: "order-123", eventTypeName: "purchase", eventTimestamp: new Date().toISOString(), entities: [{ entityType: "customer", entityId: "cust-1" }], eventVariables: { email: "fraud@example.com", ip: "1.2.3.4" }, }); const outcomes = ruleResults?.flatMap((r) => r.outcomes ?? []); return HttpServerResponse.json({ outcomes }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.GetEventPredictionHttp))GetEventPredictionMetadata
Section titled “GetEventPredictionMetadata”Source:
src/AWS/FraudDetector/GetEventPredictionMetadata.ts
Read the full evaluation details of a past prediction made by a bound Amazon Fraud Detector detector — the variables, rule evaluations, and model scores recorded for the prediction — the effectful audit call made from a deployed Lambda or Task.
GetEventPredictionMetadata: Auditing Predictions
Section titled “GetEventPredictionMetadata: Auditing Predictions”Provide the GetEventPredictionMetadataHttp implementation layer on the
Function effect, bind the detector in the init phase, then call the
returned client at runtime. The binding grants
frauddetector:GetEventPredictionMetadata on the detector and injects its
detectorId automatically. Find predictionTimestamp values via the
ListEventPredictions binding.
// initconst getPredictionMetadata = yield* FraudDetector.GetEventPredictionMetadata(detector);
return { fetch: Effect.gen(function* () { // runtime const metadata = yield* getPredictionMetadata({ eventId: "order-123", eventTypeName: "purchase", detectorVersionId: "1", predictionTimestamp: "2026-01-01T00:00:00Z", }); return HttpServerResponse.json({ rules: metadata.rules }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.GetEventPredictionMetadataHttp))GetListElements
Section titled “GetListElements”Source:
src/AWS/FraudDetector/GetListElements.ts
Read the elements of a bound Amazon Fraud Detector list — the effectful lookup call made from a deployed Lambda or Task, e.g. to check an incoming value against a deny-list outside of a detector evaluation.
Elements decode as sensitive values (string | Redacted<string>); unwrap
with Redacted.value where needed.
GetListElements: Reading List Elements
Section titled “GetListElements: Reading List Elements”Provide the GetListElementsHttp implementation layer on the Function
effect, bind the list in the init phase, then call the returned client at
runtime. The binding grants frauddetector:GetListElements on the list and
injects its name automatically.
// initconst getListElements = yield* FraudDetector.GetListElements(blockedIps);
return { fetch: Effect.gen(function* () { // runtime const { elements } = yield* getListElements({}); return HttpServerResponse.json({ count: elements?.length ?? 0 }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.GetListElementsHttp))Source:
src/AWS/FraudDetector/Label.ts
An Amazon Fraud Detector label — a classification (e.g. fraud, legit)
used to tag stored events for supervised model training. Event types
reference labels; they are cheap metadata objects.
Label: Creating a Label
Section titled “Label: Creating a Label”const fraud = yield* FraudDetector.Label("fraud", { description: "confirmed fraudulent event",});const legit = yield* FraudDetector.Label("legit", {});Source:
src/AWS/FraudDetector/List.ts
An Amazon Fraud Detector list — a set of input values for a variable (an allow-list or deny-list, e.g. known-fraud IP addresses) referenced from detector rule expressions.
List: Creating a List
Section titled “List: Creating a List”const blockedIps = yield* FraudDetector.List("BlockedIps", { variableType: "IP_ADDRESS", description: "known-fraud source addresses", elements: ["203.0.113.7", "198.51.100.9"],});List: Using a List at Runtime
Section titled “List: Using a List at Runtime”// initconst updateList = yield* FraudDetector.UpdateList(blockedIps);const getListElements = yield* FraudDetector.GetListElements(blockedIps);
// runtimeyield* updateList({ elements: ["192.0.2.44"], updateMode: "APPEND" });const { elements } = yield* getListElements({});// on the Function effect:// .pipe(Effect.provide(Layer.mergeAll(// FraudDetector.UpdateListHttp,// FraudDetector.GetListElementsHttp,// )))ListEventPredictions
Section titled “ListEventPredictions”Source:
src/AWS/FraudDetector/ListEventPredictions.ts
List the past predictions made by a bound Amazon Fraud Detector detector —
the effectful search call made from a deployed Lambda or Task, e.g. to find
the predictionTimestamp needed by GetEventPredictionMetadata.
ListEventPredictions: Auditing Predictions
Section titled “ListEventPredictions: Auditing Predictions”Provide the ListEventPredictionsHttp implementation layer on the Function
effect, bind the detector in the init phase, then call the returned client
at runtime. The binding grants frauddetector:ListEventPredictions (the
action supports no resource-level scoping) and filters results to the bound
detector automatically.
// initconst listEventPredictions = yield* FraudDetector.ListEventPredictions(detector);
return { fetch: Effect.gen(function* () { // runtime const { eventPredictionSummaries } = yield* listEventPredictions({ eventId: { value: "order-123" }, }); return HttpServerResponse.json({ predictions: eventPredictionSummaries ?? [], }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.ListEventPredictionsHttp))Outcome
Section titled “Outcome”Source:
src/AWS/FraudDetector/Outcome.ts
An Amazon Fraud Detector outcome — the result a rule produces when it matches
(e.g. approve, review, block). Detector rules reference outcomes; they
are cheap metadata objects.
Outcome: Creating an Outcome
Section titled “Outcome: Creating an Outcome”const approve = yield* FraudDetector.Outcome("approve", { description: "let the transaction through",});const review = yield* FraudDetector.Outcome("review", {});SendEvent
Section titled “SendEvent”Source:
src/AWS/FraudDetector/SendEvent.ts
Store an event in Amazon Fraud Detector without generating a prediction —
the effectful ingestion call made from a deployed Lambda or Task. Stored
events build the historical dataset used to train models and can be
labeled later via UpdateEventLabel. The bound event type must have
eventIngestion: "ENABLED".
SendEvent: Ingesting Events
Section titled “SendEvent: Ingesting Events”Provide the SendEventHttp implementation layer on the Function effect,
bind the event type in the init phase, then call the returned client at
runtime. The binding grants frauddetector:SendEvent on the event type
and injects its eventTypeName automatically.
// initconst sendEvent = yield* FraudDetector.SendEvent(eventType);
return { fetch: Effect.gen(function* () { // runtime yield* sendEvent({ eventId: "order-123", eventTimestamp: new Date().toISOString(), entities: [{ entityType: "customer", entityId: "cust-1" }], eventVariables: { email: "buyer@example.com", ip: "1.2.3.4" }, }); return HttpServerResponse.json({ ok: true }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.SendEventHttp))UpdateEventLabel
Section titled “UpdateEventLabel”Source:
src/AWS/FraudDetector/UpdateEventLabel.ts
Label a stored event in Amazon Fraud Detector — the effectful feedback call made from a deployed Lambda or Task when ground truth arrives (e.g. a chargeback confirms fraud). Labeled events improve future model training.
UpdateEventLabel: Labeling Stored Events
Section titled “UpdateEventLabel: Labeling Stored Events”Provide the UpdateEventLabelHttp implementation layer on the Function
effect, bind the event type in the init phase, then call the returned
client at runtime. The binding grants frauddetector:UpdateEventLabel on
the event type and injects its eventTypeName automatically.
// initconst updateEventLabel = yield* FraudDetector.UpdateEventLabel(eventType);
return { fetch: Effect.gen(function* () { // runtime — a chargeback arrived for this order yield* updateEventLabel({ eventId: "order-123", assignedLabel: "fraud", labelTimestamp: new Date().toISOString(), }); return HttpServerResponse.json({ ok: true }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.UpdateEventLabelHttp))UpdateList
Section titled “UpdateList”Source:
src/AWS/FraudDetector/UpdateList.ts
Mutate the elements of a bound Amazon Fraud Detector list at runtime — the effectful write call made from a deployed Lambda or Task, e.g. to append a newly-confirmed fraudulent IP to a deny-list the detector’s rules reference.
Note that the List resource reconciles elements declaratively on every
deploy (a REPLACE update), so elements appended at runtime are removed by
the next deploy unless they are also added to the resource’s props.
UpdateList: Updating List Elements
Section titled “UpdateList: Updating List Elements”Provide the UpdateListHttp implementation layer on the Function effect,
bind the list in the init phase, then call the returned client at runtime.
The binding grants frauddetector:UpdateList on the list and injects its
name automatically.
// initconst updateList = yield* FraudDetector.UpdateList(blockedIps);
return { fetch: Effect.gen(function* () { // runtime yield* updateList({ elements: ["192.0.2.44"], updateMode: "APPEND" }); return HttpServerResponse.json({ ok: true }); }),};// on the Function effect:// .pipe(Effect.provide(FraudDetector.UpdateListHttp))Variable
Section titled “Variable”Source:
src/AWS/FraudDetector/Variable.ts
An Amazon Fraud Detector variable — a named input to fraud-detection models and rules, typed and sourced from event data or model scores. Variables are cheap metadata objects.
Variable: Creating a Variable
Section titled “Variable: Creating a Variable”const email = yield* FraudDetector.Variable("email", { dataType: "STRING", dataSource: "EVENT", defaultValue: "unknown", variableType: "EMAIL_ADDRESS",});