# Truncate collection

Remove all entities while retaining the collection schema and indexes.

SDK: `@zilliz/milvus2-sdk-node@3.0.10` · Tested with Milvus 3.0.6

Canonical documentation: https://milvus-io.github.io/milvus-sdk-node/rest-api/collections/truncate/

## Section links

- [cURL command](https://milvus-io.github.io/milvus-sdk-node/rest-api/collections/truncate/#curl-command)
- [Default request](https://milvus-io.github.io/milvus-sdk-node/rest-api/collections/truncate/#default-request)
- [Sample response](https://milvus-io.github.io/milvus-sdk-node/rest-api/collections/truncate/#sample-response)
- [Request fields](https://milvus-io.github.io/milvus-sdk-node/rest-api/collections/truncate/#request-fields)

`POST /v2/vectordb/collections/truncate`

Replace `https://your-cluster.example.com` with your Milvus endpoint. Set `MILVUS_TOKEN` for authentication or omit the Authorization header on an unauthenticated cluster.

## cURL command

```bash
curl --request POST --url 'https://your-cluster.example.com/v2/vectordb/collections/truncate' \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer ${MILVUS_TOKEN}" \
  --data-raw '{
  "dbName": "default",
  "collectionName": "books"
}'
```

## Default request

```json
{
  "dbName": "default",
  "collectionName": "books"
}
```

## Sample response

```json
{
  "code": 0,
  "data": {}
}
```

## Request fields

- `dbName` string
  Database name. Operations on collections use default when omitted.
- `collectionName` string (required)
  Name of the collection.

See [`HttpClient.truncateCollection`](https://milvus-io.github.io/milvus-sdk-node/api-reference/http-client/#truncatecollection) for the Node.js SDK method.
