Applications
API specs
NightVision tests an API from a description of it: an OpenAPI (Swagger) specification or a Postman collection. The spec tells the scanner which endpoints exist, which methods they take and what their parameters look like, so every endpoint is tested, not only the ones a crawl happens to reach.
In the dashboard: Applications
Open Applications (opens in a new tab)There are two places a spec can live:
- The application’s own spec. Every API application has one. It defines the endpoints its scans test.
- API schemas. Extra specs you attach to any web or API application, each with its own base URL. Use them for a web application that calls an API, or for an API split across several services.
What you can upload
Section titled “What you can upload”| Format | File types | Notes |
|---|---|---|
| OpenAPI or Swagger specification | .yml, .yaml, .json |
By file or by URL |
| Postman collection | .json |
Collection format v2.0 or v2.1. Upload it as it is. There is nothing to convert |
A file’s extension has to match its contents: JSON in a .json file, YAML in a .yml or .yaml file.
If you have neither, generate a spec from your source code.
Add a spec when you create an API application
Section titled “Add a spec when you create an API application”- On Applications, select New application, then API application.
- Enter the Application name and the Base URL.
- Under API spec or Postman collection, choose a source:
- URL: enter the address of the spec. NightVision fetches it and tells you at once if it cannot be read as a spec.
- File: select Choose a file and pick the spec or collection.
- Select Create application.
The base URL has to match the spec. The base URL plus each path in the spec must reach a real endpoint. For example, with paths such as /charges in the spec, a base URL of https://api.example.com/v1 sends requests to https://api.example.com/v1/charges. Do not end the base URL with a slash.
Applications covers the rest of the form.
Replace the spec
Section titled “Replace the spec”When your API changes, give the application the new spec.
- Open the API application.
- On the Application card, select Edit.
- Under API spec or Postman collection, enter a new URL or choose a new File. Leave both alone to keep the stored spec.
- Select Update.
Changing the URL fetches the spec again. The next scan uses the new spec.
Check that the spec is ready
Section titled “Check that the spec is ready”Open the API application, then More settings and General.

The panel shows the spec file, when it was last updated, and two answers:
- API spec status says where the spec is in its checks.
- Application is ready to scan is Yes once the spec can be used.
| Status | Meaning | What to do |
|---|---|---|
| Spec/collection is valid | The spec passed every check | Scan |
| Spec/collection has validation warnings | The spec was read and its endpoints are listed, but it has validation errors, shown under Warnings. Application is ready to scan reads No | Fix the errors in the file and replace the spec. New scans cannot start until the status is valid. A rescan or scheduled run of an earlier scan still runs |
| Spec/collection is not valid | The file could not be read as a spec or a collection | Fix the file and replace the spec |
| Spec/collection download failed | NightVision could not fetch the URL | Check that the URL is reachable from the internet, or upload a file instead |
| Spec/collection is not specified | The application has no spec yet | Add one |
| Downloading, Validating, Waiting for upload | The spec is still being processed | Wait. The panel updates by itself |
To get the stored spec back, select Download for an uploaded file or Open for a spec fetched from a URL.
Browse the endpoints
Section titled “Browse the endpoints”Open More settings and Endpoints to see every endpoint the spec declares, with its method and path.

- Search matches the method or the path.
- Export as CSV saves the endpoints you are looking at.
- Open in API inventory opens the same API in API inventory.
After a scan, Coverage shows which of these endpoints the scan requested.
Add API schemas to any application
Section titled “Add API schemas to any application”An API schema is an extra spec attached to an application. Each one has a base URL that its endpoints are served under.
Schemas do two things. They tell the scanner about endpoints it might not find by itself, and they let it attack the endpoints most likely to be vulnerable first. A spec that Source intelligence generated from your code marks where each endpoint’s input ends up, such as a database query or a shell command, and the scanner uses those marks to order its work.
To add one:
- Open the application, then More settings and API schemas.
- Select Add schemas.
- Choose a File, or enter an address under Add schema by URL.
- Give it a Name and check the Base URL. It starts as the application’s own URL.
- On a web application with network analysis turned off, leave Turn on network analysis ticked. Scans of a web application use its schemas only while network analysis is on, and network analysis applies to scans with a max scan duration of 2 hours or more. See Crawler settings.
- Select Add.
A web application with no schema also shows an Add an API schema button on its Setup tab, and a scan’s Coverage tab offers the same.

Each schema is checked before scans use it:
| Status | Meaning |
|---|---|
| Valid | Ready. Scans use it |
| Valid, with warnings | Ready, with issues in the file |
| Invalid | The file is not a spec or a collection |
| Download failed | The URL could not be fetched |
| Downloading, Checking, Waiting for upload | Still being processed |
The row menu has Download, Edit and Delete. Edit changes the name, base URL and description, and for a schema fetched from a URL, the URL. Changing the URL fetches it again.
On an API application, these schemas are in addition to the application’s own spec.
No spec? Generate one from source
Section titled “No spec? Generate one from source”Source intelligence reads your code and writes the OpenAPI spec for you. Run it in the repository:
nightvision openapi extract . --target payments-api -p "Payments"--target attaches the spec to the application, replacing the one it had. The CLI detects the languages in the repository; add --lang to restrict a run to one.
To look at the result before you attach it to anything:
nightvision openapi extract . --no-targetSee openapi extract for every option and Supported frameworks for what it reads.
From the CLI
Section titled “From the CLI”The CLI calls an application a target.
Create an API application with a spec
Section titled “Create an API application with a spec”# From a local file (OpenAPI or a Postman collection)nightvision target create payments-api https://api.example.com/v1 \ --type API -p "Payments" --spec-file openapi-spec.yml
# From a URLnightvision target create payments-api https://api.example.com/v1 \ --type API -p "Payments" --spec-url https://api.example.com/v1/openapi.jsonGive --spec-file or --spec-url, not both. You can also create the application with --type API and no spec, then attach one later.
Replace the spec
Section titled “Replace the spec”nightvision target update payments-api --spec-file openapi-spec.ymlnightvision target update payments-api --spec-url https://api.example.com/v1/openapi.json--openapi-file and --openapi-url do the same as --spec-file and --spec-url. The older --swagger-file and --swagger-url spellings still work and are deprecated.
Manage API schemas
Section titled “Manage API schemas”# Attach a schema from a file. The base URL is required.nightvision api-schema upload orders-v2 orders-v2.yaml \ --target customer-portal --base-url https://orders.example.com
# Have NightVision fetch it from a URL insteadnightvision api-schema upload portal-api \ --target customer-portal --base-url https://portal.example.com/api \ --url https://portal.example.com/api/openapi.json
nightvision api-schema list customer-portalnightvision api-schema download orders-v2 --target customer-portalnightvision api-schema delete orders-v2 --target customer-portalOn upload, --overwrite replaces the file of a schema that already has that name, and --wait holds the command until NightVision has finished checking the schema. Every command takes -p to name the project.
From the API
Section titled “From the API”Base URL: https://api.nightviz.ai/api/v1/. See the API overview for authentication.
| Method and path | What it does |
|---|---|
POST /targets/openapi/ |
Create an API application. Send swaggerfile_url to have the spec fetched from a URL |
PUT /targets/openapi/{id}/ |
Update it, including a new swaggerfile_url |
POST /targets/openapi/{id}/upload-spec/ |
Upload a spec file and attach it |
GET /targets/openapi/{id}/spec-status/ |
Read the spec’s status. Poll this after an upload until the spec is ready |
GET /targets/openapi/{id}/get-spec-url/ |
Get a link to download the stored spec |
GET, POST /targets/{id}/api-schemas/ |
List and add API schemas |
GET, PUT, DELETE /targets/{id}/api-schemas/{api_schema_id}/ |
Read, change or remove one schema |
GET /targets/{id}/api-schemas/{api_schema_id}/download-url/ |
Get a link to download a schema |
The API reference lists every field.