<!-- source: https://secondlayer.tools/docs/api-reference#delete-deployment -->

## Delete a subgraph

`DELETE /api/subgraphs/{name}` (self-hosted instances only)

Requests cancellation of any queued or running operation, waits up to 30 seconds for the processor to release it, then drops the Postgres schema and the registry row. Irreversible.

### Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | string, required | Subgraph name, as deployed. Lowercase letters, digits and hyphens. |

### Query parameters

| Name | Type | Description |
| --- | --- | --- |
| `force` | boolean | Accepted and logged. The delete proceeds after the 30-second wait either way. |

### Responses

- `200` Deleted
- `400` A parameter, filter, cursor or body field was refused; `code` says which
- `401` This bind requires the instance token, and it was missing or wrong
- `404` No subgraph by this name on this instance (`SUBGRAPH_NOT_FOUND`)
- `415` Missing or non-JSON `Content-Type` (`UNSUPPORTED_MEDIA_TYPE`) — writes must send `Content-Type: application/json`

### Example

```bash
curl -X DELETE http://127.0.0.1:3800/api/subgraphs/{name} \
  -H "Authorization: Bearer $INSTANCE_TOKEN"
```

```json
{
  "message": "Subgraph \"sbtc-flows\" deleted"
}
```
