In this example, we'll walk through making a request to the scan endpoint.
The endpoint inspects the data you provide via the request body and reports any detected occurrences of the sensitive data types you are searching for.
Please refer to the API reference of the scan endpoint for more detailed information on the request and response schemas.
In this sample request, we provide two main fields:
a policy and its detection rules that we want to use when scanning the text payload
a list of text strings to scan
In the example below we will use a Detection Rule that has been configured in the user interface by supplying its UUID.
The aggregate length of all strings in payload list must not exceed 500 KB, and the number of items in the payload may not exceed 50,000.
curl--requestPOST \--urlhttps://api.nightfall.ai/v3/scan \--header'Accept: application/json' \--header'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \--header'Content-Type: application/json' \--data'{ "policy": { "detectionRuleUUIDs": [ "950833c9-8608-4c66-8a3a-0734eac11157" ] }, "payload": [ "4916-6734-7572-5015 is my credit card number", "This string does not have any sensitive data", "my api key is yr+ZWwIZp6ifFgaHV8410b2BxbRt5QiAj1EZx1qj and my 💳 credit card number 💰 is 30204861594838" ]}'
Alternatively you may define your policy in code by using a built in Nightfall detector from the Detector Glossary as follows:
curl--requestPOST \--urlhttps://api.nightfall.ai/v3/scan \--header'accept: application/json' \--header'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \--header'content-type: application/json' \--data'{ "policy": { "detectionRules": [ { "detectors": [ { "nightfallDetector": "CREDIT_CARD_NUMBER", "detectorType": "NIGHTFALL_DETECTOR", "minConfidence": "POSSIBLE", "minNumFindings": 1 } ], "logicalOp": "ALL" } ] }, "payload": [ "4916-6734-7572-5015 is my credit card number", "This string does not have any sensitive data", "my api key is yr+ZWwIZp6ifFgaHV8410b2BxbRt5QiAj1EZx1qj and my 💳 credit card number 💰 is 30204861594838" ]}'
The API call returns a list, where the item at each index is a sublist of matches for the provided detector types.
The indices of the response list correspond directly to the indices of the list provided in the request payload.
In this example, the first item in the response list contains a finding because one credit card number was detected in the first string we provided. The second item in the response list is an empty list because there is no sensitive data in the second input string we provided. The third item in the returned list contains multiple findings as a result of multiple Detectors within the Detection Rule being triggered.
You can read further about the fields in the response object in the API Reference.