> For the complete documentation index, see [llms.txt](https://help.nightfall.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.nightfall.ai/developer-api/key-concepts/text_scan.md).

# Scanning Text

The `scan` endpoint allows you to apply Policies and Detection Rules to a list of text strings provided as a `payload`.

```sh
curl --request POST \
     --url https://api.nightfall.ai/v3/scan \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer  NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
     --header 'Content-Type: application/json' \
     --data '
{
     "policy": {
          "detectionRules": [
               {
                    "detectors": [
                         {
                              "minNumFindings": 1,
                              "minConfidence": "LIKELY",
                              "displayName": "US Social Security Number",
                              "detectorType": "NIGHTFALL_DETECTOR",
                              "nightfallDetector": "US_SOCIAL_SECURITY_NUMBER"
                         }
                    ],
                    "name": "My Match Rule",
                    "logicalOp": "ANY"
               }
          ]
     },
     "payload": [
          "The customer social security number is 458-02-6124",
          "No PII in this string"
     ]
}
```

You may use[ Pre-Configured Detection Rules](/developer-api/key-concepts/scanning_features/pre_configured_detection_rules.md) or [Create Inline Detection Rules](/developer-api/key-concepts/scanning_features/inline_detection_rules.md)

Text scanning supports the use of[ Exclusion Rules](/developer-api/key-concepts/scanning_features/exclusion_rules.md),[ Context Rules](/developer-api/key-concepts/scanning_features/context_rules.md), and [Redaction](https://docs.nightfall.ai/docs/using-redactions)[ ](/developer-api/key-concepts/scanning_features/redaction.md)as well as other [Scanning Features](https://docs.nightfall.ai/docs/scanning-features).

For scanning files, see [Scanning Files](/developer-api/key-concepts/file_scan.md).

Note that you must generate an[ API key ](/developer-api/key-concepts/setup/api_key.md)to send requests to the Nightfall API.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.nightfall.ai/developer-api/key-concepts/text_scan.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
