Audio Files

post
Upload an audio file/fingerprint

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files
Upload the audio files or fingerprint to the specified bucket
Request
Response
Request
Path Parameters
bucket_id
required
number
The bucket id
Headers
Authentication
required
string
Bearer token
Form Data Parameters
file
required
object
The audio or fingerprint file
title
required
string
The title of this file
audio_type
required
string
the file type, audio or fingerprint
user_defined
optional
string
The user-defined metadata. JSON format.
Response
200: OK
File successfully uploaded.
{
"data": {
"uid": 1,
"acr_id": "6d3e17559677cd79ecb0b7cd2c79bea0",
"bucket_id": 8891,
"state": 0,
"title": "adsfad",
"audio_id": "",
"duration": "78.524082",
"user_defined": {},
"updated_at": "2020-12-24T08:49:17.000000Z",
"created_at": "2020-12-24T08:49:17.000000Z",
"id": 20
}
}
Curl
Python
PHP
Nodejs
Ruby
Curl
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8891/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--form '[email protected]"/Users/olym/Downloads/test.mp3"' \
--form 'title="adsfad"' \
--form 'data_type="audio"'
Python
import requests
url = "https://api-v2.acrcloud.com/api/buckets/8891/files"
payload={'title': 'adsfad','data_type': 'audio'}
files=[
('file',('test.mp3',open('/Users/olym/Downloads/test.mp3','rb'),'audio/mpeg'))
]
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer token'
}
response = requests.request("POST", url,
headers=headers,
data=payload,
files=files)
print(response.text)
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api-v2.acrcloud.com/api/buckets/8891/files',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => array('file'=> new CURLFILE('/Users/olym/Downloads/test.mp3'),'title' => 'adsfad','data_type' => 'audio'),
CURLOPT_HTTPHEADER => array(
'Accept: application/json',
'Authorization: Bearer token'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Nodejs
var axios = require('axios');
var FormData = require('form-data');
var fs = require('fs');
var data = new FormData();
data.append('file', fs.createReadStream('/Users/olym/Downloads/test.mp3'));
data.append('title', 'adsfad');
data.append('data_type', 'audio');
var config = {
method: 'post',
url: 'https://api-v2.acrcloud.com/api/buckets/8891/files',
headers: {
'Accept': 'application/json',
'Authorization': 'Bearer token',
...data.getHeaders()
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
Ruby
require "uri"
require "net/http"
url = URI("https://api-v2.acrcloud.com/api/buckets/8891/files")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Post.new(url)
request["Accept"] = "application/json"
request["Authorization"] = "Bearer token"
form_data = [['file', File.open('/Users/olym/Downloads/test.mp3')],['title', 'adsfad'],['data_type', 'audio']]
request.set_form form_data, 'multipart/form-data'
response = http.request(request)
puts response.read_body

get
List the files

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files
Request
Response
Request
Path Parameters
bucket_id
required
string
The bucket id
Headers
Authentication
required
string
Bearer token
Query Parameters
search
optional
string
search by title
sort
optional
string
sort by id or status, default is sort by id
order
optional
string
asc or desc, default is asc
page
optional
number
The page number
per_page
optional
number
The results number per page
Response
200: OK
{
"data": [
{
"id": 20,
"uid": 1,
"bucket_id": 8891,
"acr_id": "6d3e17559677cd79ecb0b7cd2c79bea0",
"state": 0,
"title": "adsfad",
"user_defined": {},
"duration": 79,
"audio_id": "",
"created_at": "2020-12-24T08:49:17.000000Z",
"updated_at": "2020-12-24T08:49:17.000000Z"
},
{
"id": 13,
"uid": 1,
"bucket_id": 8891,
"acr_id": "224b26f7e3a3c44858be896c0fd9f45f",
"state": 0,
"title": "adsfad2",
"user_defined": {},
"duration": 79,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
},
{
"id": 12,
"uid": 1,
"bucket_id": 8891,
"acr_id": "0e5e7e376f7e177bbcb4da898f740a15",
"state": 0,
"title": "bucket",
"user_defined": {
"artist": "abc",
"album": "334",
"from": "ucf",
"played_duration": 8,
"ucf_id": "338229"
},
"duration": 206,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
},
{
"id": 11,
"uid": 1,
"bucket_id": 8891,
"acr_id": "6c875f014b9ca0ae89f44e1f93151b05",
"state": 0,
"title": "adsfad",
"user_defined": {},
"duration": 10,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
},
{
"id": 10,
"uid": 1,
"bucket_id": 8891,
"acr_id": "3ccdac434e9d08df333e8a5b4b8169fc",
"state": 0,
"title": "02c1d27e39",
"user_defined": {
"artist": "abc",
"album": "334",
"name": "asdf"
},
"duration": 14,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
},
{
"id": 7,
"uid": 1,
"bucket_id": 8891,
"acr_id": "625b970b5b837326fc927bd14cbfceb5",
"state": 1,
"title": "ddddaa",
"user_defined": {},
"duration": 300,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
},
{
"id": 6,
"uid": 1,
"bucket_id": 8891,
"acr_id": "87cd4888e660049f21199b812cc30346",
"fp_id": null,
"state": 1,
"title": "test",
"user_defined": {},
"duration": 300,
"audio_id": "",
"created_at": "2020-12-20T21:43:34.000000Z",
"updated_at": "2020-12-20T21:43:49.000000Z"
}
],
"links": {
"first": "http://127.0.0.1:8080/api/buckets/8891/files?page=1",
"last": "http://127.0.0.1:8080/api/buckets/8891/files?page=1",
"prev": null,
"next": null
},
"meta": {
"current_page": 1,
"from": 1,
"last_page": 1,
"path": "http://127.0.0.1:8080/api/buckets/8891/files",
"per_page": "20",
"to": 7,
"total": 7
}
}
Curl
Python
Curl
curl --request GET 'https://api-v2.acrcloud.com/api/buckets/8891/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
Python
import requests
url = "https://api-v2.acrcloud.com/api/buckets/8891/files"
headers = {
'Accept': 'application/json',
'Authorization': 'Bearer token'
}
response = requests.get(url, headers=headers)
print(response.text)

put
Update a file

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files/:id
Update the metadata of a file
Request
Response
Request
Path Parameters
bucket_id
required
number
The bucket id
id
required
number
The file id/acr_id
Headers
Authentication
required
string
Bearer token
Body Parameters
title
optional
string
The file title.
user_defined
optional
string
User-defined metadata, JSON format.
Response
200: OK
{
"data": {
"id": 20,
"uid": 1,
"bucket_id": 8891,
"acr_id": "6d3e17559677cd79ecb0b7cd2c79bea0",
"state": 0,
"title": "update-title",
"user_defined": {
"artists": "update-artist"
},
"duration": 79,
"audio_id": "",
"created_at": "2020-12-24T08:49:17.000000Z",
"updated_at": "2020-12-25T04:34:27.000000Z"
}
}
Curl
Curl
curl --location --request PUT 'https://api-v2.acrcloud.com/api/buckets/8891/files/20' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"title":"update-title", "user_defined":{"artists":"update-artist"}}'

delete
Delete files

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files/:ids
Request
Response
Request
Path Parameters
bucket_id
required
number
The bucket id
ids
required
number
The file ids/acrids, seperated by ","
Headers
Authentication
required
string
Bearer token
Response
204: No Content
Curl
Curl
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/buckets/8891/files/12,13' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'

put
Move the files to another bucket

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files/:ids/move
Move the files to another bucket
Request
Response
Request
Path Parameters
bucket_id
required
number
The bucket id that you want move the files to.
ids
required
string
One or multiple ids/acrids, separated by ","
Headers
Authentication
required
string
Bearer token
Response
201: Created
Curl
Curl
curl --location --request PUT 'https://api-v2.acrcloud.com/api/buckets/8892/files/12,13' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'

get
Get one or multiple files

https://api-v2.acrcloud.com/api/buckets/:bucket_id/files/:ids
Request
Response
Request
Path Parameters
ids
optional
string
The files ids or acrids. Seperated by ","
bucket_id
required
string
The bucket id
Headers
Authentication
required
string
Bearer token
Response
200: OK
{
"data": [
{
"id": 12945472,
"uid": 19,
"bucket_id": 966,
"acr_id": "75806fee10cf4405de502435129d6c06",
"state": 1,
"title": "api-test",
"user_defined": {},
"duration": 174,
"created_at": "2020-10-14T11:02:15.000000Z",
"updated_at": "2020-10-14T11:02:15.000000Z",
"audio_id": "123"
},
{
"id": 12403501,
"uid": 19,
"bucket_id": 966,
"acr_id": "39a2d627dad781f5fbdb65e0e7d4d7c9",
"state": 1,
"title": "bucket-report-test",
"user_defined": {
"ucf_id": "718876"
},
"duration": 13,
"created_at": "2020-09-01T03:50:23.000000Z",
"updated_at": "2020-09-01T03:50:23.000000Z",
"audio_id": ""
},
{
"id": 12398516,
"uid": 19,
"bucket_id": 966,
"acr_id": "904475b22cc6ffe6692b07dcd65b8ef8",
"state": 1,
"title": "music",
"user_defined": {
"ucf_id": "725868"
},
"duration": 8,
"created_at": "2020-08-31T15:09:07.000000Z",
"updated_at": "2020-08-31T15:09:07.000000Z",
"audio_id": ""
},
{
"id": 12398474,
"uid": 19,
"bucket_id": 966,
"acr_id": "3b6fc496391a6a1758b6cd48da4f792b",
"state": 1,
"title": "happy",
"user_defined": {
"ucf_id": "718878"
},
"duration": 10,
"created_at": "2020-08-31T15:05:40.000000Z",
"updated_at": "2020-08-31T15:05:40.000000Z",
"audio_id": ""
},
{
"id": 12395185,
"uid": 19,
"bucket_id": 966,
"acr_id": "fe34ec4ffbcec033ec2ed050f4b0daa7",
"state": 1,
"title": "test",
"user_defined": {
"ucf_id": "690303"
},
"duration": 10,
"created_at": "2020-08-31T10:20:33.000000Z",
"updated_at": "2020-08-31T10:20:33.000000Z",
"audio_id": ""
},
{
"id": 12158027,
"uid": 19,
"bucket_id": 966,
"acr_id": "d66a31c5e62cf3e86874476da60db641",
"state": 1,
"title": "test",
"user_defined": {
"type": "advert",
"from": "ucf",
"played_duration": 16,
"ucf_id": "725869"
},
"duration": 30,
"created_at": "2020-08-11T04:03:31.000000Z",
"updated_at": "2020-08-11T04:03:31.000000Z",
"audio_id": ""
},
{
"id": 11163949,
"uid": 19,
"bucket_id": 966,
"acr_id": "601a566c3d4d77dfdb220e750384f842",
"state": 1,
"title": "Kesayanganku",
"user_defined": {
"artist": "Al Ghazali",
"from": "ucf",
"played_duration": 0,
"ucf_id": "579162"
},
"duration": 240,
"created_at": "2020-06-14T13:30:49.000000Z",
"updated_at": "2020-06-14T13:30:49.000000Z",
"audio_id": ""
},
{
"id": 1849311,
"uid": 19,
"bucket_id": 966,
"acr_id": "db397154fb9858f17373b5bf66be875a",
"state": 1,
"title": "Hiding my heart - Adele",
"user_defined": {
"title": "Hiding my heart",
"artist": "Adele"
},
"duration": 208,
"created_at": "2016-10-09T14:09:43.000000Z",
"updated_at": "2016-10-09T14:09:49.000000Z",
"audio_id": "12345"
}
]
}
Curl
Curl
curl --location --request GET 'https://api-v2.acrcloud.com/api/buckets/966/files/13045360,13044049' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'