> For the complete documentation index, see [llms.txt](https://docs.acrcloud.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acrcloud.com/reference/console-api/buckets/dedup-files.md).

# Dedup Files

## Deduplicate the track file

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/dedup-files`

Upload the fingerprints to the "DedupFile" bucket, you will get the dup files, if there are no dup files, this fingerprint will be inserted into the fingerprint database.

#### Path Parameters

| Name       | Type   | Description   |
| ---------- | ------ | ------------- |
| bucket\_id | string | The bucket id |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

#### Request Body

| Name          | Type   | Description                                                                                                                        |
| ------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| db\_if\_nodup | number | 0 or 1. Whether insert the fingerprint into the database if there are no duplicated tracks in the database. The default value is 1 |
| id            | string | The unique track id                                                                                                                |
| file          | object | The fingerprint file                                                                                                               |

{% tabs %}
{% tab title="200 Cake successfully retrieved." %}

```
{"data":{"dup_files": ["123"], "acr_id":"7b475aff9cf72859f65effe81e741f0e", "do_db": false}}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl" %}

```bash
curl --location --request POST 'https://us-api-v2.acrcloud.com/api/buckets/6556/dedup-files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer Token' \
--form 'id="123"' \
--form 'file=@"/123.wma.db.lo"'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://us-api-v2.acrcloud.com/api/buckets/6556/dedup-files"

payload={'id': '123'}
files=[
  ('file',('123.wma.db.lo',open('/Users/Downloads/22494.wma.db.lo','rb'),'application/octet-stream'))
]
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer Token'
}

response = requests.request("POST", url, headers=headers, data=payload, files=files)

print(response.text)
```

{% endtab %}
{% endtabs %}

## List all the duplicated files

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/dedup-files`

#### Path Parameters

| Name       | Type   | Description   |
| ---------- | ------ | ------------- |
| bucket\_id | string | The bucket id |

#### Query Parameters

| Name      | Type   | Description                 |
| --------- | ------ | --------------------------- |
| per\_page | number | The results number per page |
| page      | number | The page number             |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer Token |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "dup_files": [
                "8a8bfb8a",
                "1a8cfd55"
            ],
            "acr_id": "7b475aff9cf72859f65effe81e741f0e",
            "created_at": "2021-02-18 09:11:23",
            "updated_at": "2021-02-16 23:27:17"
        }
    ],
    "links": {
        "first": "https://us-api-v2.acrcloud.com/api/buckets/123/dedup-files?page=1",
        "last": "https://us-api-v2.acrcloud.com/api/buckets/123/dedup-files?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://us-api-v2.acrcloud.com/api/buckets/123/dedup-files",
        "per_page": "20",
        "to": 1,
        "total": 1
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl" %}

```bash
curl --location --request GET 'https://us-api-v2.acrcloud.com/api/buckets/your_bucket_id/dedup-files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer Token'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://us-api-v2.acrcloud.com/api/buckets/your_bucket_id/dedup-files"

headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer Token'
}

response = requests.request("GET", url, headers=headers)

print(response.text)
```

{% endtab %}
{% endtabs %}

## Get one file's duplicated files

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/dedup-files/:file_id`

#### Path Parameters

| Name       | Type   | Description   |
| ---------- | ------ | ------------- |
| file\_id   | string | The file id   |
| bucket\_id | string | The bucket id |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |

{% tabs %}
{% tab title="200 " %}

```
{
    "data": [
        {
            "dup_files": [
                "8a8bfb8a",
                "1a8cfd55"
            ],
            "acr_id": "7b475aff9cf72859f65effe81e741f0e",
            "created_at": "2021-02-18 09:11:23",
            "updated_at": "2021-02-16 23:27:17"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl" %}

```bash
curl --location --request GET 'https://us-api-v2.acrcloud.com/api/buckets/123/dedup-files/8a8bfb8a' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://us-api-v2.acrcloud.com/api/buckets/123/dedup-files/8a8bfb8a"

payload={}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token'
}

response = requests.request("GET", url, headers=headers, data=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

## Delete an item

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/dedup-files/:acr_ids`

#### Path Parameters

| Name       | Type   | Description       |
| ---------- | ------ | ----------------- |
| bucket\_id | number | The bucket id     |
| acr\_ids   | string | One or more acrid |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |

{% tabs %}
{% tab title="204 " %}

```
```

{% endtab %}
{% endtabs %}
