# Delete stopped containers


[API catalog](/reference/api/) · [Docker Engine overview](/reference/api/engine/version/v1.57/) · [Product manual](https://docs.docker.com/engine/) · [OpenAPI specification](/reference/api/engine/version/v1.57.yaml)

API version: 1.57





`POST /containers/prune`



## Connection and access

[API connection and authentication guidance](/reference/api/engine/version/v1.57/#connection)


Server: `/v1.57`

Effective security: alternatives are OR; schemes within an alternative are AND. An empty array declares no HTTP authentication requirement.

```json
null
```

## Example request

Replace placeholders and provide the required credentials or request body.

```console
curl \
  --request POST \
  --unix-socket "${DOCKER_SOCKET:-/var/run/docker.sock}" \
  --header 'Accept: application/json' \
  'http://localhost/v1.57/containers/prune'
```



## Parameters

### filters

Location: query. Required: no.

Filters to process on the prune list, encoded as JSON (a `map[string][]string`).

Available filters:
- `until=<timestamp>` Prune containers created before this timestamp. The `<timestamp>` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.
- `label` (`label=<key>`, `label=<key>=<value>`, `label!=<key>`, or `label!=<key>=<value>`) Prune containers with (or without, in case `label!=...` is used) the specified labels.


```json
{
  "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=\u003ctimestamp\u003e` Prune containers created before this timestamp. The `\u003ctimestamp\u003e` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=\u003ckey\u003e`, `label=\u003ckey\u003e=\u003cvalue\u003e`, `label!=\u003ckey\u003e`, or `label!=\u003ckey\u003e=\u003cvalue\u003e`) Prune containers with (or without, in case `label!=...` is used) the specified labels.\n",
  "in": "query",
  "name": "filters",
  "pointer": "/paths/~1containers~1prune/post/parameters/0",
  "schema": {
    "type": "string"
  }
}
```

## Request and responses

### Response 200 application/json

No error


Schema:

```json
{
  "properties": {
    "ContainersDeleted": {
      "description": "Container IDs that were deleted",
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "SpaceReclaimed": {
      "description": "Disk space reclaimed in bytes",
      "format": "int64",
      "type": "integer"
    }
  },
  "title": "ContainerPruneResponse",
  "type": "object"
}
```










### Response 500 application/json

Server error


Schema:

```json
{
  "$ref": "#/components/schemas/ErrorResponse"
}
```









Schema example:
```json
{
  "message": "Something went wrong."
}
```


## Complete operation contract

```json
{
  "operationId": "ContainerPrune",
  "parameters": [
    {
      "description": "Filters to process on the prune list, encoded as JSON (a `map[string][]string`).\n\nAvailable filters:\n- `until=\u003ctimestamp\u003e` Prune containers created before this timestamp. The `\u003ctimestamp\u003e` can be Unix timestamps, date formatted timestamps, or Go duration strings (e.g. `10m`, `1h30m`) computed relative to the daemon machine’s time.\n- `label` (`label=\u003ckey\u003e`, `label=\u003ckey\u003e=\u003cvalue\u003e`, `label!=\u003ckey\u003e`, or `label!=\u003ckey\u003e=\u003cvalue\u003e`) Prune containers with (or without, in case `label!=...` is used) the specified labels.\n",
      "in": "query",
      "name": "filters",
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "content": {
        "application/json": {
          "schema": {
            "properties": {
              "ContainersDeleted": {
                "description": "Container IDs that were deleted",
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              "SpaceReclaimed": {
                "description": "Disk space reclaimed in bytes",
                "format": "int64",
                "type": "integer"
              }
            },
            "title": "ContainerPruneResponse",
            "type": "object"
          }
        }
      },
      "description": "No error"
    },
    "500": {
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ErrorResponse"
          }
        }
      },
      "description": "Server error"
    }
  },
  "summary": "Delete stopped containers",
  "tags": [
    "Container"
  ]
}
```

## Referenced schemas

- [#/components/schemas/ErrorResponse](/reference/api/engine/version/v1.57/schemas/ErrorResponse/)




