# POST /api/v1/app/{appId}/perch/stop

**Stop a hosted scan**

## Stop a Scan

Stops a running hosted security scan and cleans up the resources used for the scan.

This endpoint will immediately stop any running scan for the specified application and clean up the associated hosted resources. 

### Prerequisites

- A scan must be currently running for this application

### Request Body

| Parameter | Default | Description |
|:---:|:---:|:---:|
|id|""||
|name|""||
|command|{}||

### Response

| Parameter | Default | Description |
|:---:|:---:|:---:|
|id|""||
|name|""||
|status|"UNKNOWN"||

```json
{
	"id": "",
	"name": "",
	"status": "UNKNOWN"
}
```

### Status Response

The response will include a status of `HOSTED_SCANNER_DISCONNECTED` to indicate the scan has been successfully stopped.

### Errors

- **404 Not Found**: Application not found, no active scan, or user doesn't have access

> 👥 Teams Supported
> If the application belongs to a StackHawk [Team](https://docs.stackhawk.com/web-app/teams.html), only members of the Team can call this endpoint.
> 🧾 Audited
> This is recorded as `SCAN_ERRORED` [User Activity](https://apidocs.stackhawk.com/reference/listauditactivity#user-activity-types).

> Requires `write:scan` permission.

## Parameters

- `appId` (in: path, string<uuid>) *(required)* — UUID identifier for this StackHawk Application.

## Request Body

### application/json

- `command` (perch.PerchCommand)
  - `command` (string)
  - `config` (string)
  - `errors` (perch.PerchError[])
    - `errorType` (string)
    - `message` (string)
  - `id` (string)
  - `name` (string)
- `id` (string)
- `name` (string)

## Responses

### 200 — OK

#### application/json

- `id` (string)
- `name` (string)
- `status` (string)

#### application/x-protobuf

- `id` (string)
- `name` (string)
- `status` (string)

### 400 — Bad Request

- (no body)

### 401 — Unauthorized

- (no body)
