> 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/file_scan.md).

# Scanning Files

Nightfall’s file scan API allows a user to upload a file in chunks, then to scan it with Detection Rules once the upload is complete.

The scan will then be processed asynchronously before sending the results to the webhook URL that is provided along with your Detection Rules.

The following sequence diagram illustrates the full process for scanning a binary file with Nightfall.

<figure><img src="https://3789559529-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDE6VZCJNhkLwvzLp4YDN%2Fuploads%2FT8unJsahfSJ9besAYAzv%2Fimage.png?alt=media&amp;token=e74d5260-b116-4fbd-b79f-7592c5644686" alt=""><figcaption></figcaption></figure>

For a detailed walkthrough of the API calls necessary to upload and scan a file and full script that shows the entire process, see [Uploading and Scanning Files](https://docs.nightfall.ai/docs/uploading-files)[.](/developer-api/key-concepts/file_scan/scan_api_calls.md)

### Prerequisites

In order to utilize the File Scanning API you need the following:

* An active API Key authorized for file scanning passed via the header `Authorization: Bearer <key>` — see [Authentication and Security](/developer-api/introduction/authentication_security.md)
* A Nightfall Detection Policy associated with a webhook URL
* A web server configured to listen for file scanning results (detailed information to follow)

File scanning also support Nightfall's functionality for [Using Exclusion Rules](/developer-api/key-concepts/scanning_features/exclusion_rules.md) and [Using Context Rules](/developer-api/key-concepts/scanning_features/context_rules.md) as part of your scan requests.


---

# 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/file_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.
