# Introduction

View reference documentation to learn about the resources available in the ACRCloud  API/SDK.

{% content-ref url="/pages/-MPgrMZQ9U0HQNf3ix3v" %}
[Console Tutorials](/get-started/tutorials)
{% endcontent-ref %}

{% content-ref url="/pages/-MDtANLCYHpg-p3PBzXV" %}
[SDK REFERENCE](/sdk-reference/mobile-sdk)
{% endcontent-ref %}

{% content-ref url="/pages/-MDsugptSHloCW9IqWf0" %}
[API Reference](/reference/identification-api)
{% endcontent-ref %}

{% content-ref url="/pages/-MQBy-FY8\_rWKdvHhq9V" %}
[Tools](/tools/fingerprinting-tool)
{% endcontent-ref %}

{% content-ref url="/pages/-MDt9dJBRvXrINX6KmXe" %}
[Broken mention](broken://pages/-MDt9dJBRvXrINX6KmXe)
{% endcontent-ref %}

{% content-ref url="/pages/-MQurpRhUZkiqeGeQlYo" %}
[FAQ](/faq/definition-of-terms)
{% endcontent-ref %}


# Console Tutorials

Find a tutorial fits your scenario and get started to test the service.


# Recognize Music

Identify music via line-in audio source or microphone with ACRCloud Music database.

**Music Recognition Service** enables your product ( apps or pc software ) to recognize music by sounds or files.

In this tutorial, we use the **ACRCloud Music** bucket, if you want to recognize your own content, please refer to [**Recognize Custom Content**](/get-started/tutorials/recognize-custom-content).

## Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

## Audio & Video Recognition (Programming skills required)

### Create a project

Go to your [dashboard](https://console.acrcloud.com/), build and configure an Audio & Video Recognition (AVR) project and attach the bucket named **ACRCloud Music** as below.

![](/files/-MQHg6tzEmzokho5hfnQ)

{% hint style="info" %}
**Audio Engine:**\
**Audio Fingerprinting:** Only detect the exact same version.\
**Cover Song (humming) Identification**: Detect covers/live performance or humming.\
**Audio Fingerprinting & Cover Song (humming) Identification:** Detect both options.\
\
**Audio Source:**\
Choose **Recorded Audio** for the audio source to deal with noise.\
Choose **Line-in Audio** for the audio source if you want to recognize files without noise.

\
**3rd Party ID Integration:**\
Enable them if you need ISRC, UPC or IDs of Spotify, Deezer, Youtube etc.
{% endhint %}

### Find the credentials

Save the **“host”, “access\_key”, “access\_secret”** of your project for future use. You can find them in the places shown below.

![](/files/-MQHgppJPGfhmu-qi9nX)

### Integrate with SDK/API

Start sending requests with [Mobile SDK](/sdk-reference/mobile-sdk), [Backend SDK](/sdk-reference/backend-sdk), [Identification API](/reference/identification-api/identification-api) or [File Scan Tool](/tools/file-scan-tool). You can find all of the SDKs and Tools on [this page](https://console.acrcloud.com/#/tools).

{% hint style="info" %}
*For using our SDKs to scan files, SDKs will use 10 seconds of an audio clip for the recognition of a single request, you will need to send multiple requests to 1 file with different parts of the file if you want to get results from different parts of 1 file.*
{% endhint %}

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MDt7u22mAzT5sqHc4q1" %}
[Base Projects](/reference/console-api/base-projects)
{% endcontent-ref %}

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required), please make sure to check "ACRCloud Music bucket" and "3rd Party ID Integration" to get the full pricing.

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

## File Scanning (Programming skills not required)

You can detect covers/live performances on File Scanning with Audio/Video files or Youtube URLs

### Create a container

Go to "File Scanning" product and then go to "[Containers](https://console.acrcloud.com/filescanning#/fs-containers)" then click "Create" to create a container with ACRCloud Music bucket and other parameters.

<figure><img src="/files/6Z4WJZLedrhs0OkE76B5" alt=""><figcaption></figcaption></figure>

Here are some explanations for the parameters:

{% hint style="info" %}
**Audio Engine:**\
**Audio Fingerprinting:** Only detect the exact same version.\
**Cover Song Identification**: Detect covers/live performance.\
**Audio Fingerprinting & Cover Song Identification:** Detect both options.\
**Speech Recognition (Speech-to-Text)**: Transcribe the text from speech.\
**AI Music Detection:** Detect if the tracks were generated by AI and potenially the AI generation platforms/models. (Please select this option as Audio Engine if you want to use AI Music Detection only in this container.)\
\
**Audio Source:**\
Choose **Recorded Audio** for the audio source to deal with noise.\
Choose **Line-in Audio** for the audio source if you want to recognize files without noise.\
\
**Scanning Policy:**\
Choose **Traverse Scanning** if you want to scan the entire file for multiple songs in different parts of the file.\
Choose **Points Scanning** if there's only one song per file.

**Result Callback URL:**\
You can set a Callback URL to receive scanning results.

\
**Music/Speech Detection:**\
Enable this feature if you want to detect parts of the file may contain music but music were not detected by music recognition, this feature tells you which parts of the file may contain music.

**Derivative Works Detection:**

This feature is for detecting derivative works such as large range of modified tracks, sped up/down, pitch shifting content. Recommanded for music distributors and DSPs. You can test up to 10 files for testing, please [contact us](https://acrcloud.com/contact/) if you want to use this service commercially.

After selecting this option, the system will fill in the other options with pre-set values. You do not need to select other options, just enter the name of the container.

**AI Music Detection:** Enable this option to detect if the tracks were generated by AI and potenially the AI generation platforms/models. (You can select other Audio Engines while still use AI Music Detection.)
{% endhint %}

### Upload files to scan

Go to the container you just created and click "Upload" to upload or add the files that you want to scan.

![](/files/-MYFC3sq7p4JJgaEOhI7)

{% hint style="info" %}
Data Type:\
\
**Audio**: You can upload audio/video files;\
**Fingerprint**: You can use the [Audio File Fingerprinting Tool](https://github.com/acrcloud/acrcloud_extr_tools) to generate fingerprint files and upload fingerprint files as they are much smaller (Cover Song Identification doesn't support fingerprint);\
**Youtube**: You can simply input the Youtube video/channel/playlist URL if you want to detect Youtube video;\
**TikTok/Facebook/Instagram/Twitter**: You can simply input the post URL if you want to detect video on those platforms;
{% endhint %}

### Browse results

When the "Status" turns "ready" you are able to click the arrow to browse the results on the page or select the files then click "Action" then click "Export" to export the reports.

![](/files/-MYFG8DCwxdij2FO8Fc5)

### Integrate with the API

You can integrate with [File Scanning API ](/reference/console-api/file-scanning)to do everything via API.

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on[ this page](https://console.acrcloud.com/filescanning#/pricing) (login required), please make sure to check "ACRCloud Music bucket" to get the full pricing.

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

## Metadata

Check out [Music Metadata ](/reference/console-api/file-scanning/metadata/music)to get familiar with the JSON structure of the response data for future development.


# Recognize Custom Content

Identify your custom content via media files or microphone with internet connections.

**Custom Content Recognition Service** enables your product (apps or server side software) to recognize your own songs, advertisements, TV shows/series or movies by sounds.

This service is for detecting your custom content, if you want to recognize music with **ACRCloud Music bucket**, please refer to [**Recognize Music**](/get-started/tutorials/recognize-music).

## Preparation

## Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

## Create a custom bucket

Go to your [dashboard](https://console.acrcloud.com/), create a bucket as follow.

![](/files/-MQHp9OIMDghT1XRPpca)

Network Type is the type of bucket you want to use for online recognition projects or offline recognition projects.

## Upload the files to the bucket

Upload **my\_song\_1.mp3** into the bucket you just created.

![](/files/-MQHpbz9dy5C6Nsdm38U)

After uploading, refresh the page, state “ready” which means you’ve uploaded the file successfully.

![](/files/-MQHpkTXkrjd4yO2EqFT)

If you need to upload massive of content, please generate fingerprint files with [Audio Fingerprinting Tool ](/tools/fingerprinting-tool)on your local server then upload fingerprinting files via [Console API](/reference/console-api/buckets).

### Audio & Video Recognition (Programming skills required)

### Create a project

Create a project and bind the bucket you just created to it.

![](/files/-MQHqXtmDN0Dh_m1nwQI)

### Find the credentials

Save the **“host”, “access\_key”, “access\_secret”** of your project. You can find them in the places shown below.

![](/files/-MQHqtnUo-NymbHugr2d)

### Integrate with SDK/API <a href="#integrate-with-sdk-api" id="integrate-with-sdk-api"></a>

Start sending requests with [Mobile SDK](https://app.gitbook.com/@acrcloud/s/acrcloud/~/drafts/-MQHmM8p3zbmQ4uy275g/sdk-reference/mobile-sdk), [Backend SDK](https://app.gitbook.com/@acrcloud/s/acrcloud/~/drafts/-MQHmM8p3zbmQ4uy275g/sdk-reference/backend-sdk), [Identification API](https://app.gitbook.com/@acrcloud/s/acrcloud/~/drafts/-MQHmM8p3zbmQ4uy275g/reference/identification-api) or [File Scan Tool](https://app.gitbook.com/@acrcloud/s/acrcloud/~/drafts/-MQHmM8p3zbmQ4uy275g/tools/file-scan-tool). You can find all of the SDKs and Tools on [this page](https://console.acrcloud.com/#/tools).‌

{% hint style="info" %}
*For using our SDKs to scan files, SDKs will use 10 seconds of an audio clip for the recognition of a single request, you will need to send multiple requests to 1 file with different parts of the file if you want to get results from different parts of 1 file.*&#x200C;
{% endhint %}

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MDsvdTMPA1bB6cJSgDI" %}
[Buckets](/reference/console-api/buckets)
{% endcontent-ref %}

{% content-ref url="/pages/-MDt7u22mAzT5sqHc4q1" %}
[Base Projects](/reference/console-api/base-projects)
{% endcontent-ref %}

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required).

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

## File Scanning (Programming skills not required)

### Create a container

Go to "File Scanning" product and then go to "[Containers](https://console.acrcloud.com/filescanning#/fs-containers)" then click "Create" to create a container with the bucket you just created and choose other parameters.

![](/files/-MYFaHqFDjJV28VOglYT)

Here are some explanations for the parameters:

{% hint style="info" %}
**Audio Engine:**\
**Audio Fingerprinting:** Detect the exact same version of the files you uploaded to the buckets.\
**Speech Recognition (Speech-to-Text)**: Transcribe the text from speech.\
\
**Audio Source:**\
Choose **Recorded Audio** for the audio source to deal with noise.\
Choose **Line-in Audio** for the audio source if you want to recognize files without noise.<br>

**Scanning Policy:**\
Choose **Traverse Scanning** if you want to scan the entire file for multiple songs in different parts of the file.\
Choose **Points Scanning** if there's only one song per file.
{% endhint %}

### Upload files to scan

Go to the container you just created and click "Upload" to upload or add the files that you want to scan.

![](/files/-MYFC3sq7p4JJgaEOhI7)

{% hint style="info" %}
Data Type:\
\
**Audio**: You can upload audio/video files;\
**Fingerprint**: You can use the [Audio File Fingerprinting Tool](https://github.com/acrcloud/acrcloud_extr_tools) to generate fingerprint files and upload fingerprint files as they are much smaller;\
**Youtube**: You can simply input the Youtube video URL if you want to detect Youtube video;
{% endhint %}

### Browse results

When the "Status" turns "ready" you are able to click the arrow to browse the results on the page or select the files then click "Action" then click "Export" to export the reports.

![](/files/-MYFG8DCwxdij2FO8Fc5)

### Integrate with the API

You can integrate with [File Scanning API ](/reference/console-api/file-scanning)to do everything via API.

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on[ this page](https://console.acrcloud.com/filescanning#/pricing) (login required).

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

## Deduplication

Please use the API below if you want to deduplicate the media files.

{% content-ref url="/pages/-MT5Ka9NccTSGpqOeSF8" %}
[Dedup Files](/reference/console-api/buckets/dedup-files)
{% endcontent-ref %}

{% hint style="info" %}
Please note: You will need to [contact us](mailto:support@acrcloud.com) if you want to use the API for deduplcaition.
{% endhint %}

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required).

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

## Metadata

Check out [**Custom Files Metadata**](/reference/console-api/file-scanning/metadata/custom-files) to get familiar with the JSON structure of the response data for future development.

###


# Broadcast Monitoring for Music

Monitor live streams, radio or TV stations with ACRCloud Music database.

Broadcast Monitoring for Music Service helps you build a broadcast monitoring system for music monitoring and tracking.

## Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

## **Choose Broadcast Monitoring mode:**

*There are 2 options for Broadcast Monitoring:*

* *Broadcast Database (highly recommended): We provide a database of radio and TV channels worldwide, you just need to select the channels that you want to monitor from the list, we will take care of the live feeds of the channels;*
* *Custom Streams: If you have your own stream URLs or you want to monitor the streams on your local server, then you can use this option, please note: You need to take care of stream availabilities with this option;*

## Broadcast Database (highly recommended)

### Select channels & create a project

Click “Broadcast Database” under Broadcast Monitoring on the left sidebar, click “Create Project” on the Broadcast Database Monitoring Projects page, key in the “Project Name” and select “**ACRCloud Music**” on the bucket dropdown list, then click “Create” to finish creating the project，then click the name of the project you just created go into the projecct page, click "Add Channels" then browse the channels by selecting the continents -> countries -> channels or search the channels you want to monitor on the search bar, check the box to select the channels then click “Update Project”, (You will need to pay if you didn’t buy the capacity before).

![](/files/-MQHvnJkpbglRtNsrXoY)

### Set Timemap (Optional)

Timemap allows you to browse the recording files of the channels that you are monitoring, you can set Timemap by selecting the channels then click “Timemap” icon and click “Update” on the popup page (You will need to pay if you didn’t buy the capacity before):

![](/files/8X1eFwdmY2Ak2je1NDKN)

### Set Cover Song Identification (Optional)

Cover Song Identification allows the system to detect different versions of the song such as covers and live performances on the live streams. You can enable Cover Song Identification by selecting the channels then click "Coversong" icon and click “Update” on the popup page (You will need to pay if you didn’t buy the capacity before. Cover Song Identification requires the Timemap to be enabled on those channels):

<figure><img src="/files/iHfmE9Y5gsK7wdKkjsKo" alt=""><figcaption></figcaption></figure>

### Set UCF (Optional)

Go to [Unkown Content Filter](https://console.acrcloud.com/ucf#/dashboard) on the dashboard, create a UCF project and go into the project you just created and add streams from Broadcast Monitoring projects.

### Configuration

You can search the channels you are monitoring by Channel ID, Channel Name, Custom ID, Mytuner ID or City, You can also filter the channels by Channel Type and If they are set Timemap or not.

Click the download icon next to the search bar to download the list of the channels in this project;

Click “Edit” under Action to add/edit “Custom ID” of the channels, you can get these custom IDs via [Callback URL](/reference/console-api/bm-projects/broadcast-database-projects#set-results-callback-url);

![](/files/-MQRrNMJZ5RBYT4MR9Zb)

### Get Results

* Monitoring Results on Page: You can click “View” -> “Results” under “Action” to browse monitoring results, you can download the reports on this page (The results of Cover Song Identification will be shown on the next day).
* Callback URL (highly recommended): It will push the results to your server, please refer to [the doc here](/reference/console-api/bm-projects/broadcast-database-projects#set-results-callback-url):
* Monitoring API: You can call the endpoint to get the historical results, please refer to [the doc here](/reference/console-api/bm-projects/broadcast-database-projects/channels-results);
* Timemap: You can click “View” -> “Timemap” under “Action” to browse Timemap data. You can download the recording files of the identified items via [Recording API](/reference/console-api/bm-projects/custom-streams-projects/recordings).
* UCF: You can click “View Results” in UCF project to browse and review the UCF results and potentially flag new content to the buckets and reports;
* Data Analytics: You can click the icon shown on the image below to analyze the data:

![](/files/-MgPsT4I3c1yaMi5xBvs)

### Use the service commercially

Please refer to the [pricing here](#pricing-and-discount). Once you decided to use the service commercially please [add a credit card here](https://console.acrcloud.com/account#/billing/paymentmethods) then click "Purchase" ---> "Purchase Reserved Streams" or "Purchase Reserved Timemap" or "Purchase Reserved Coversong"under the project page to buy the capacity. (Shown in the image below)

![](/files/ZKVpmXig8MMlWABfJHW2)

Once you decided to decrease the capacity of the steams or capacity, please click "Decrease" ----> "Decease Reserved Streams" or "Decease Reserved Timemaps" or "Decease Reserved Coversong" under the project page to decrease the capacity. (Shown in the image below)

![](/files/kQum77iQzNo59grxwqvq)

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MPNvatbJc\_dip7dVEal" %}
[Broadcast Database Projects](/reference/console-api/bm-projects/broadcast-database-projects)
{% endcontent-ref %}

{% content-ref url="/pages/-MPOl4KmIX9G0kqxBFPU" %}
[UCF Projects](/reference/console-api/ucf-projects)
{% endcontent-ref %}

## Custom Streams

### Preparation

In this tutorial, we use [SomaFM's PopTron](https://somafm.com/poptron/) as an example.

{% hint style="info" %}
The live stream URL of SomaFM's PopTron is:\
<https://somafm.com/poptron.pls>
{% endhint %}

### Create a project

Create a Custom Stream project and attach the bucket named **ACRCloud Music** as the following image shows.

![](/files/-MQRz2swKb52xQbAzmuK)

{% hint style="info" %}
In this tutorial, we choose to monitor streams on ACRCloud. If you want to build a broadcast monitoring system on your own server, please use the [Local Monitoring Tool](/tools/local-monitoring-tool).

Enable 3rd Party ID Integration if you need ISRC, UPC or IDs of Spotify, Deezer, and Youtube etc.
{% endhint %}

### Add Streams & Timemap & Cover Song Identification

Click on the name of the project just created to enter the project page. Add the stream URL to the project as the following picture shows and choose the config you need (You will need to pay if you didn’t buy the capacity before).

{% hint style="info" %}
Timemap is the audio/video recordings of the detection;

Cover Song Identification allows the system to detect different versions of the song;
{% endhint %}

<figure><img src="/files/VbY9qNrVSyptSLls1RWY" alt=""><figcaption></figcaption></figure>

### Set UCF (Optional)

Go to [Unkown Content Filter](https://console.acrcloud.com/ucf#/dashboard) on the dashboard, create a UCF project and go into the project you just created and add streams from Broadcast Monitoring projects.

### Get results

Now, you can see the result in about 1 minute.

Monitoring Results: Click “View” -> “Results” under “Actions” to browse results under "ACRCloud Music" tab on the page.\
Timemap: Click “View” -> “Timemap” under “Actions” to browse Timemap data. You can download the recording files of the identified items via [Recording API](https://docs.acrcloud.com/reference/console-api/bm-projects/custom-streams-projects/recordings).\
Cover Song Identification Results: “View” -> “Results” under “Actions” to browse results under "Inserted Results" tab on the page (The results of Cover Song Identification will be shown on the next day).\
UCF: You can click “View Results” in UCF project to browse and review the UCF results and potentially flag new content to the buckets and reports;\
Callback URL (highly recommended): It will push the results to your server, please refer to [the doc here:](/reference/console-api/bm-projects/custom-streams-projects#set-result-callback-url)\
Monitoring API: You can call the endpoint to get the historical results, please refer to [the doc here](/reference/console-api/bm-projects/custom-streams-projects/streams-results#get-the-stream-monitoring-results);\
Data Analytics: You can click the icon shown on the image below to analyze the data:

![](/files/-MgPtiDkVUG9GrqwJJ6b)

### Use the service commercially

Please refer to the [pricing here](#pricing-and-discount). Once you decided to use the service commercially, please [add a credit card here](https://console.acrcloud.com/account#/billing/paymentmethods) then click "Purchase" ---> "Purchase Reserved Streams" or "Purchase Reserved Timemap" or "Purchase Reserved Coversong" under the project page to buy the capacity.

<figure><img src="/files/6BNgPK142Z6qrwhwY0bv" alt=""><figcaption></figcaption></figure>

Once you decided to decrease the capacity of the steams or capacity, please click "Decrease" ----> "Decease Reserved Streams" or "Decease Reserved Timemaps" or "Decease Reserved Coversong" under the project page to decrease the capacity.

<figure><img src="/files/kZB8hBecqWtaT3W7VxjA" alt=""><figcaption></figcaption></figure>

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MPNvc7Ykp59silpQgy-" %}
[Custom Streams Projects](/reference/console-api/bm-projects/custom-streams-projects)
{% endcontent-ref %}

{% content-ref url="/pages/-MPOl4KmIX9G0kqxBFPU" %}
[UCF Projects](/reference/console-api/ucf-projects)
{% endcontent-ref %}

## Metadata

Check out[ Music Metadata ](/reference/console-api/bm-projects/metadata/music-broadcast-monitoring-with-broadcast-database)get familiar with the JSON structure of the response data for future development.

## Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required), please make sure to check "ACRCloud Music bucket" and "3rd Party ID Integration" to get the full pricing.

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!

<br>


# Broadcast Monitoring for Custom Content

Monitor live streams, radio or TV stations with your custom database.

Broadcast Monitoring for Custom Content Service helps you build the broadcast monitoring system for monitoring and tracking your own contents such as the advertisement, TV shows/series, songs and movies.

This service is for detecting your custom content, if you want to monitor music with **ACRCloud Music bucket**, please refer to [**Broadcast Monitoring for Music**](/get-started/tutorials/broadcast-monitoring-for-music).

## Preparation

This tutorial shows how to manage your own audios. In case you don’t have test audios in hand, we prepared some files, you can download the files below.

{% file src="/files/-MQHoAU5blwchEWRiElK" %}
Download the files
{% endfile %}

Unzip the downloaded file and you’ll find 6 audio files:

![](/files/-MQHom_p7mJbHFx9JPJT)

## Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

## Create a custom bucket

Go to your [dashboard](https://console.acrcloud.com/), create a bucket as follow.

![](/files/-MQHp9OIMDghT1XRPpca)

Network Type is the type of bucket you want to use for online recognition projects or offline recognition projects.

## Upload the files to the bucket

Upload **my\_song\_1.mp3** into the bucket you just created.

![](/files/-MQHpbz9dy5C6Nsdm38U)

After uploading, refresh the page, state “ready” which means you’ve uploaded the file successfully.

![](/files/-MQHpkTXkrjd4yO2EqFT)

If you need to upload massive of content, please generate fingerprint files with [Audio Fingerprinting Tool ](/tools/fingerprinting-tool)on your local server then upload fingerprinting files via [Console API](/reference/console-api/buckets).

## Broadcast Database (highly recommended)

### Select Channels in Broadcast Database

Click “Broadcast Database” under Broadcast Monitoring on the left sidebar, click “Create Project” on the Broadcast Database Monitoring Projects page, key in the “Project Name” and select your own bucket on the bucket dropdown list, then click “Create” to finish creating the project，then click the name of the project you just created go into the projecct page, click "Add Channels" then browse the channels by selecting the continents -> countries -> channels or search the channels you want to monitor on the search bar, check the box to select the channels then click “Update Project”, (You will need to pay if you didn’t buy the capacity before).

![](/files/-MQS76A8s0StFl1LrrWG)

### Set Timemap (Optional)

Timemap allows you to browse the recording files of the channels that you are monitoring, you can set timemap by selecting the channels click “Set Timemap” icon and click “Update” on the popup page (You will need to pay if you didn’t buy the capacity before):

![](/files/-MQS7LHKn6pUThXZ45vF)

### Set UCF (Optional)

Go to [Unknown Content Filter](https://console.acrcloud.com/ucf#/dashboard) on the dashboard, create a UCF project and go into the project you just created and add streams from Broadcast Monitoring projects. Please refer to [this tutorial](https://docs.acrcloud.com/tutorials/find-potential-detections-in-unknown-content-filter#set-ai-a-ds-finder-in-ucf) to get started.

### Configuration

You can search the channels you are monitoring by Channel ID, Channel Name, Custom ID, Mytuner ID or City, You can also filter the channels by Channel Type and If they are set Timemap or not.

Click the download icon next to the search bar to download the list of the channels in this project;

Click “Edit” under Action to add/edit “Custom ID” of the channels, you can get these custom IDs via [Callback URL](/reference/console-api/bm-projects/broadcast-database-projects#set-results-callback-url);

![](/files/-MQRrNMJZ5RBYT4MR9Zb)

### Get Results

* Monitoring Results on Page: You can click “View” -> “Results” under “Action” to browse monitoring results, you can download the reports on this page.
* Callback URL (highly recommended): It will push the results to your server, please refer to [the doc here](/reference/console-api/bm-projects/broadcast-database-projects#set-results-callback-url):
* Monitoring API: You can call the endpoint to get the historical results, please refer to [the doc here](/reference/console-api/bm-projects/broadcast-database-projects/channels-results);
* Timemap: You can click “View” -> “Timemap” under “Action” to browse Tiemmap data. You can download the recording files of the identified items via [Recording API](/reference/console-api/bm-projects/custom-streams-projects/recordings).
* UCF: You can click “View Results” in UCF project to browse and review the UCF results and potentially flag new content to the buckets and reports;

### Use the service commercially

Please refer to the [pricing here](#pricing-and-discount). Once you decided to use the service commercially please [add a credit card here](https://console.acrcloud.com/account#/billing/paymentmethods) then click "Purchase" ---> "Purchase Reserved Streams" or "Purchase Reserved Timemaps" under the project page to buy the capacity.

Once you decided to decrease the capacity of the steams or capacity, please click "Decrease" ----> "Decease Reserved Streams" under the project page to decrease the capacity.

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MDsvdTMPA1bB6cJSgDI" %}
[Buckets](/reference/console-api/buckets)
{% endcontent-ref %}

{% content-ref url="/pages/-MPNvatbJc\_dip7dVEal" %}
[Broadcast Database Projects](/reference/console-api/bm-projects/broadcast-database-projects)
{% endcontent-ref %}

{% content-ref url="/pages/-MPOl4KmIX9G0kqxBFPU" %}
[UCF Projects](/reference/console-api/ucf-projects)
{% endcontent-ref %}

## Custom Streams

### Preparation

In this tutorial, we use [BBC Radio 1](http://www.bbc.co.uk/radio1) as an example.

{% hint style="info" %}
The live stream URL of BBC Radio 1 is:\
<http://open.live.bbc.co.uk/mediaselector/5/select/version/2.0/mediaset/http-icy-mp3-a/vpid/bbc_radio_one/format/pls.pls>
{% endhint %}

### Create a project

Create a custom streams project and bind your own bucket.

![](/files/-MQS9em6vVoQgnom7sJr)

{% hint style="info" %}
In this tutorial, we choose to monitor streams on ACRCloud. If you want to build a broadcast monitoring system on your own server, please use the [Local Monitoring Tool](/tools/local-monitoring-tool).
{% endhint %}

#### Add custom streams & Timemap

Click on the name of the project just created to enter the project page. Add the radio stream URL to the project as the following picture shows. (You will need to pay if you didn’t buy the capacity before).

![](/files/-MQSAAS3dqM34e8JUlfp)

{% hint style="info" %}
To see the results quickly, choose “realtime” in the Config. However, if you want to have the played\_duration data, please select “non realtime” in the Config. Please select “non realtime and timemap” if you need Timemap (You will need to pay for the Tiemmap).
{% endhint %}

### Set UCF (Optional)

Go to [Unkown Content Filter](https://console.acrcloud.com/ucf#/dashboard) on the dashboard, create a UCF project and go into the project you just created and add streams from Broadcast Monitoring projects. Please refer to [this tutorial](https://docs.acrcloud.com/tutorials/find-potential-detections-in-unknown-content-filter#set-ai-a-ds-finder-in-ucf) to get started.

### Get results

Now, you can see the result in about 1 minute.

Monitoring Results: Click “View” -> “Results” under “Actions” to browse results on page. Timemap: Click “View” -> “Timemap” under “Actions” to browse Timemap data. You can download the recording files of the identified items via [Recording API](https://docs.acrcloud.com/reference/console-api/bm-projects/custom-streams-projects/recordings).\
UCF: You can click “View Results” in UCF project to browse and review the UCF results and potentially flag new content to the buckets and reports;\
Callback URL (highly recommended): It will push the results to your server, please refer to [the doc here:](/reference/console-api/bm-projects/custom-streams-projects#set-result-callback-url)\
Monitoring API: You can call the endpoint to get the historical results, please refer to [the doc here](/reference/console-api/bm-projects/custom-streams-projects/streams-results#get-the-stream-monitoring-results);

### Use the service commercially

Please refer to the [pricing here](#pricing-and-discount). Once you decided to use the service commercially please [add a credit card here](https://console.acrcloud.com/account#/billing/paymentmethods) then click "Purchase" ---> "Purchase Reserved Streams" or "Purchase Reserved Timemaps" under the project page to buy the capacity.

Once you decided to decrease the capacity of the steams or capacity, please click "Decrease" ----> "Decease Reserved Streams" under the project page to decrease the capacity.

### Manage via Console API

Basically you can manage everything you see above via the Console API below:

{% content-ref url="/pages/-MDsvdTMPA1bB6cJSgDI" %}
[Buckets](/reference/console-api/buckets)
{% endcontent-ref %}

{% content-ref url="/pages/-MPNvc7Ykp59silpQgy-" %}
[Custom Streams Projects](/reference/console-api/bm-projects/custom-streams-projects)
{% endcontent-ref %}

{% content-ref url="/pages/-MPOl4KmIX9G0kqxBFPU" %}
[UCF Projects](/reference/console-api/ucf-projects)
{% endcontent-ref %}

## Metadata

Check out [**Custom Files Metadata**](/reference/console-api/bm-projects/metadata/custom-files) to get familiar with the JSON structure of the response data for future development.

## Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required).

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!


# Detect Live & Timeshift TV Channels

Detect which live channels or timeshifting content the audiences are watching on the app/device.

**Live TV Channel Detection Service** enables apps/devices to recognize which live channels or timeshifting content is being watched by the audiences.

### Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

### **Create a Live Channel bucket**

Go to Live Channel Detection service and click "Live Channels" under "Buckets" to create a bucket.

*Please note: You can select "Type" of the bucket, simply click "Live Ingest" if you want to add live channels from scratch.*

![](/files/-MQM9lSVK1vhqhYIVXob)

### Add a Live Channel to the bucket

Click the bucket you just created, click "Add" to fill up the details of the live channel.

{% hint style="info" %}
*You need to input the internal stream URL of the live channel on your local server, you will need to deploy the Local Monitoring Tool to ingest the local live feeds.*\
\
*You can also import the live channels you have added to the "Timehsift channels" buckets for detecting timeshifting content.*
{% endhint %}

![](/files/-MQMCsAJgFRdIxhanGNb)

### Deploy Live Channel Fingerprinting Tool

If you created your own bucket, you need to use the [Live Channel Fingerprinting Tool](/tools/live-channel-fingerprinting-tool) to generate fingerprints of live channels on your local server.

### Create a project

Click "Live Channel Detection" under "Projects" to create a project and attach the bucket you just created.

![](/files/-MQMDvpp9bp43gYBtDDc)

### Find the credentials

Save the **“host”, “access\_key”, “access\_secret”** of your project. You can find them in the places shown below.

![](/files/-MQMEbFfjAw-A7F_dV--)

### Integrate with SDK/API

Start sending requests with [Mobile SDK](/sdk-reference/mobile-sdk), [Backend SDK](/sdk-reference/backend-sdk) or [Identification API](/reference/identification-api/identification-api). You can find all of the SDKs and Tools on [this page](https://console.acrcloud.com/#/tools).

### Manage via Console API

You can manage everything via Console API without doing it manually via the dashboard:

{% content-ref url="/pages/-MPNDVNjGFhcXUVfb2AY" %}
[Live Channels](/reference/console-api/buckets/live-channels)
{% endcontent-ref %}

{% content-ref url="/pages/-MDt7u22mAzT5sqHc4q1" %}
[Base Projects](/reference/console-api/base-projects)
{% endcontent-ref %}

### Metadata

Check out [**Live Channel Metadata** ](/reference/identification-api/metadata/live-channels)to get familiar with the JSON structure of the response data for future development.

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page ](https://console.acrcloud.com/lcd#/pricing)(login required). Please feel feel to contact us if you have more channels or requests.

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!


# Recognize Custom Content Offline

Identify your custom content on the mobile apps without internet connections

**Offline Recognition Service** enables apps to recognize audios without the need for internet connections.

### Preparation

This tutorial shows how to manage your own audios. In case you don’t have test audios in hand, we prepared some files, you can download the files below.

{% file src="/files/-MQHoAU5blwchEWRiElK" %}
Download the files
{% endfile %}

### Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

### Create a bucket

Go to your [dashboard](https://console.acrcloud.com/), create a bucket. You will need to choose “Offline” or “Online & Offline” in Network Type for Offline recognition.

![](/files/-MQMkI-DdqTJodLiZQF5)

### Upload files to the bucket

Upload **my\_song\_1.mp3** into the bucket you just created.

![](/files/-MQMkaZFsgcl0pfRyuLQ)

### Create a project

Create an **Offline Recognition** project and bind the bucket you just created.

![](/files/-MQMlA1AFIdV1jbqmWUD)

### Download the offline DB

![](/files/-MQMlN-nXQjLX1Z-TpN9)

### Integrate with the SDKs

Follow one of our programming demos ( **LOCAL mode** ) of the [mobile SDKs](/sdk-reference/mobile-sdk) to recognize a song. You can use **my\_song\_1\_noisy.wav** you just downloaded for the test.

### Manage via Console API

You can manage everything via Console API list below:

{% content-ref url="/pages/-MDsvdTMPA1bB6cJSgDI" %}
[Buckets](/reference/console-api/buckets)
{% endcontent-ref %}

{% content-ref url="/pages/-MQUX-Jc\_awPAM64vYsI" %}
[OfflineDBs](/reference/console-api/offlinedbs)
{% endcontent-ref %}

### Metadata <a href="#metadata" id="metadata"></a>

Check out [**Custom Files Metadata**](/reference/identification-api/metadata/custom-files) to get familiar with the JSON structure of the response data for future development.

### Pricing

Please contact us to let us evaluate the pricing for you.


# Recognize Live Channels and Custom Content

Identify both custom files you uploaded and live channels you ingested.

A combination of Live TV Channel Detection Service and Custom Content Recognition Service can make your second screen apps more attractive and flexible.

**Hybrid Recognition** project can bind both **Audio & Video** and **Live Channel** buckets and make it possible to identify live tv channel and media contents ( advertisement, shows/series, songs and movies ) at the same time.

### Create an account

Sign up an account on [this page](https://console.acrcloud.com/signup) and click the link on the verification email to complete the registration.

### Create buckets

Please refer to the [Recognize Custom Content](/get-started/tutorials/recognize-custom-content) and [Detect Live TV Channels ](/get-started/tutorials/detect-live-and-timeshift-tv-channels)tutorial to create Custom Files and Live Channel buckets and upload files and ingest live channels to the buckets.

{% content-ref url="/pages/-MQHmM7xzlSNdNF4kXhu" %}
[Recognize Custom Content](/get-started/tutorials/recognize-custom-content)
{% endcontent-ref %}

{% content-ref url="/pages/-MQLwsA3blarTi4uS2A0" %}
[Detect Live & Timeshift TV Channels](/get-started/tutorials/detect-live-and-timeshift-tv-channels)
{% endcontent-ref %}

### Create a project

Go to your [dashboard](https://console.acrcloud.com/), build and configure a **Hybrid Recognition** project under **Live Channel Detection** service, attach multiple buckets ( **Audio & Video** bucket and **Live Channels** bucket ).

![](/files/-MQRL6mU3cBYrnMOIXUP)

### Find the credentials

Save the **“host”, “access\_key”, “access\_secret”** of your project for future use.

![](/files/-MQRLL4429jkREbO1ymi)

### Integrate with SDK/API

Start sending requests with [Mobile SDK](/sdk-reference/mobile-sdk), [Backend SDK](/sdk-reference/backend-sdk), [Identification API](/reference/identification-api/identification-api) or [File Scan Tool](/tools/file-scan-tool). You can find all of the SDKs and Tools on [this page](https://console.acrcloud.com/#/tools).

### Manage via Console API

You can manage everything via Console API without doing it manually via the dashboard:

{% content-ref url="/pages/-MPNDVNjGFhcXUVfb2AY" %}
[Live Channels](/reference/console-api/buckets/live-channels)
{% endcontent-ref %}

{% content-ref url="/pages/-MDsvdTMPA1bB6cJSgDI" %}
[Buckets](/reference/console-api/buckets)
{% endcontent-ref %}

{% content-ref url="/pages/-MDt7u22mAzT5sqHc4q1" %}
[Base Projects](/reference/console-api/base-projects)
{% endcontent-ref %}

### Metadata

Check out [**Custom Content Metadata**](/reference/identification-api/metadata/custom-files) and [**Live Channel Metadata**](/reference/identification-api/metadata/live-channels) to get familiar with the JSON structure of the response data for future development.

### Pricing and Discount

You will have 14 days for the free trial after registration. You can find the pricing on [this page](https://console.acrcloud.com/avr#/pricing) (login required). Please feel feel to contact us if you have more channels or requests.

Please feel free to [add a credit card ](https://console.acrcloud.com/account#/billing/paymentmethods)to upgrade to the paid customer to unlock more capacity if you are happy with our service.

Please refer to [Branding Guidelines](https://www.acrcloud.com/branding) to place our brand on your products and contact us for up to 20% off discount!


# Find Potential Detections in Unknown Content Filter

Unknown Content Filter (UCF) is a feature that helps customers to find potential detections in repeated content but not detected in audio recognition.

Go to [Unknown Content Filter](https://console.acrcloud.com/ucf#/dashboard) on the dashboard, create a UCF project, go into the project you just created, and add streams from Broadcast Monitoring projects.

## Create UCF Projects

Go to UCF page and click "UCF Projects" then click "Create Project", enter the Project Name then click "Confirm".

<figure><img src="/files/JC7LrofX4Ul3RnrIFmDT" alt=""><figcaption></figcaption></figure>

## Add Streams to UCF Project

Click the project name and go into the project page, click "Add Streams" then select if you want to select streams from your Custom Stream Monitoring Project (BM Custom Project) or Broadcast Database MonitoringProject (BM Database Project) and select the project then select the streams you want to add in the UCF project then click "Confirm"

<figure><img src="/files/JDlqVPE8qedKrDILEPkJ" alt=""><figcaption></figcaption></figure>

## Browse Results

After 3 days of creating the project, you can go to the UCF project page, select the streams and click “Actions” -> "View Results", you will be heading to the UCF result page. The UCF result page lists all of the repeated content which UCF detected, you can review them by clicking each of the results and adding them to the bucket and report.

<figure><img src="/files/zHiJj5rzKQ6Pv6jPFfrg" alt=""><figcaption></figcaption></figure>

You can also integrate with [UCF API ](/reference/console-api/ucf-projects)to download the recordings and manage everything via API.

## Set AI Ads Finder in UCF

Create a Speech-to-Text Container if you don't have one:\
Go to the File Scanning page and click "Create" then select "Speech Recognition (Speech-to-Text)" as Audio Engine and enter the Name then click "Confirm" in the popup page.

<figure><img src="/files/oS6YYsZjPXZcRok7UkKJ" alt=""><figcaption><p>Create a Speech-to-Text Container</p></figcaption></figure>

Create the UCF project with Speech-to-Text Container:\
Go to UCF page and click "Create Project" then enter the project Name, select "Broadcast Monitoring" in Type and select the Speech-to-Text Container you just created in the FS STT Container then click "Confirm" in the popup page.

<figure><img src="/files/knPMAOsDg4dCFnAVK0ir" alt=""><figcaption><p>Create the UCF project with Speech-to-Text Container</p></figcaption></figure>

Update the existing UCF project with Speech-to-Text Container:\
If you already created the UCF project and want to have the AI Ads Finder, then select the UCF project in the UCF page and click "Actions" -> "Update" then select the Speech-to-Text Container you just created in the FS STT Container then click "Confirm" in the popup page.

<figure><img src="/files/Undo9CuRPYoOEkwVLRlI" alt=""><figcaption><p>Update the existing UCF project with Speech-to-Text Container</p></figcaption></figure>

Review Results:\
After 3 days, you can go to the UCF project to review the potential ads that AI Ads Finder labels. Go to the UCF project you created with FS STT Container, select "Advertisement" in the Label dropbox, then you will find all of the potential ads on the page. You can review and add them to your buckets or reports.

<figure><img src="/files/w5QijYUtIfGvRrD5zvna" alt=""><figcaption><p>Review potential ads</p></figcaption></figure>


# Mobile SDK


# iOS

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_ios>" %}


# Android

## Usage

{% embed url="<https://github.com/acrcloud/ACRCloudUniversalSDK>" %}


# Unity

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_unity3d>" %}


# Backend SDK


# Python

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_python>" %}


# PHP

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_php>" %}


# Go

Go SDK installation and usage

{% hint style="warning" %}
The Go SDK currently only supports Linux and macOS
{% endhint %}

{% hint style="info" %}
The SDK only offers to identify the content of a specified section of the file, identifying all the content of the entire file requires traversing the entire file
{% endhint %}

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_golang>" %}

## Obtain SDK <a href="#huo-qu-sdk" id="huo-qu-sdk"></a>

Visit <https://github.com/acrcloud/acrcloud_sdk_golang> to choose the suitable version according to your needs

### Adding dynamic libraries

#### &#x20;<a href="#id-1-jiang-dong-tai-ku-suo-zai-lu-jing-tian-jia-dao-huan-jing-bian-liang-lin-shi" id="id-1-jiang-dong-tai-ku-suo-zai-lu-jing-tian-jia-dao-huan-jing-bian-liang-lin-shi"></a>

#### 1. Add the path where the dynamic library is located to the environment variable (temporary)

```bash
# Add environment variables 
# Replace acrcloud_dlib_path with libacrcloud_extr_tool.so
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/acrcloud_dlib_path/
$ export LD_LIBRARY_PATH
```

#### 2. Place the dynamic library in the same directory as your generated go binary program (temporary)

The most convenient way

#### 3. Adding dynamic libraries to the system (permanently)

{% hint style="warning" %}
The following commands all require root privileges to run
{% endhint %}

```bash
# donwload the lib
$ sudo curl -fsSL https://raw.githubusercontent.com/acrcloud/acrcloud_sdk_golang/master/linux/x86-64/acrcloud/libacrcloud_extr_tool.so -o /usr/local/lib/libacrcloud_extr_tool.so
# Creating dynamic library configuration files
$ sudo bash -c "echo /usr/local/lib > /etc/ld.so.conf.d/acrcloud.conf"
# Update system configuration
$ sudo ldconfig
```

### Use go get to get the SDK

```bash
$ go get github.com/acrcloud/acrcloud_sdk_golang/acrcloud
```

## Initialization

First go to [ACRCloud Developer Platform](https://console.acrcloud.com/) **Console** > **Audio & Video Recognition** to get **Access Key, Access Secret** and **Host.**

The obtained configuration information is then imported into ACRCloudRecognizer and initialized.

```go
package main

import "github.com/acrcloud/acrcloud_sdk_golang/acrcloud"

func main() {

	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}
	
	var recHandler = acrcloud.NewRecognizer(configs)
	
}

```

## Method

### RecognizeByFile(filePath string, startSeconds int, lenSeconds int, userParams map\[string]string) <a href="#recognizebyfile-filepath-string-startseconds-int-lenseconds-int-userparams-map-string-string" id="recognizebyfile-filepath-string-startseconds-int-lenseconds-int-userparams-map-string-string"></a>

Identify the specified location of multimedia files

| **params**   | description                                                          |
| ------------ | -------------------------------------------------------------------- |
| filePath     | string，Multimedia file path                                          |
| startSeconds | int，Recognition start position (unit: second)                        |
| lenSeconds   | int，Identification length (in seconds, default is 10, maximum is 12) |
| userParams   | map\[string]string，Search parameters (only humming search is useful) |

Sample code:

```go
package main

import (
	"fmt"
	"github.com/acrcloud/acrcloud_sdk_golang/acrcloud"
)

func main() {
	filename := "test.mp4"
	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}

	recHandler := acrcloud.NewRecognizer(configs)

	userParams := map[string]string{}

	result := recHandler.RecognizeByFile(filename, 0, 10, userParams)
	fmt.Println(result)
}
```

### RecognizeByFileBuffer(data \[]byte, startSeconds int, lenSeconds int, userParams map\[string]string) <a href="#recognizebyfilebuffer-data-byte-startseconds-int-lenseconds-int-userparams-map-string-string" id="recognizebyfilebuffer-data-byte-startseconds-int-lenseconds-int-userparams-map-string-string"></a>

Identify the specified location of the read multimedia file

| params       | description                                                          |
| ------------ | -------------------------------------------------------------------- |
| data         | \[]byte，Buffer of the multimedia file to be read                     |
| startSeconds | int，Recognition start position (unit: second)                        |
| lenSeconds   | int，Identification length (in seconds, default is 10, maximum is 12) |
| userParams   | map\[string]string，Search parameters (only humming search is useful) |

Sample code:

```go
package main

import (
	"fmt"
	"github.com/acrcloud/acrcloud_sdk_golang/acrcloud"
	"io/ioutil"
)

func main() {
	filename := "test.mp4"
	buffer, _ := ioutil.ReadFile(filename)

	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}

	recHandler := acrcloud.NewRecognizer(configs)

	userParams := map[string]string{}

	result := recHandler.RecognizeByFileBuffer(buffer, 0, 10, userParams)
	fmt.Println(result)

}

```

### RecognizeByFpBuffer(data \[]byte, startSeconds int, lenSeconds int, userParams map\[string]string) <a href="#recognizebyfpbuffer-data-byte-startseconds-int-lenseconds-int-userparams-map-string-string" id="recognizebyfpbuffer-data-byte-startseconds-int-lenseconds-int-userparams-map-string-string"></a>

Identify the location of the fingerprint file that has been read

{% hint style="info" %}
The usage and detail for generating fingerprint files can be found in the TOOLS > Audio File Fingerprinting Tool
{% endhint %}

| params       | description                                                          |
| ------------ | -------------------------------------------------------------------- |
| data         | \[]byte，Buffer of the fingerprint file                               |
| startSeconds | int，Recognition start position (unit: second)                        |
| lenSeconds   | int，Identification length (in seconds, default is 10, maximum is 12) |
| userParams   | map\[string]string，Search parameters (only humming search is useful) |

Sample Code:

```go
package main

import (
	"fmt"
	"github.com/acrcloud/acrcloud_sdk_golang/acrcloud"
	"io/ioutil"
)

func main() {
	filename := "test.mp4.db.lo"
	buffer, _ := ioutil.ReadFile(filename)

	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}

	recHandler := acrcloud.NewRecognizer(configs)

	userParams := map[string]string{}

	result := recHandler.RecognizeByFpBuffer(buffer, 0, 10, userParams)
	fmt.Println(result)

}
```

### GetDurationMsByFile(filePath string) <a href="#getdurationmsbyfile-filepath-string" id="getdurationmsbyfile-filepath-string"></a>

Get the length of the multimedia file

| params   | description                 |
| -------- | --------------------------- |
| filePath | string，Multimedia file path |

Sample Code:

```go
package main

import (
	"fmt"
	"github.com/acrcloud/acrcloud_sdk_golang/acrcloud"
)

func main() {
	filename := "test.mp4"
	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}

	recHandler := acrcloud.NewRecognizer(configs)
	result, _ := recHandler.GetDurationMsByFile(filename)
	fmt.Println(result)
}

```

### GetDurationMsByFpBuffer(fpBufferData \[]byte) <a href="#getdurationmsbyfpbuffer-fpbufferdata-byte" id="getdurationmsbyfpbuffer-fpbufferdata-byte"></a>

Get the length of the fingerprint file

| params       | description                    |
| ------------ | ------------------------------ |
| fpBufferData | Buffer of the fingerprint file |

Sample Code:

```go
package main

import (
	"fmt"
	"github.com/acrcloud/acrcloud_sdk_golang/acrcloud"
	"io/ioutil"
)

func main() {
	filename := "test.mp4.db.lo"
	buffer, _ := ioutil.ReadFile(filename)

	host := "Host"
	accessKey := "Access Key"
	accessSecret := "Access Secret"

	configs := map[string]string{
		"access_key":     accessKey,
		"access_secret":  accessSecret,
		"host":           host,
		"recognize_type": acrcloud.ACR_OPT_REC_AUDIO,
	}

	recHandler := acrcloud.NewRecognizer(configs)

	result, _ := recHandler.GetDurationMsByFpBuffer(buffer)
	fmt.Println(result)

}

```


# Java

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_java>" %}


# C/C++

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_linux_c>" %}


# C\#

## Usage

{% embed url="<https://github.com/acrcloud/acrcloud_sdk_csharp>" %}


# Error Codes

| Code | Description                                                                                    |
| ---- | ---------------------------------------------------------------------------------------------- |
| 0    | Recognition success                                                                            |
| 1001 | No recognition result                                                                          |
| 2000 | Recording error (device may not have permission)                                               |
| 2004 | Unable to generate fingerprint                                                                 |
| 3000 | Recognition service Error (HTTP error, check your network or wrong host in configuration file） |
| 3001 | Wrong Access Key                                                                               |
| 3002 | Invalid Http Request                                                                           |
| 3003 | Request count limit exceeded, please upgrade your account                                      |
| 3006 | Invalid arguments                                                                              |
| 3010 | Recognition service error                                                                      |
| 3014 | Invalid signature                                                                              |
| 3015 | QpS limit exceeded, please upgrade your account                                                |


# Identification API


# Reference

{% hint style="info" %}
Request this API you should use “multipart/form-data” Content-Type. You can use this API to identify all of the audio formats or fingerprint extracted with our SDK/Tools. We suggest you use data type “fingerprint”, which will reduce the internet bandwidth and accelerate recognition speeds. Also, we suggest you do not use a large file to request this API, this can cause delays, its advised to reduce the file size before upload, files that are less than 15 seconds are generally better.
{% endhint %}

## Identifying an audio file or a fingerprint file

<mark style="color:green;">`POST`</mark> `https://identify-eu-west-1.acrcloud.com/v1/identify`

#### Request Body

| Name               | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                  |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| sample             | object | The audio file or the fingerprint file                                                                                                                                                                                                                                                                                                                                                                       |
| access\_key        | string | The project access\_key                                                                                                                                                                                                                                                                                                                                                                                      |
| sample\_bytes      | number | The file size should be below 5M Bytes.                                                                                                                                                                                                                                                                                                                                                                      |
| timestamp          | string | Timestamp (the time since the Epoch)                                                                                                                                                                                                                                                                                                                                                                         |
| signature          | string | <p>Requests to ACRCloud server must be signed.<br>That is, they must include information that ACRCloud can use to authenticate the requestor.<br>string\_to\_sign = http\_method+"\n"<br>+http\_uri+"\n"<br>+access\_key+"\n"<br>+data\_type+"\n"<br>+signature\_version+"\n"<br>+timestamp<br>signature = base64.b64encode(hmac.new(access\_secret, string\_to\_sign, digestmod=hashlib.sha1).digest())</p> |
| data\_type         | string | audio or fingerprint                                                                                                                                                                                                                                                                                                                                                                                         |
| signature\_version | number | 1                                                                                                                                                                                                                                                                                                                                                                                                            |

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

```python

"""
This is a demo program which implements ACRCloud Identify Protocol V1 with the third party library "requests".
We recomment you implement your own app with "requests" too.
You can install this python library by:
1) sudo easy_install requests 
2) sudo pip install requests
"""

import base64
import hashlib
import hmac
import os
import sys
import time

import requests

'''
Replace "###...###" below with your project's host, access_key and access_secret.
'''
access_key = "###YOUR_ACCESS_KEY###"
access_secret = "###YOUR_ACCESS_SECRET###"
requrl = "https://###HOST###/v1/identify"

http_method = "POST"
http_uri = "/v1/identify"
# default is "fingerprint", it's for recognizing fingerprint,
# if you want to identify audio, please change data_type="audio"
data_type = "audio"
signature_version = "1"
timestamp = time.time()

string_to_sign = http_method + "\n" + http_uri + "\n" + access_key + "\n" + data_type + "\n" + signature_version + "\n" + str(
    timestamp)

sign = base64.b64encode(hmac.new(access_secret.encode('ascii'), string_to_sign.encode('ascii'),
                                 digestmod=hashlib.sha1).digest()).decode('ascii')

# suported file formats: mp3,wav,wma,amr,ogg, ape,acc,spx,m4a,mp4,FLAC, etc
# File size: < 1M , You'de better cut large file to small file, within 15 seconds data size is better
f = open(sys.argv[1], "rb")
sample_bytes = os.path.getsize(sys.argv[1])

files = [
    ('sample', ('test.mp3', open(sys.argv[1], 'rb'), 'audio/mpeg'))
]
data = {'access_key': access_key,
        'sample_bytes': sample_bytes,
        'timestamp': str(timestamp),
        'signature': sign,
        'data_type': data_type,
        "signature_version": signature_version}

r = requests.post(requrl, files=files, data=data)
r.encoding = "utf-8"
print(r.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$http_method = "POST";
$http_uri = "/v1/identify";
$data_type = "audio";
$signature_version = "1" ;
$timestamp = time() ;


// Replace "###...###" below with your project's host, access_key and access_secret.
$requrl = "http://###YOUR_HOST###/v1/identify";
$access_key =  '###YOUR_ACCESS_KEY###';
$access_secret =  '###YOUR_ACCESS_SECRET###';

$string_to_sign = $http_method . "\n" . 
                  $http_uri ."\n" . 
                  $access_key . "\n" . 
                  $data_type . "\n" . 
                  $signature_version . "\n" . 
                  $timestamp;
$signature = hash_hmac("sha1", $string_to_sign, $access_secret, true);

$signature = base64_encode($signature);

// suported file formats: mp3,wav,wma,amr,ogg, ape,acc,spx,m4a,mp4,FLAC, etc 
// File size: < 1M , You'de better cut large file to small file, within 15 seconds data size is better
$file = $argv[1];
$filesize = filesize($file);
$cfile = new CURLFile($file, "mp3", basename($argv[1]));

$postfields = array(
               "sample" => $cfile, 
               "sample_bytes"=>$filesize, 
               "access_key"=>$access_key, 
               "data_type"=>$data_type, 
               "signature"=>$signature, 
               "signature_version"=>$signature_version, 
               "timestamp"=>$timestamp);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $requrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$result = curl_exec($ch);
echo $result;
//$response = curl_exec($ch);
//if ($response == true) {
//    $info = curl_getinfo($ch);
//} else {
//    $errmsg = curl_error($ch);
//    print $errmsg;
//}
curl_close($ch);
?>
```

{% endtab %}

{% tab title="Java" %}

```java
 import java.io.BufferedOutputStream;
 import java.io.BufferedReader;
 import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.net.HttpURLConnection;
 import java.net.URL;
 import java.util.Calendar;
 import java.util.HashMap;
 import java.util.Map;
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
 
 // import commons-codec-<version>.jar, download from http://commons.apache.org/proper/commons-codec/download_codec.cgi
 import org.apache.commons.codec.binary.Base64;
 
 public class IdentifyProtocolV1 {
 
 	private String encodeBase64(byte[] bstr) {
 		Base64 base64 = new Base64();
 		return new String(base64.encode(bstr));
 	}
 
 	private String encryptByHMACSHA1(byte[] data, byte[] key) {
 		try {
 			SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1");
 			Mac mac = Mac.getInstance("HmacSHA1");
 			mac.init(signingKey);
 			byte[] rawHmac = mac.doFinal(data);
 			return encodeBase64(rawHmac);
 		} catch (Exception e) {
 			e.printStackTrace();
 		}
 		return "";
 	}
 
 	private String getUTCTimeSeconds() {  
 	    Calendar cal = Calendar.getInstance();   
 	    int zoneOffset = cal.get(Calendar.ZONE_OFFSET);   
 	    int dstOffset = cal.get(Calendar.DST_OFFSET);    
 	    cal.add(Calendar.MILLISECOND, -(zoneOffset + dstOffset));    
 	    return cal.getTimeInMillis()/1000 + "";
 	}  
 	
 	private String postHttp(String posturl, Map<String, Object> params, int timeOut) {
 		String res = "";
 		String BOUNDARYSTR = "*****2015.03.30.acrcloud.rec.copyright." + System.currentTimeMillis() + "*****";
 		String BOUNDARY = "--" + BOUNDARYSTR + "\r\n";
 		String ENDBOUNDARY = "--" + BOUNDARYSTR + "--\r\n\r\n";
 		
 		String stringKeyHeader = BOUNDARY +
                 "Content-Disposition: form-data; name=\"%s\"" +
                 "\r\n\r\n%s\r\n";
 		String filePartHeader = BOUNDARY +
                  "Content-Disposition: form-data; name=\"%s\"; filename=\"%s\"\r\n" +
                  "Content-Type: application/octet-stream\r\n\r\n";		
  
 		URL url = null;
 		HttpURLConnection conn = null;
 		BufferedOutputStream out = null;
 		BufferedReader reader = null;
 		ByteArrayOutputStream postBufferStream = new ByteArrayOutputStream();
 		try {
 			for (String key : params.keySet()) {
 				Object value = params.get(key);
 				if (value instanceof String || value instanceof Integer) {
 					postBufferStream.write(String.format(stringKeyHeader, key, (String)value).getBytes());
 				} else if (value instanceof byte[]) {
 					postBufferStream.write(String.format(filePartHeader, key, key).getBytes());
 					postBufferStream.write((byte[]) value);
 					postBufferStream.write("\r\n".getBytes());
 				}
 			}
 			postBufferStream.write(ENDBOUNDARY.getBytes());
 			
 			url = new URL(posturl);
 			conn = (HttpURLConnection) url.openConnection();
 			conn.setConnectTimeout(timeOut);
 			conn.setReadTimeout(timeOut);
 			conn.setRequestMethod("POST");
 			conn.setDoOutput(true);
 			conn.setDoInput(true);
 			conn.setRequestProperty("Accept-Charset", "utf-8");
 			conn.setRequestProperty("Content-type", "multipart/form-data;boundary=" + BOUNDARYSTR);
 
 			conn.connect();
 			out = new BufferedOutputStream(conn.getOutputStream());
 			out.write(postBufferStream.toByteArray());
 			out.flush();
 			int response = conn.getResponseCode();
 			if (response == HttpURLConnection.HTTP_OK) {
 				reader = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
 				String tmpRes = "";
 				while ((tmpRes = reader.readLine()) != null) {
 					if (tmpRes.length() > 0)
 						res = res + tmpRes;
 				}
 			}
 		} catch (Exception e) {
 			e.printStackTrace();
 		} finally {
 			try {
 				if (postBufferStream != null) {
 					postBufferStream.close();
 					postBufferStream = null;
 				}
 				if (out != null) {
 					out.close();
 					out = null;
 				}
 				if (reader != null) {
 					reader.close();
 					reader = null;
 				}
 				if (conn != null) {
 					conn.disconnect();
 					conn = null;
 				}
 			} catch (IOException e) {
 				e.printStackTrace();
 			}
 		}
 		return res;
 	}
 
     public String recognize(String host, String accessKey, String secretKey, byte[] queryData, String queryType, int timeout)
     {
     	String method = "POST";
     	String httpURL = "/v1/identify";
     	String dataType = queryType;
     	String sigVersion = "1";
     	String timestamp = getUTCTimeSeconds();
 
     	String reqURL = "http://" + host + httpURL;
 
     	String sigStr = method + "\n" + httpURL + "\n" + accessKey + "\n" + dataType + "\n" + sigVersion + "\n" + timestamp;
     	String signature = encryptByHMACSHA1(sigStr.getBytes(), secretKey.getBytes());
 
         Map<String, Object> postParams = new HashMap<String, Object>();
         postParams.put("access_key", accessKey);
         postParams.put("sample_bytes", queryData.length + "");
         postParams.put("sample", queryData);
         postParams.put("timestamp", timestamp);
         postParams.put("signature", signature);
         postParams.put("data_type", queryType);
         postParams.put("signature_version", sigVersion);
 
         String res = postHttp(reqURL, postParams, timeout);
 
         return res;
     }
     
 	public static void main(String[] args) {
 		File file = new File("E://sample.wav");
 		byte[] buffer = new byte[1024 * 1024];
 		if (!file.exists()) {
 			return;
 		}
 		FileInputStream fin = null;
 		int bufferLen = 0;
 		try {
 			fin = new FileInputStream(file);
 			bufferLen = fin.read(buffer, 0, buffer.length);
 		} catch (Exception e) {
 			e.printStackTrace();
 		} finally {
 			try {
 				if (fin != null) {
 					fin.close();
 				}
 			} catch (IOException e) {
 				e.printStackTrace();
 			}
 		}
 		System.out.println("bufferLen=" + bufferLen);
 		
 		if (bufferLen <= 0)
 			return;
 		
 		byte[] postDatas = new byte[bufferLen];
 		System.arraycopy(buffer, 0, postDatas, 0, bufferLen);
 		IdentifyProtocolV1 a = new IdentifyProtocolV1();
 		
   // Replace "###...###" below with your project's host, access_key and access_secret.
   // recognize(String host, String accessKey, String secretKey, byte[] queryData, String queryType, int timeout)
 		String result = a.recognize("###YOUR_HOST###", "###YOUR_KEY###", "###YOUR_SECRET###", postDatas, "audio", 10000);
 		System.out.println(result);
 	}
 }
```

{% endtab %}

{% tab title="Java" %}

```java
import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;

import java.io.*;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

import org.apache.commons.codec.binary.Base64;
import org.apache.http.util.EntityUtils;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;

public class Recognizer {

    private String host = "identify-cn-north-1.acrcloud.cn";
    private String protocol = "https";
    private String endpoint = "/v1/identify";
    private String accessKey = "xxx";
    private String accessSecret = "xxx";
    private int timeout = 5 * 1000; // ms


    private String encodeBase64(byte[] bstr) {
        Base64 base64 = new Base64();
        return new String(base64.encode(bstr));
    }

    private String encryptByHMACSHA1(byte[] data, byte[] key) {
        try {
            SecretKeySpec signingKey = new SecretKeySpec(key, "HmacSHA1");
            Mac mac = Mac.getInstance("HmacSHA1");
            mac.init(signingKey);
            byte[] rawHmac = mac.doFinal(data);
            return encodeBase64(rawHmac);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "";
    }

    public String recognizeByFile(String filePath, String dataType) {
        File file = new File(filePath);
        String method = "POST";
        String sigVersion = "1";
        String timestamp = System.currentTimeMillis() + "";
        String sigStr = method + "\n" + endpoint + "\n" + accessKey + "\n" + dataType + "\n" + sigVersion + "\n" + timestamp;
        String signature = encryptByHMACSHA1(sigStr.getBytes(), accessSecret.getBytes());

        CloseableHttpClient httpClient = HttpClients.createDefault();
        RequestConfig requestConfig = RequestConfig.custom()
                .setConnectTimeout(timeout).setConnectionRequestTimeout(timeout)
                .setSocketTimeout(timeout).build();
        String reqUrl = protocol + "://" + host + "/" + endpoint;
        HttpPost httpPost = new HttpPost(reqUrl);
        httpPost.setConfig(requestConfig);

        MultipartEntityBuilder builder = MultipartEntityBuilder.create();
        builder.setCharset(Charset.forName("UTF-8"));
        builder.setMode(HttpMultipartMode.BROWSER_COMPATIBLE);

        builder.addTextBody("access_key", accessKey);
        builder.addTextBody("sample_bytes", file.length() + "");
        builder.addTextBody("timestamp", timestamp);
        builder.addTextBody("signature", signature);
        builder.addTextBody("data_type", dataType);
        builder.addTextBody("signature_version", sigVersion);

        builder.addBinaryBody("sample", file, ContentType.DEFAULT_BINARY, "sample");

        HttpEntity entity = builder.build();
        httpPost.setEntity(entity);


        String responseStr = "";
        try {
            CloseableHttpResponse response = httpClient.execute(httpPost);
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                responseStr = EntityUtils.toString(responseEntity, StandardCharsets.UTF_8);
                System.out.println("Result:" + responseStr);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }

        return responseStr;
    }

    public static void main(String[] args) {
        Recognizer rec = new Recognizer();
        String result = rec.recognizeByFile("x.mp3", "audio");
        System.out.println(result);
    }
}
```

{% endtab %}

{% tab title="Javascript" %}

```javascript
var url = require('url');
var fs = require('fs');
var crypto = require('crypto');
//npm install request
const axios = require('axios');

// Replace "###...###" below with your project's host, access_key and access_secret.
var defaultOptions = {
  host: '###YOUR_HOST###',
  endpoint: '/v1/identify',
  signature_version: '1',
  data_type:'audio',
  secure: true,
  access_key: '###YOUR_ACCESS_KEY###',
  access_secret: '###YOUR_ACCESS_SECRET###'
};

function buildStringToSign(method, uri, accessKey, dataType, signatureVersion, timestamp) {
  return [method, uri, accessKey, dataType, signatureVersion, timestamp].join('\n');
}

function sign(signString, accessSecret) {
  return crypto.createHmac('sha1', accessSecret)
    .update(Buffer.from(signString, 'utf-8'))
    .digest().toString('base64');
}

/**
 * Identifies a sample of bytes
 */
function identify(data, options, cb) {

  var current_data = new Date();
  var timestamp = current_data.getTime()/1000;

  var stringToSign = buildStringToSign('POST',
    options.endpoint,
    options.access_key,
    options.data_type,
    options.signature_version,
    timestamp);

  var signature = sign(stringToSign, options.access_secret);

  const blobData = new Blob([data], { type: 'application/octet-stream' });
  var form = new FormData();
  form.append('sample', blobData, {filename: 'sample.bin',
                  contentType: 'application/octet-stream'
                  })
  form.append('sample_bytes', data.length);
  form.append('access_key', options.access_key);
  form.append('data_type', options.data_type);
  form.append('signature_version', options.signature_version);
  form.append('signature', signature);
  form.append('timestamp', timestamp);

  axios.post("http://"+options.host + options.endpoint, form, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  }).then(function (response) {
    console.log('Response:', response.data);
  })
  .catch(function (error) {
    console.error('Error:', error.message);
  });
  
  //fetch("http://"+options.host + options.endpoint, 
  //      {method: 'POST', body: form })
  //      .then((res) => {return res.text()})
  //      .then((res) => {cb(res, null)})
  //      .catch((err) => {cb(null, err)});
}

var data = fs.readFileSync('sample.wav');

identify(data, defaultOptions, function (err, httpResponse, body) {
  if (err) console.log(err);
  console.log(body);
});
```

{% endtab %}

{% tab title="ReactNative" %}

```javascript
import React from 'react';
import {StyleSheet, Button, View, Text} from 'react-native';
import {Audio} from 'expo-av';
import {FileSystem, Permissions} from 'react-native-unimodules';
import hmacSHA1 from 'crypto-js/hmac-sha1';
import Base64 from 'crypto-js/enc-base64';
import {Buffer} from 'buffer';

export default class MusicRec_Test extends React.Component {
  constructor(props) {
    super(props);
    this.state = {response: ''};
  }
  async _findSong() {
    // Audio.setAudioModeAsync()
    const {status} = await Audio.requestPermissionsAsync();
    console.log('Current Status ' + status);
    const recording = new Audio.Recording();
    try {
      await Audio.setAudioModeAsync({
        playsInSilentModeIOS: true,
        allowsRecordingIOS: true,
      });
      const recordOptions = {
        android: {
          extension: '.m4a',
          outputFormat: Audio.RECORDING_OPTION_ANDROID_OUTPUT_FORMAT_MPEG_4,
          audioEncoder: Audio.RECORDING_OPTION_ANDROID_AUDIO_ENCODER_AAC,
          sampleRate: 44100,
          numberOfChannels: 2,
          bitRate: 128000,
        },
        ios: {
          extension: '.wav',
          audioQuality: Audio.RECORDING_OPTION_IOS_AUDIO_QUALITY_HIGH,
          sampleRate: 8000,
          numberOfChannels: 1,
          linearPCMBitDepth: 16,
          linearPCMIsBigEndian: false,
          linearPCMIsFloat: true,
        },
      };
      await recording.prepareToRecordAsync(recordOptions);
      await recording.startAsync();
      console.log('Recording');
      await timeout(8000);
      console.log('Done recording');
      await recording.stopAndUnloadAsync();
      let recordingFile = recording.getURI();

      let result = await identify(recordingFile, defaultOptions);
      console.log(result);
      //return result;
    } catch (error) {
      console.log(error);
      console.log('Error in this!!!!');
    }
  }
  render() {
    return (
      <View style={styles.container}>
        <Button title="Find Song" onPress={this._findSong} />
        <Text />
      </View>
    );
  }
}
function timeout(ms) {
  return new Promise(resolve => setTimeout(resolve, ms));
}
const defaultOptions = {
  host: '<Project Host>',
  endpoint: '/v1/identify',
  signature_version: '1',
  data_type: 'audio',
  secure: true,
  access_key: '<Project AccessKey>',
  access_secret: '<Project SecretKey>',
};
function buildStringToSign(
  method,
  uri,
  accessKey,
  dataType,
  signatureVersion,
  timestamp,
) {
  return [method, uri, accessKey, dataType, signatureVersion, timestamp].join(
    '\n',
  );
}
function signString(stringToSign, accessSecret) {
  return Base64.stringify(hmacSHA1(stringToSign, accessSecret));
}
async function identify(uri, options) {
  var current_data = new Date();
  var timestamp = current_data.getTime() / 1000;
  var stringToSign = buildStringToSign(
    'POST',
    options.endpoint,
    options.access_key,
    options.data_type,
    options.signature_version,
    timestamp,
  );
  let fileinfo = await FileSystem.getInfoAsync(uri, {size: true});
  var signature = signString(stringToSign, options.access_secret);
  var formData = {
    sample: {uri: uri, name: 'sample.wav', type: 'audio/wav'},
    access_key: options.access_key,
    data_type: options.data_type,
    signature_version: options.signature_version,
    signature: signature,
    sample_bytes: fileinfo.size,
    timestamp: timestamp,
  };
  var form = new FormData();
  for (let key in formData) {
    form.append(key, formData[key]);
  }

  let postOptions = {
    method: 'POST',
    headers: {
      'Content-Type': 'multipart/form-data',
    },
    body: form,
  };
  console.log(postOptions.body);
  let response = await fetch(
    'http://' + options.host + options.endpoint,
    postOptions,
  );
  let result = await response.text();
  console.log(result);
  return result;
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
  },
});
```

{% endtab %}

{% tab title="Ruby" %}

```ruby
require 'openssl'
require 'base64'
require 'net/http/post/multipart'

# Replace "###...###" below with your project's host, access_key and access_secret.
requrl = "http://###YOUR_HOST###/v1/identify"
access_key = "###YOUR_ACCESS_KEY###"
access_secret = "###YOUR_ACCESS_SECRET###"

http_method = "POST"
http_uri = "/v1/identify"
data_type = "audio"
signature_version = "1"
timestamp = Time.now.utc().to_i.to_s

string_to_sign = http_method+"\n"+http_uri+"\n"+access_key+"\n"+data_type+"\n"+signature_version+"\n"+timestamp

digest = OpenSSL::Digest.new('sha1')
signature = Base64.encode64(OpenSSL::HMAC.digest(digest, access_secret, string_to_sign))

file_name = ARGV[0]
sample_bytes = File.size(file_name)

url = URI.parse(requrl)
File.open(file_name) do |file|
  req = Net::HTTP::Post::Multipart.new url.path,
    "sample" => UploadIO.new(file, "audio/mp3", file_name),
    "access_key" =>access_key,
    "data_type"=> data_type,
    "signature_version"=> signature_version,
    "signature"=>signature,
    "sample_bytes"=>sample_bytes,
    "timestamp" => timestamp
  res = Net::HTTP.start(url.host, url.port) do |http|
    http.request(req)
  end
  puts(res.body)
end

```

{% endtab %}

{% tab title="C-Sharp" %}

````csharp
```csharp
// See https://aka.ms/new-console-template for more information
//Console.WriteLine("Hello, World!");
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using System.Net.Http;

namespace Rextester
{
    public class Program
    {
        public static async Task Main(string[] args)
        {
            string host = "<YOUR_PROJECT_HOST>";
            string dataType = "audio";
            string protocol = "https";
            string endpoint = "/v1/identify";
            string accessKey = "<YOUR_PROJECT_ACCESSKEY>";
            string accessSecret = "<YOUR_PROJECT_SecretKEY>";
            int timeout = 5 * 1000; // ms

            byte[] wavFile = File.ReadAllBytes("x.mp3");

            // var fileStream = new FileStream(filePath, FileMode.Open);

            string method = "POST";
            string sigVersion = "1";
            string timestamp = DateTime.Now.Ticks.ToString();
            string sigStr = method + "\n" + endpoint + "\n" + accessKey + "\n" + dataType + "\n" + sigVersion + "\n" + timestamp;
            string signature = ComputeSignature(Encoding.ASCII.GetBytes(sigStr), Encoding.ASCII.GetBytes(accessSecret));
            Console.WriteLine(signature);
            var formContent = new MultipartFormDataContent();

            formContent.Add(new StringContent(accessKey), "\"access_key\"");
            formContent.Add(new StringContent(timestamp), "\"timestamp\"");
            formContent.Add(new StringContent(signature), "\"signature\"");
            formContent.Add(new StringContent(dataType), "\"data_type\"");
            formContent.Add(new StringContent(sigVersion), "\"signature_version\"");
            formContent.Add(new StringContent(wavFile.Length.ToString()), "\"sample_bytes\"");

            var filestream = new ByteArrayContent(wavFile, 0, wavFile.Length);
            filestream.Headers.Add("Content-Type", "application/octet-stream");
            formContent.Add(filestream, "\"sample\"");

            HttpClient client = new HttpClient();
            var httpresponse = await client.PostAsync('https://'+host+"/v1/identify", formContent);
            string responseBody = await httpresponse.Content.ReadAsStringAsync();

            Console.WriteLine(responseBody);
        }
        static string ComputeSignature(byte[] body, byte[] secret)
        {
            HMACSHA1 hmac = new HMACSHA1(System.Text.Encoding.UTF8.GetBytes(secret));
            byte[] stringBytes = Encoding.UTF8.GetBytes(body);
            byte[] hashedValue = hmac.ComputeHash(stringBytes);
            string res = Convert.ToBase64String(hashedValue, 0, hashedValue.Length);
            return res;
        }
    }
}

```
````

{% endtab %}
{% endtabs %}

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

```
{
    "metadata":{
        "timestamp_utc":"2020-01-19 02:58:28",
        "music":[
            {
                "db_begin_time_offset_ms":0,
                "db_end_time_offset_ms":9280,
                "sample_begin_time_offset_ms":0,
                "sample_end_time_offset_ms":9280,
                "play_offset_ms":9040,
                "artists":[
                    {
                        "name":"Adele",
                        "langs":[{"code":"zh-Hans", "name":"阿黛尔"}]
                    }
                ],
                "lyrics":{
                    "copyrights":[
                        "Sony/ATV Music Publishing LLC",
                        "Universal Music Publishing Group"
                    ]
                },
                "acrid":"6049f11da7095e8bb8266871d4a70873",
                "album":{
                    "name":"Hello",
                    "langs":[{"code":"zh-Hans","name":"Hello"}]
                },
                "rights_claim": [
                    {"distributor":{"id":"PADPIDA2007050901U", "name":"Warner Music Group"},"rights_owners":[{"name":"Warner Music Group", "share_percentage":100.00}],"rights_claim_policy":"monetize", "territories":["AD","AE","AF"]},
                    {"distributor":{"id":"PADPIDA2007040502I", "name":"Sony Music Entertainment"}, "rights_owners":[{"name":"Sony Music Entertainment", "share_percentage":100.00}],"territories":["AB","AC"]}
               ],                
               "external_ids":{
                    "iswc":"T-917.819.808-8",
                    "isrc":"GBBKS1500214",
                    "upc":"886445581959"
                },
                "result_from":3,
                "contributors":{
                    "composers":[
                        "Adele Adkins",
                        "Greg Kurstin"
                    ],
                    "lyricists":[
                        "ADELE ADKINS",
                        "GREGORY KURSTIN"
                    ]
                },
                "title":"Hello",
                "langs":[{"code":"zh-Hans","name":"Hello"}]
                "language":"en",
                "duration_ms":295000,
                "label":"XL Recording",
                "external_metadata":{
                    "musicbrainz":[
                        {
                            "track":{
                                "id":"0a8e8d55-4b83-4f8a-9732-fbb5ded9f344"
                            }
                        }
                    ],
                    "deezer":{
                        "track":{
                            "id":"110265034"
                        },
                        "artists":[
                            {
                                "id":"75798"
                            }
                        ],
                        "album":{
                            "id":"11483764"
                        }
                    },
                    "spotify":{
                        "track":{
                            "id":"4aebBr4JAihzJQR0CiIZJv"
                        },
                        "artists":[
                            {
                                "id":"4dpARuHxo51G3z768sgnrY"
                            }
                        ],
                        "album":{
                            "id":"7uwTHXmFa1Ebi5flqBosig"
                        }
                    },
                    "musicstory":{
                        "track":{
                            "id":"13106540"
                        },
                        "album":{
                            "id":"931271"
                        }
                    },
                    "youtube":{
                        "vid":"YQHsXMglC9A"
                    }
                },
                "score":100,
                "genres":[{"name":"Pop"}],
                "release_date":"2015-10-23"
                "release_by_territories": [{"territories": ["DK"], "release_date": "2006-04-17"}, {"territories": ["JP"], "release_date": "2006-10-17"}, {"territories": ["SE"], "release_date": "2005-06-21"}, {"territories": ["BG", "AL", "BA", "CZ", "EE", "HR", "HU", "LT", "LV", "MK", "ME", "PL", "RO", "RS", "SI", "SK", "UA"], "release_date": "2006-03-24"}, {"territories": ["GB", "IE", "NZ"], "release_date": "2005-07-18"}, {"territories": ["FR"], "release_date": "2005-07-26"}]
 
            }
        ],
        "custom_files": [
            {
                "acrid":"e6f7e3884b00fd265871754c5b64782b",
                "title":"YOUR_TITLE",
                "bucket_id":999,
                "duration_ms":295000,
                "db_begin_time_offset_ms":0,
                "db_end_time_offset_ms":9280,
                "sample_begin_time_offset_ms":0,
                "sample_end_time_offset_ms":9280,
                "key1":"value1",  //custom-defined 
                "key2":"value2"   //custom-defined 
            }
        ]
    },
    "status":{
        "msg":"Success",
        "version":"1.0",
        "code":0
    },
    "result_type":0
}
```

{% endtab %}
{% endtabs %}

##


# Metadata


# Music

An example of music metadata for Audio & Video Recognition project

### JSON structure

```json
{
    "metadata": {
        "timestamp_utc": "2020-01-19 02:58:28",
        "music": [
            {
                "db_begin_time_offset_ms": 0,
                "db_end_time_offset_ms": 9280,
                "sample_begin_time_offset_ms": 0,
                "sample_end_time_offset_ms": 9280,
                "play_offset_ms": 9040,
                "artists": [
                    {
                        "name": "Adele",
                        "langs": [
                            {
                                "code": "zh-Hans",
                                "name": "阿黛尔"
                            }
                        ]
                    }
                ],
                "acrid": "6049f11da7095e8bb8266871d4a70873",
                "album": {
                    "name": "Hello",
                    "langs": [
                        {
                            "code": "zh-Hans",
                            "name": "Hello"
                        }
                    ]
                },
                "rights_claim": [
                    {
                        "distributor": {
                            "id": "PADPIDA2007050901U",
                            "name": "Warner Music Group"
                        },
                        "rights_owners": [
                            {
                                "name": "Warner Music Group",
                                "share_percentage": 100
                            }
                        ],
                        "rights_claim_policy": "monetize",
                        "territories": [
                            "AD",
                            "AE",
                            "AF"
                        ]
                    },
                    {
                        "distributor": {
                            "id": "PADPIDA2007040502I",
                            "name": "Sony Music Entertainment"
                        },
                        "rights_owners": [
                            {
                                "name": "Sony Music Entertainment",
                                "share_percentage": 100
                            }
                        ],
                        "territories": [
                            "AB",
                            "AC"
                        ]
                    }
                ],
                "external_ids": {
                    "iswc": "T9178198088",
                    "isrc": "GBBKS1500214",
                    "upc": "886445581959"
                },
                "result_from": 3,
                "contributors": {
                    "composers": [
                        "Adele Adkins",
                        "Greg Kurstin"
                    ],
                    "lyricists": [
                        "ADELE ADKINS",
                        "GREGORY KURSTIN"
                    ]
                },
                "title": "Hello",
                "langs": [
                    {
                        "code": "zh-Hans",
                        "name": "Hello"
                    }
                ],
                "language": "en",
                "duration_ms": 295000,
                "label": "XL Recording",
                "external_metadata": {
                    "musicbrainz": {
                        "track": {
                            "id": "0a8e8d55-4b83-4f8a-9732-fbb5ded9f344"
                        }
                    },
                    "deezer": {
                        "track": {
                            "id": "110265034"
                        },
                        "artists": [
                            {
                                "id": "75798"
                            }
                        ],
                        "album": {
                            "id": "11483764"
                        }
                    },
                    "spotify": {
                        "track": {
                            "id": "4aebBr4JAihzJQR0CiIZJv"
                        },
                        "artists": [
                            {
                                "id": "4dpARuHxo51G3z768sgnrY"
                            }
                        ],
                        "album": {
                            "id": "7uwTHXmFa1Ebi5flqBosig"
                        }
                    },
                    "youtube": {
                        "vid": "YQHsXMglC9A"
                    }
                },
                "score": 100,
                "genres": [
                    {
                        "name": "Pop"
                    }
                ],
                "release_date": "2015-10-23",
                "works": [
                    {
                        "iswc": "T9178198088",
                        "name": "HELLO",
                        "creators": [
                            {
                                "name": "KURSTIN GREGORY ALLEN",
                                "last_name": "KURSTIN",
                                "ipi": 122619891,
                                "roles": [
                                    "Composer"
                                ]
                            },
                            {
                                "name": "ADKINS ADELE LAURIE BLUE",
                                "last_name": "ADKINS",
                                "ipi": 544476240,
                                "roles": [
                                    "Composer"
                                ]
                            },
                            {
                                "name": "EMI APRIL MUSIC INC ",
                                "last_name": "EMI APRIL MUSIC INC",
                                "ipi": 128633767,
                                "roles": [
                                    "Publisher"
                                ]
                            },
                            {
                                "name": "KURSTIN MUSIC ",
                                "last_name": "KURSTIN MUSIC",
                                "ipi": 485851707,
                                "roles": [
                                    "Publisher"
                                ]
                            },
                            {
                                "name": "MELTED STONE PUBLISHING LTD ",
                                "last_name": "MELTED STONE PUBLISHING LTD",
                                "ipi": 676466696,
                                "roles": [
                                    "Publisher"
                                ]
                            }
                        ]
                    }
                ]
            }
        ]
    },
    "status": {
        "msg": "Success",
        "version": "1.0",
        "code": 0
    }
}
```

### Metadata fields

| Name                            | Description                                                                                                                                                                                                       |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| music                           | Music fields                                                                                                                                                                                                      |
| acrid                           | ACRCloud unique identifier                                                                                                                                                                                        |
| timestamp\_utc                  | Server time of sending results, Timestamp of the song started for custom monitoring, UTC time zone                                                                                                                |
| title                           | Track title                                                                                                                                                                                                       |
| album                           | Album fields                                                                                                                                                                                                      |
| id                              | Identifier of the artists , album or 3rd parties fields                                                                                                                                                           |
| name                            | Name of the artists or album                                                                                                                                                                                      |
| artists                         | Artists fields                                                                                                                                                                                                    |
| duration\_ms                    | Duration of the track in millisecond                                                                                                                                                                              |
| play\_offset\_ms                | The time position of the audio/song being played (millisecond)                                                                                                                                                    |
| external\_ids                   | External standard code                                                                                                                                                                                            |
| isrc                            | ISRC code                                                                                                                                                                                                         |
| upc                             | UPC code                                                                                                                                                                                                          |
| external\_metadata              | External 3rd party IDs and metadata                                                                                                                                                                               |
| track                           | Track fields                                                                                                                                                                                                      |
| genres                          | Genres fields                                                                                                                                                                                                     |
| label                           | Music label name                                                                                                                                                                                                  |
| release\_date                   | Release data of the track, format:YYYY-MM-DD                                                                                                                                                                      |
| spotify                         | Spotify fields                                                                                                                                                                                                    |
| deezer                          | Deezer fields                                                                                                                                                                                                     |
| lyricfind                       | LyricFind fields                                                                                                                                                                                                  |
| lfid                            | LyricsFind's lyric ID                                                                                                                                                                                             |
| youtube                         | YouTube fields                                                                                                                                                                                                    |
| vid                             | Youtube video ID                                                                                                                                                                                                  |
| musicbrainz                     | MusicBrainz Identifier - MBID                                                                                                                                                                                     |
| db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)                                                                                                                                           |
| db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                                                                                                                                                 |
| sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond)                                                                                                                             |
| sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)                                                                                                                                   |
| played\_duration                | Actual duration of the track played in the streams for Broadcast Monitoring service, in second                                                                                                                    |
| score                           | Match confidence score. Range: 70 - 100                                                                                                                                                                           |
| +contributors                   | Contributor information for this track                                                                                                                                                                            |
| +composers                      | Composers of the song                                                                                                                                                                                             |
| +lyricists                      | Writers of the lyrics                                                                                                                                                                                             |
| language                        | Language of the song, ISO 639-1 codes                                                                                                                                                                             |
| langs                           | Translation into different languages. Example: \[{"code":"ru", "name":"Я твой враг"}]                                                                                                                             |
| #rights\_claim                  | All relevant metadata fields to determine rights owners, available territories and rights claim policy for UGC platforms. These metadata fields are for copyright compliance users only.                          |
| #distributor                    | Information of distributor for this track                                                                                                                                                                         |
| #id                             | DDEX Party ID of the distributor, this ID won't change.                                                                                                                                                           |
| #name                           | Name of the distributor, This name might be changing from time to time.                                                                                                                                           |
| #rights\_claim\_policy          | Right policy for UGC platforms, the value options are "Monetize", "Allow", "ReportUsage" and "BlockAccess".                                                                                                       |
| #rights\_owners                 | Rights owners' name, example: \[{"name":"Warner Music Group", "share\_percentage":100}]                                                                                                                           |
| #territories                    | Territory codes for Included territories, ISO country codes applied.                                                                                                                                              |
| #excluded\_territories          | Territory codes for excluded territories, ISO country codes applied.                                                                                                                                              |
| #share\_percentage              | Percentage of the rights share for each rights owners.                                                                                                                                                            |
| #release\_by\_territories       | Release details by territories, indicate the release date for territories.                                                                                                                                        |
| +work                           | Publishing metadata fields for works                                                                                                                                                                              |
| +ISWC                           | ISWC code                                                                                                                                                                                                         |
| +name                           | Name of the work                                                                                                                                                                                                  |
| +creators                       | The creators of the work                                                                                                                                                                                          |
| +ipi                            | IPI code for the creator                                                                                                                                                                                          |
| +roles                          | The roles of the creator                                                                                                                                                                                          |
| time\_skew                      | Time skew refers to a temporal misalignment or timing offset between two audio signals. It means that the audio events (such as beats, notes, or spectral features) occur earlier or later in time than expected. |
| frequency\_skew                 | Frequency skew refers to a distortion in the frequency domain, where the spectral components of the audio are shifted upward or downward in frequency.                                                            |

{% hint style="info" %}
**Please note: Only&#x20;*****ACRID,*** ***Track Title, Artists Name, Album Name*****&#x20;and \*\_time\_offset\_ms fields are required, other fields are optional.**

\#fields are visible for the projects with copyright compliance option only.

+fields are visible upon request, please contact us if you need those fields.
{% endhint %}


# Custom Files

An example of custom-defined metadata for Audio & Video Recognition, Broadcast Monitoring, Hybrid Recognition and Offline Recognition projects.

### JSON structure

```json
{
    "metadata": {
        "timestamp_utc": "2020-01-19 02:58:28",
        "custom_files": [
            {
                "bucket_id": "51",
                "title": "You are beautiful",
                "artist": "James",
                "acrid": "5343bc191634b042622bf474ed46121a",
                "audio_id": "3"
            }
        ]
    },
    "status": {
        "msg": "Success",
        "version": "1.0",
        "code": 0
    }
}
```

### Metadata fields

| Name                              | Description                                                                           |
| --------------------------------- | ------------------------------------------------------------------------------------- |
| custom\_files                     | Custom uploaded file fields                                                           |
| arcid                             | ACRCloud unique identifier                                                            |
| title                             | File name                                                                             |
| audio\_id                         | User defined identifier                                                               |
| play\_offset\_ms                  | Position of the recognition in the file if the file was playing (millisecond)         |
| \*db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)               |
| \*db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                     |
| \*sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond) |
| \*sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)       |

{% hint style="info" %}
***\* fields are visible in Broadcast Monitoring service only, if you want to use these fields in recognition service, please contact us.***

**Please note: Only&#x20;*****Title, ARCID, Audio\_ID*****&#x20;are required fields.**
{% endhint %}


# Live Channels

An example of live channels detection metadata for Live Channel Detection and Hybrid Recognition projects

### JSON structure

```json
{
    "metadata": {
        "custom_streams": [
            {
                "title": "xxxxxxxxxx",
                "acrid": "xxxxxxxxxx",
                "timestamps_ms": "1491987674",
                "result_type": "live",
                "score": 100
            }
        ]
    },
    "status": {
        "msg": "Success",
        "version": "1.0",
        "code": 0
    }
}
```

| Name            | Description                                        |
| --------------- | -------------------------------------------------- |
| streams         | ACRCloud Live channel fields                       |
| custom\_streams | Custom live channel fields                         |
| arcid           | ACRCloud unique identifier                         |
| score           | Match score, 60-100                                |
| title           | Live channel name                                  |
| timestamps\_ms  | Unix Timestamp (UTC) in milliseconds of live feeds |
| result\_type    | "live" or "timeshift"                              |


# Humming

An example of humming metadata for Audio & Video Recognition project

### JSON structure

```bash
{
    "metadata": {
        "humming": [
            {
                "external_ids": {

                },
                "title": "As Long As You Love Me",
                "artists": [
                    {
                        "name": "Backstreet Boys"
                    }
                ],
                "acrid": "2167d4c8d51d2944881be2fc128372f6",
                "external_metadata": {
                    "deezer": {
                        "album": {
                            "id": "76662",
                            "name": "Beautiful"
                        },
                        "artists": [
                            {
                                "name": "Backstreet Boys",
                                "id": "330"
                            }
                        ],
                        "track": {
                            "name": "As Long As You Love Me",
                            "id": "602351"
                        }
                    },
                    "spotify": {
                        "album": {
                            "id": "1c7PDfu5CEUWE5M79pSHeD",
                            "name": "Race For Life The Official Soundtrack 2011"
                        },
                        "artists": [
                            {
                                "name": "Backstreet Boys",
                                "id": "5rSXSAkZ67PYJSvpUpkOr7"
                            }
                        ],
                        "track": {
                            "name": "As Long as You Love Me",
                            "id": "11Oj3hu53ZVOqzcw35elvh"
                        }
                    },
                    "youtube": {
                        "vid": "0Gl2QnHNpkA"
                    }
                },
                "album": {
                    "name": "Beautiful"
                },
                "score": "0.88"
            },
            {
                "external_ids": {

                },
                "external_metadata": {

                },
                "score": "0.87",
                "title": "As Long As You Love Me",
                "duration_ms": "213093",
                "genres": [
                    {
                        "name": "Pop"
                    }
                ],
                "acrid": "d4c6ff541580d20c7f35ef4a390eac41",
                "album": {
                    "name": "Beautiful"
                },
                "artists": [
                    {
                        "name": "Backstreet Boys"
                    }
                ]
            },
            {
                "external_ids": {

                },
                "title": "If You Love Me",
                "artists": [
                    {
                        "name": "Kys"
                    }
                ],
                "external_metadata": {

                },
                "acrid": "103fc2e9df3712151bb9601189fe3751",
                "album": {
                    "name": ""
                },
                "score": "0.67"
            },
            {
                "external_ids": {

                },
                "external_metadata": {

                },
                "score": "0.64",
                "title": "Hurt (Album Version)",
                "duration_ms": "243626",
                "genres": [
                    {
                        "name": "Pop"
                    }
                ],
                "acrid": "2c7939c273ac5b83922b0d7be45d0743",
                "album": {
                    "name": "Hurt"
                },
                "artists": [
                    {
                        "name": "Christina Aguilera"
                    }
                ]
            },
            {
                "external_ids": {

                },
                "title": "打开爱",
                "artists": [
                    {
                        "name": "Vee"
                    }
                ],
                "external_metadata": {

                },
                "acrid": "7c23c2f6b9d7c8eb5cc0b877e1782691",
                "album": {
                    "name": ""
                },
                "score": "0.62"
            }
        ]
    },
    "status": {
        "msg": "Success",
        "version": "1.0",
        "code": 0
    }
}
```

### Metadata fields

| Name               | Description                                   |
| ------------------ | --------------------------------------------- |
| humming            | Humming Recognition fields                    |
| acrid              | ACRCloud unique identifier                    |
| timestamp\_utc     | Server time of sending results, UTC time zone |
| score              | Humming score                                 |
| title              | Track title                                   |
| album              | Album fields                                  |
| id                 | Identifier of the artists or album            |
| name               | Name of the artists or album                  |
| artists            | Artists fields                                |
| duration\_ms       | Duration of the track in millisecond          |
| play\_offset\_ms   | Position of the recognition in millisecond    |
| external\_ids      | External standard code                        |
| isrc               | ISRC code                                     |
| upc                | UPC code                                      |
| external\_metadata | External 3rd party IDs and metadata           |
| track              | Track fields                                  |
| genres             | Genres fields                                 |

{% hint style="info" %}
Only ACRID, Title, Artist and Score are required fields.
{% endhint %}


# Music/Speech Detection

An example of music/speech detection metadata for FS project.

```json
 {
    "music_speech":[
        {
             "start": 0,
              "end": 247,
              "label": "m"
        }
    ]
}
```


# Console API


# Access Token

## How to get the access token

Create the token in the [console developer setting](https://console.acrcloud.com/account#/developer)

![](/files/-MUrJgbga7rrqCY-xK3A)


# Buckets

## Create a bucket

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

Create an empty bucket, then you can upload audio files or add channels to this bucket to create your fingerprint database.

#### Headers

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

#### Request Body

| Name               | Type   | Description                                                      |
| ------------------ | ------ | ---------------------------------------------------------------- |
| name               | string | The bucket name                                                  |
| region             | string | eu-west-1,us-west-2,ap-southeast-1                               |
| type               | string | File,Live,LiveRec,LiveTimeshift                                  |
| net\_type          | number | 0,1,2                                                            |
| labels             | array  | The labels for the bucket. For examples: \["Music", "Comercial"] |
| metadata\_template | string | Metadata template                                                |

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

```
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{
	"name":"avbucket",
	"type":"File",
	"labels":["Music", "Video"],
	"net_type":1,
	"region":"ap-southeast-1"
}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/buckets"

data={"name":"avbucket",
      "type":"File",
      "labels":["Music", "Video"],
      "net_type":1,
      "region":"ap-southeast-1"
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token'
}

response = requests.post(url, headers=headers, json=data)

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-v2.acrcloud.com/api/buckets',
  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('name' => 'testbucket','region' => 'ap-southeast-1','type' => 'File'),
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer token'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({"name":"avbucket","type":"File","labels":["Music","Video"],"net_type":1,"region":"ap-southeast-1"});

var config = {
  method: 'post',
  url: 'https://api-v2.acrcloud.com/api/buckets',
  headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer token', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}
{% endtabs %}

## List Buckets

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

Return a list of your buckets.

#### Query Parameters

| Name      | Type   | Description                                |
| --------- | ------ | ------------------------------------------ |
| page      | number | The page number                            |
| per\_page | number | The results number per page. Default is 20 |
| region    | string | eu-west-1,us-west-2,ap-southeast-1         |
| type      | string | File,Live,LiveRec,LiveTimeshift            |

#### Headers

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

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

```
{
    "data": [
        {
            "id": 14791,
            "uid": 19,
            "name": "test",
            "type": "Live",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": null,
            "labels": [
                "TV"
            ],
            "net_type": 1,
            "created_at": "2020-07-16 11:09:20",
            "updated_at": "2020-07-16 11:09:20",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 14556,
            "uid": 19,
            "name": "adsfasdf",
            "type": "LiveTimeshift",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                ""
            ],
            "net_type": 1,
            "created_at": "2020-06-24 11:07:00",
            "updated_at": "2020-06-24 11:07:00",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 12310,
            "uid": 19,
            "name": "eu_shared_bucket2",
            "type": "LiveRec",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Radio"
            ],
            "net_type": 1,
            "created_at": "2019-10-30 07:54:56",
            "updated_at": "2019-10-30 07:54:56",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 12309,
            "uid": 19,
            "name": "eu_shared_bucket",
            "type": "LiveRec",
            "node": "",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Radio"
            ],
            "net_type": 1,
            "created_at": "2019-10-30 07:53:58",
            "updated_at": "2019-10-30 07:53:58",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        },
        {
            "id": 1159,
            "uid": 19,
            "name": "us_bucket",
            "type": "File",
            "state": 1,
            "region": "global",
            "metadata_template": "",
            "labels": [
                "Music"
            ],
            "net_type": 0,
            "created_at": "2016-05-11 06:49:55",
            "updated_at": "2017-07-17 11:48:06",
            "num": 7,
            "size": "1487",
            "access_permission": "private"
        },
        {
            "id": 1116,
            "uid": 19,
            "name": "offline-bucket",
            "type": "File",
            "node": "10.12.12.236-850",
            "state": 1,
            "region": "eu-west-1",
            "metadata_template": "",
            "labels": [
                "Music"
            ],
            "net_type": 2,
            "created_at": "2016-05-01 07:10:16",
            "updated_at": "2018-01-05 16:41:15",
            "num": 0,
            "size": 0,
            "access_permission": "private"
        }
    ],
    "links": {
        "first": "https://api-v2.acrcloud.com/api/buckets?page=1",
        "last": "https://api-v2.acrcloud.com/api/buckets?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api-v2.acrcloud.com/api/buckets",
        "per_page": 20,
        "to": 6,
        "total": 6
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
equest GET 'https://api-v2.acrcloud.com/api/buckets?region=eu-west-1' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/buckets?region=eu-west-1"

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

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

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-v2.acrcloud.com/api/buckets?region=eu-west-1',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer token'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
var data = qs.stringify({
  
});
var config = {
  method: 'get',
  url: 'https://api-v2.acrcloud.com/api/buckets?region=eu-west-1',
  headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer token'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});
```

{% endtab %}
{% endtabs %}

## Get a bucket

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

Get the details of a bucket.

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | number | The bucket id |

#### Headers

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

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

```
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --request GET 'https://api-v2.acrcloud.com/api/buckets/8881' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer your_access_token'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/buckets/966"

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

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

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-v2.acrcloud.com/api/buckets/966',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer your_access_token'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api-v2.acrcloud.com/api/buckets/966',
  headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer your_access_token'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
var axios = require('axios');

var config = {
  method: 'get',
  url: 'https://api-v2.acrcloud.com/api/buckets/966',
  headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer your_access_token'
  }
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}
{% endtabs %}

## Update a bucket

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/buckets/:id`

Update the details of the bucket.

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | number | The bucket id |

#### Headers

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

#### Request Body

| Name               | Type   | Description                   |
| ------------------ | ------ | ----------------------------- |
| metadata\_template | string | Update the metadata\_template |
| labels             | string | Update the labels             |
| name               | string | Update the bucket name        |

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

```
{
    "data": {
        "id": 8881,
        "uid": 1,
        "name": "bucket_music",
        "type": "File",
        "node": "127.0.0.1-871",
        "state": 1,
        "region": "ap-southeast-1",
        "metadata_template": "{\"artist\":{\"default\":\"abc\"}, \"album\":{\n\"type\":\"select\", \"default\":\"334\", \"options\":[\"123\", \"334\"]}}",
        "labels": [
            "Music",
            "Video"
        ],
        "net_type": 1,
        "created_at": "2019-03-01 15:31:25",
        "updated_at": "2019-08-16 07:17:32",
        "num": 10,
        "size": "300000",
        "access_permission": "private"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'https://api-v2.acrcloud.com/api/buckets/8881' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"bucket-music"}'
```

{% endtab %}
{% endtabs %}

## Delete the bucket

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

Before you delete the bucket, you need to clean the bucket first.

#### Path Parameters

| Name | Type   | Description   |
| ---- | ------ | ------------- |
| id   | number | The bucket id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}


# Audio Files

## Upload an audio file/fingerprint

<mark style="color:green;">`POST`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files`

Upload the audio files or fingerprint to the specified bucket

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name          | Type   | Description                                                                       |
| ------------- | ------ | --------------------------------------------------------------------------------- |
| file          | object | The audio or fingerprint file. Required if the data\_type is audio or fingerprint |
| title         | string | The title of this file                                                            |
| data\_type    | string | the file type, the value should be audio, fingerprint, audio\_url or acrid        |
| user\_defined | string | The user-defined metadata. JSON format.                                           |
| url           | string | audio file download URL. required if the data\_*type is audio\_*&#x75;rl          |
| acrid         | String | acrid from ACRCloud Music Database                                                |

{% tabs %}
{% tab title="200 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
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8891/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--form 'file=@"/Users/olym/Downloads/test.mp3"' \
--form 'title="adsfad"' \
--form 'data_type="audio"'

curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8891/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"data_type":"audio_url", "title":"file-title", "user_defined":{"artists":"artist"}, "url":"https://your_host.com/AEA040700015_T1.mp3"}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests
import json

url = "https://api-v2.acrcloud.com/api/buckets/8891/files"

payload={'title': 'adsfad','data_type': 'audio',"user_defined":json.dumps({"key1":"value1", "key2":"value2"})}
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)
```

{% endtab %}

{% tab title="PHP" %}

```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;
```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
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);
});
```

{% endtab %}

{% tab title="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
```

{% endtab %}
{% endtabs %}

## List the files

<mark style="color:blue;">`GET`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files`

#### Path Parameters

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

#### Query Parameters

| Name      | Type   | Description                                                                   |
| --------- | ------ | ----------------------------------------------------------------------------- |
| search    | string | search by title                                                               |
| sort      | string | sort by id or status, default is sort by id                                   |
| order     | string | asc or desc, default is asc                                                   |
| page      | number | The page number                                                               |
| per\_page | number | The results number per page                                                   |
| state     | number | <p>0:processing<br>1:Ready (audio files have been processed)<br>-1: Error</p> |

#### Headers

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

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

```
{
    "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
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --request GET 'https://api-v2.acrcloud.com/api/buckets/8891/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}

{% tab title="Python" %}

```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)

```

{% endtab %}
{% endtabs %}

## Update a file

<mark style="color:orange;">`PUT`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files/:id`

Update the metadata of a file

#### Path Parameters

| Name       | Type   | Description         |
| ---------- | ------ | ------------------- |
| bucket\_id | number | The bucket id       |
| id         | number | The file id/acr\_id |

#### Headers

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

#### Request Body

| Name          | Type   | Description                         |
| ------------- | ------ | ----------------------------------- |
| title         | string | The file title.                     |
| user\_defined | string | User-defined metadata, JSON format. |

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

```
{
    "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"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
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"}}'
```

{% endtab %}
{% endtabs %}

## Delete files

<mark style="color:red;">`DELETE`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files/:ids`

#### Path Parameters

| Name       | Type   | Description                           |
| ---------- | ------ | ------------------------------------- |
| bucket\_id | number | The bucket id                         |
| ids        | number | The file ids/acrids, seperated by "," |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/buckets/8891/files/12,13' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Move the files to another bucket

<mark style="color:orange;">`PUT`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files/:ids/move`

Move the files to another bucket

#### Path Parameters

| Name       | Type   | Description                                    |
| ---------- | ------ | ---------------------------------------------- |
| bucket\_id | number | The bucket id that you want move the files to. |
| ids        | string | One or multiple ids/acrids, separated by ","   |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'https://api-v2.acrcloud.com/api/buckets/8892/files/12,13' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Get one or multiple files

<mark style="color:blue;">`GET`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/files/:ids`

#### Path Parameters

| Name       | Type   | Description                               |
| ---------- | ------ | ----------------------------------------- |
| ids        | string | The files ids or acrids. Seperated by "," |
| bucket\_id | string | The bucket id                             |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token |

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

```
{
    "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"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

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

```
curl --location --request GET 'https://api-v2.acrcloud.com/api/buckets/966/files/13045360,13044049' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Dump all the files information in this bucket (only dump bucket data once a day)

<mark style="color:blue;">`GET`</mark> `https://api-{bucket-region}.acrcloud.com/api/buckets/:bucket_id/dump`

This is an asynchronous request. After the request is completed, you must wait and check the status through the interface. Once it becomes 1, you can download it using the down\_url address.

#### Path Parameters

| Name                                         | Type   | Description    |
| -------------------------------------------- | ------ | -------------- |
| bucket\_id<mark style="color:red;">\*</mark> | Number | Your bucket ID |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

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

```json
{
    "status": 1,  //when status changes to 1, the dump is ready.  (default is 0)
    "down_url": "https://us-api-v2.acrcloud.com/api/buckets/6556/down/sFKD2eLbGX",
    //Download the file information from this URL when the status is 1
    "id": 6556,  //bucket ID
    "name": "us-bucket",  //bucket name
    "task_id": "sFKD2eLbGX"  //this dump task ID
}
```

{% endtab %}
{% endtabs %}


# Live Channels

## Create a live channel

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

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| title         | string | The channel title                                                     |
| url           | string | The channel URL for ingesting the fingerprint from local server       |
| user\_defined | string | User-defined metadata. JSON format                                    |
| timeshift     | string | If enable the timeshifted fingerprint ingesting. 0 or 1. default is 0 |

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

```
{
    "data": {
        "uid": 1,
        "bucket_id": 8894,
        "acr_id": "b46ba66d2548b23611c6efabed035182",
        "state": 0,
        "title": "test",
        "url": "udp://192.168.1.10",
        "user_defined": {
            "city": "New York"
        },
        "timeshift": 0,
        "updated_at": "2020-12-25T05:05:17.000000Z",
        "created_at": "2020-12-25T05:05:17.000000Z",
        "id": 8,
        "bucket_type": "Live"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8894/channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"title":"test", "url":"udp://192.168.1.10", "user_defined":{"city":"New York"}}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/buckets/8894/channels"

payload={
  "title":"test", 
  "url":"udp://192.168.1.10", 
  "user_defined":{"city":"New York"}
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}
{% endtabs %}

## List the channels

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

#### Path Parameters

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

#### Query Parameters

| Name      | Type   | Description                         |
| --------- | ------ | ----------------------------------- |
| search    | string | The title name.                     |
| page      | string | Page number                         |
| per\_page | string | The results number per page.        |
|           | string | asc or desc. Default is desc        |
| sort      | string | sort by id or status. default is id |

#### Headers

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

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

```
{
    "data": [
        {
            "id": 8,
            "uid": 1,
            "bucket_id": 8894,
            "acr_id": "b46ba66d2548b23611c6efabed035182",
            "channel_id": "",
            "state": 1,
            "title": "test",
            "url": "udp://192.168.1.10",
            "user_defined": {
                "city": "New York"
            },
            "timeshift": 0,
            "created_at": "2020-12-25T05:05:17.000000Z",
            "updated_at": "2020-12-25T05:05:17.000000Z",
            "bucket_type": "Live"
        },
        {
            "id": 7,
            "uid": 1,
            "bucket_id": 8894,
            "acr_id": "3482b6e845a0fed8c129108d54ed9e20",
            "channel_id": "",
            "state": 1,
            "title": "123",
            "url": "123",
            "user_defined": {},
            "timeshift": 1,
            "created_at": "2020-09-16T03:36:59.000000Z",
            "updated_at": "2020-09-16T03:36:59.000000Z",
            "bucket_type": "Live"
        },
        {
            "id": 4,
            "uid": 1,
            "bucket_id": 8894,
            "acr_id": "f59e5c0e31a73db957b6c68fcda38c44",
            "channel_id": "",
            "state": 1,
            "title": "channel-4",
            "url": "http://127.0.0.1:123",
            "user_defined": {},
            "timeshift": 1,
            "created_at": "2019-06-25T07:46:24.000000Z",
            "updated_at": "2020-09-16T03:49:43.000000Z",
            "bucket_type": "Live"
        },
        {
            "id": 3,
            "uid": 1,
            "bucket_id": 8894,
            "acr_id": "6cc839537aa40b2854f4e520b7d0d58b",
            "channel_id": "",
            "state": 1,
            "title": "channel-3",
            "url": "http://127.0.0.1:123",
            "user_defined": {},
            "timeshift": 0,
            "created_at": "2019-06-25T07:46:21.000000Z",
            "updated_at": "2019-11-22T11:51:57.000000Z",
            "bucket_type": "Live"
        }
    ],
    "links": {
        "first": "https://api-v2.acrcloud.com/api/buckets/8894/channels?page=1",
        "last": "https://api-v2.acrcloud.com/api/buckets/8894/channels?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api-v2.acrcloud.com/api/buckets/8894/channels",
        "per_page": 20,
        "to": 4,
        "total": 4
    }
}
```

{% endtab %}
{% endtabs %}

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

```
curl --location --request GET 'https://api-v2.acrcloud.com/api/buckets/8894/channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Update a channel

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/channels/:id`

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name          | Type   | Description                                                     |
| ------------- | ------ | --------------------------------------------------------------- |
| title         | string | The channel title                                               |
| url           | string | The channel URL for ingesting fingerprints on your local server |
| user\_defined | string | User-define                                                     |
| timeshift     | string | If enable the timeshifted fingerprint ingestring. 0 or 1.       |

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

```
{
    "data": {
        "uid": 1,
        "bucket_id": 8894,
        "acr_id": "b46ba66d2548b23611c6efabed035182",
        "state": 0,
        "title": "test",
        "url": "udp://192.168.1.10",
        "user_defined": {
            "city": "New York"
        },
        "timeshift": 0,
        "updated_at": "2020-12-25T05:05:17.000000Z",
        "created_at": "2020-12-25T05:05:17.000000Z",
        "id": 8,
        "bucket_type": "Live"
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'https://api-v2.acrcloud.com/api/buckets/8884/channels/8' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"title":"test"}'
```

{% endtab %}
{% endtabs %}

## Delete ingesting channels

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

#### Path Parameters

| Name       | Type   | Description                           |
| ---------- | ------ | ------------------------------------- |
| bucket\_id | string | The bucket id                         |
| ids        | string | One or multiple ids, separated by ',' |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/buckets/8894/channels/8' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Import channels

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

Import channels to LiveRec bucket.

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name | Type   | Description                                    |
| ---- | ------ | ---------------------------------------------- |
| ids  | string | One or multiple channels ids. Separated by ',' |

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

```
{
    "data": [
        {
            "id": 5,
            "acr_id": "a25b69e996f6f220ddb7a0c4a53a11c1",
            "title": "channel-5",
            "state": 0,
            "bucket_id": 8885,
            "original_bucket_id": 8882,
            "created_at": "2020-12-25 07:39:29",
            "updated_at": "2020-12-25 07:39:29",
            "bucket_type": "LiveRec",
            "user_defined": {}
        },
        {
            "id": 6,
            "acr_id": "08e491a33c5c1bb7418ce49254fc35ed",
            "title": "adf",
            "state": 0,
            "bucket_id": 8885,
            "original_bucket_id": 8882,
            "created_at": "2020-12-25 07:39:29",
            "updated_at": "2020-12-25 07:39:29",
            "bucket_type": "LiveRec",
            "user_defined": {
                "channel_name": "abc",
                "channel_type": "def"
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8885/rec-channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"ids":[5,6]}'
```

{% endtab %}
{% endtabs %}

## Delete rec channels

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/rec-channels/:ids`

#### Path Parameters

| Name       | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| bucket\_id | number | The bucket id                                 |
| ids        | string | One or multiple channel ids. Separated by ',' |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/buckets/8895/rec-channels/5,6' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Create timeshift channels

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

#### Path Parameters

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

#### Headers

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

#### Request Body

| Name | Type   | Description                                                                   |
| ---- | ------ | ----------------------------------------------------------------------------- |
| time | number | The timeshift fingerprints keep-alive time (In hours). The default is 1 hour. |
| id   | number | The live channel id                                                           |

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

```
{
    "data": {
        "id": 5,
        "title": "channel-5",
        "state": 0,
        "bucket_id": 8893,
        "acr_id": "a25b69e996f6f220ddb7a0c4a53a11c1",
        "time": 24,
        "original_bucket_id": 8882,
        "created_at": "2020-12-25 07:57:52",
        "updated_at": "2020-12-25 07:57:52",
        "bucket_type": "LiveTimeshift",
        "user_defined": {}
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/buckets/8893/timeshift-channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"id":5, "time":24}'
```

{% endtab %}
{% endtabs %}

## Delete timeshift channels

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/timeshift-channels/:ids`

#### Path Parameters

| Name       | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| ids        | string | One or multiple channel ids, Separated by ',' |
| bucket\_id | number | The bucket id                                 |

#### Headers

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

## Get Live/Timeshift Channels status

<mark style="color:red;">`GET`</mark> `https://api-v2.acrcloud.com/api/buckets/:bucket_id/channels-stat`

#### Path Parameters

| Name       | Type   | Description                  |
| ---------- | ------ | ---------------------------- |
| bucket\_id | number | The Live/Timeshift bucket id |

#### Query Parameters

| Name | Type     | Description                       |
| ---- | -------- | --------------------------------- |
| date | datetime | <p>For example:<br>2024-05-17</p> |

#### Headers

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

#### Response

|         |        |                                                                                                                                                                                                                                                                                                                                                                                          |
| ------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| id      | number | The channel id                                                                                                                                                                                                                                                                                                                                                                           |
| title   | string | The channel name                                                                                                                                                                                                                                                                                                                                                                         |
| acr\_id | string | acr id                                                                                                                                                                                                                                                                                                                                                                                   |
| hour    | string | Hour (24-hour clock) as a zero-padded decimal number. utf+0                                                                                                                                                                                                                                                                                                                             |
| seconds | number | <p>The fingerprint duration that the server side received.</p><p>This value has a certain margin of error (mainly due to the possibility of silence at the beginning or end of fingerprint fragments). We consider that if the total duration of fingerprints received in a complete hour is 3500 < seconds <= 3600, it indicates that the data received during this hour is normal.</p> |

```json
[ {
            "id": 1800,
            "title": "channel1",
            "acr_id": "556ddb768bba7d38fa22fcb3eaf7b6ea",
            "stats": {
                "2024-05-17": [
                    {
                        "hour": "00", 
                        "seconds": 3578
                    },
                    {
                        "hour": "01",
                        "seconds": 3582
                    },
                    {
                        "hour": "02",
                        "seconds": 3578
                    },
                    {
                        "hour": "03",
                        "seconds": 288
                    }
                ]
            }
  },
……
]
```

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

```bash
curl --location 'https://ap-api-v2.acrcloud.com/api/buckets/12334/channels-stat?date=2024-05-17' \
--header 'Authorization: Bearer YOUR_TOKEN’ \
--header 'Accept: application/json'
```

{% endtab %}

{% tab title="Python" %}

````python
```python
import requests

url = "https://api-v2.acrcloud.com/api/buckets/12334/channels-stat?date=2024-05-17"

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

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

print(response.text)
```
````

{% endtab %}
{% endtabs %}


# 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 %}


# Base Projects

## Create a project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/base-projects`

Create a recognition project

#### Headers

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

#### Request Body

| Name          | Type   | Description                                                                                                                                                                                                 |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name          | string | The project name                                                                                                                                                                                            |
| region        | string | eu-west-1,us-west-2,ap-southeast-1                                                                                                                                                                          |
| type          | string | <p>There are three types. AVR,LCD,HR.<br>AVR is detecting music or custom content<br>LCD is detecting live channels and time-shifting channels<br>HR is detecting both live channel and custom contents</p> |
| buckets       | array  | The project detects content from the buckets. The format is bucket id array.                                                                                                                                |
| audio\_type   | string | <p>linein or recorded. Default is linein<br>recorded: Audio captured via microphone or noisy audio files<br>linein: Audio of original file or stream without noise</p>                                      |
| external\_ids | string | spotify,deezer,isrc,upc,musicbrainz                                                                                                                                                                         |

{% tabs %}
{% tab title="200 The project successfully created." %}

```
{
    "data": {
        "uid": 1,
        "access_key": "e7a84ca942a13773f6d22e9fd6808fce",
        "access_secret": "9zlEAx57jaCgeLpDKKQmorv0brrhAYqj076n6FyP",
        "service_type": "AVR",
        "state": 1,
        "name": "test",
        "region": "eu-west-1",
        "day_limit": 0,
        "total_limit": 0,
        "audio_type": "linein",
        "version": 1,
        "external_id": "",
        "updated_at": "2020-12-25T09:47:25.000000Z",
        "created_at": "2020-12-25T09:47:25.000000Z",
        "id": 15,
        "buckets": [
            {
                "id": 8881,
                "name": "bucket-music",
                "type": "File",
                "metadata_template": null
            },
            {
                "id": 8883,
                "name": "api-test",
                "type": "File",
                "metadata_template": null
            }
        ],
        "status_check": 2,
        "external_ids": ["spotify", "isrc", "deezer"]
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/base-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"test", "region":"eu-west-1", "buckets":[8881,8883],"type":"AVR", "audio_type":"linein", "external_ids":["spotify", "isrc", "deezer"]}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/base-projects"

payload={
  "name":"test", 
  "region":"eu-west-1", 
  "buckets":[8881,8883],
  "type":"AVR", 
  "audio_type":"linein", 
  "external_ids":["spotify", "isr\", "deezer"]
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-v2.acrcloud.com/api/base-projects',
  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 =>'{"name":"test", "region":"eu-west-1", "buckets":[8881,8883],"type":"AVR", "audio_type":"linein", "external_ids":["spotify", "isrc", "deezer"]}',
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer token',
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}

{% tab title="Nodejs" %}

```javascript
var axios = require('axios');
var data = JSON.stringify({"name":"test","region":"eu-west-1","buckets":[8881,8883],"type":"AVR","audio_type":"linein","external_ids":["spotify","isrc","deezer"]});

var config = {
  method: 'post',
  url: 'https://api-v2.acrcloud.com/api/base-projects',
  headers: { 
    'Accept': 'application/json', 
    'Authorization': 'Bearer token', 
    'Content-Type': 'application/json'
  },
  data : data
};

axios(config)
.then(function (response) {
  console.log(JSON.stringify(response.data));
})
.catch(function (error) {
  console.log(error);
});

```

{% endtab %}
{% endtabs %}

## List projects

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/base-projects`

#### Query Parameters

| Name      | Type   | Description                        |
| --------- | ------ | ---------------------------------- |
| region    | string | eu-west-1,us-west-2,ap-southeast-1 |
| type      | string | AVR,LCD,HR                         |
| page      | string | Page number                        |
| per\_page | string | The results number per page        |

#### Headers

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

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

```
{
    "data": [
        {
            "id": 15,
            "uid": 1,
            "access_key": "e7a84ca942a13773f6d22e9fd6808fce",
            "access_secret": "9zlEAx57jaCgeLpDKKQmorv0brrhAYqj076n6FyP",
            "name": "test",
            "service_type": "AVR",
            "state": 1,
            "region": "eu-west-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "linein",
            "version": 1,
            "external_id": "",
            "created_at": "2020-12-25T09:47:25.000000Z",
            "updated_at": "2020-12-25T09:47:25.000000Z",
            "buckets": [
                {
                    "id": 8881,
                    "name": "bucket-music",
                    "type": "File",
                    "metadata_template": null
                },
                {
                    "id": 8883,
                    "name": "api-test",
                    "type": "File",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": []
        },
        {
            "id": 14,
            "uid": 1,
            "access_key": "9246b72f271403f4abefd723b10d2810",
            "access_secret": "TZZbedkkArX2cLDdz6PBc1rkBkUrq3izQccmjDGc",
            "name": "vue-project-2",
            "service_type": "AVR",
            "state": 1,
            "region": "ap-southeast-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "recorded",
            "version": 1,
            "created_at": "2020-08-07T19:21:48.000000Z",
            "updated_at": "2020-08-07T19:22:01.000000Z",
            "buckets": [
                {
                    "id": 8880,
                    "name": "ACRCloud Music",
                    "type": "ACRCloudFile",
                    "metadata_template": null
                },
                {
                    "id": 8881,
                    "name": "bucket-music",
                    "type": "File",
                    "metadata_template": null
                },
                {
                    "id": 8883,
                    "name": "api-test",
                    "type": "File",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": [
                "Youtube",
                "Deezer"
            ]
        },
        {
            "id": 13,
            "uid": 1,
            "access_key": "a13717e4bef752c067d0cee5dfc13dfb",
            "access_secret": "W0IhtWoQjLceyRNufQUhQabudUu0009APOaciRAy",
            "name": "vue-project",
            "service_type": "AVR",
            "state": 1,
            "region": "ap-southeast-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "recorded",
            "version": 1,
            "created_at": "2020-08-07T19:21:48.000000Z",
            "updated_at": "2020-08-07T19:22:01.000000Z",
            "buckets": [
                {
                    "id": 8881,
                    "name": "bucket-music",
                    "type": "File",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": [
                "Deezer",
                "Spotify"
            ]
        },
        {
            "id": 5,
            "uid": 1,
            "access_key": "965eb1aded32934b78a599fffb9befdd",
            "access_secret": "BqSmWxTV5dwJgxGVG0Pfxq1wUXHlAXBm4Poy8jpf",
            "name": "param_test",
            "service_type": "AVR",
            "state": 1,
            "region": "ap-southeast-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "recorded",
            "version": 1,
            "created_at": "2020-08-07T19:21:48.000000Z",
            "updated_at": "2020-08-07T19:22:01.000000Z",
            "buckets": [
                {
                    "id": 8880,
                    "name": "ACRCloud Music",
                    "type": "ACRCloudFile",
                    "metadata_template": null
                },
                {
                    "id": 8881,
                    "name": "bucket-music",
                    "type": "File",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": [
                "deezer",
                "itunes",
                "spotify",
                "youtube",
                "isrc",
                "upc",
                "musicstory",
                "lyricfind"
            ]
        },
        {
            "id": 3,
            "uid": 1,
            "access_key": "01d97da894699fb8e0ea9832e679fdc8",
            "access_secret": "0t7zQ23F2yhaXEBqUMZ6qvRzhiGt8BKMvk6FPkfG",
            "name": "hr",
            "service_type": "HR",
            "state": 1,
            "region": "ap-southeast-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "recorded",
            "version": 1,
            "external_id": "",
            "created_at": "2020-08-07T19:21:48.000000Z",
            "updated_at": "2020-08-07T19:22:01.000000Z",
            "buckets": [
                {
                    "id": 8881,
                    "name": "bucket-music",
                    "type": "File",
                    "metadata_template": null
                },
                {
                    "id": 8882,
                    "name": "tv",
                    "type": "Live",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": []
        },
        {
            "id": 2,
            "uid": 1,
            "access_key": "896cf772dc1b5f2e9287f524fcc78971",
            "access_secret": "5TETNWSHDnGbXv6OhVrgkbbVzQtuhMuFSDpXu4TW",
            "name": "tv_project",
            "service_type": "LCD",
            "state": 1,
            "region": "ap-southeast-1",
            "day_limit": 0,
            "qps_limit": 0,
            "audio_type": "recorded",
            "version": 1,
            "external_id": "",
            "created_at": "2020-08-07T19:21:48.000000Z",
            "updated_at": "2020-08-07T19:22:01.000000Z",
            "buckets": [
                {
                    "id": 8882,
                    "name": "tv",
                    "type": "Live",
                    "metadata_template": null
                }
            ],
            "status_check": 2,
            "external_ids": []
        }
    ],
    "links": {
        "first": "https://api-v2.acrcloud.com/api/base-projects?page=1",
        "last": "https://api-v2.acrcloud.com/api/base-projects?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api-v2.acrcloud.com/api/base-projects",
        "per_page": "20",
        "to": 6,
        "total": 6
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/base-projects?type=AVR' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Get a project

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/base-projects/:id`

Get the details of a project

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

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

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

```
{
    "data": {
        "uid": 1,
        "access_key": "e7a84ca942a13773f6d22e9fd6808fce",
        "access_secret": "9zlEAx57jaCgeLpDKKQmorv0brrhAYqj076n6FyP",
        "service_type": "AVR",
        "state": 1,
        "name": "test",
        "region": "eu-west-1",
        "day_limit": 0,
        "total_limit": 0,
        "audio_type": "linein",
        "version": 1,
        "external_id": "",
        "updated_at": "2020-12-25T09:47:25.000000Z",
        "created_at": "2020-12-25T09:47:25.000000Z",
        "id": 15,
        "buckets": [
            {
                "id": 8881,
                "name": "bucket-music",
                "type": "File",
                "metadata_template": null
            },
            {
                "id": 8883,
                "name": "api-test",
                "type": "File",
                "metadata_template": null
            }
        ],
        "status_check": 2,
        "external_ids": ["spotify", "isrc", "deezer"]
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'http://127.0.0.1:8080/api/base-projects/15' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Update a project

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/base-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

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

#### Request Body

| Name          | Type   | Description                                                              |
| ------------- | ------ | ------------------------------------------------------------------------ |
| name          | string | Project name                                                             |
| buckets       | array  | The project detects content from buckets. The format is bucket id array. |
| audio\_type   | string | linein or recorded                                                       |
| external\_ids | string | spotify,deezer,youtube,isrc,upc,musicbrainz                              |

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

```
{
    "data": {
        "uid": 1,
        "access_key": "e7a84ca942a13773f6d22e9fd6808fce",
        "access_secret": "9zlEAx57jaCgeLpDKKQmorv0brrhAYqj076n6FyP",
        "service_type": "AVR",
        "state": 1,
        "name": "test",
        "region": "eu-west-1",
        "day_limit": 0,
        "total_limit": 0,
        "audio_type": "linein",
        "version": 1,
        "external_id": "",
        "updated_at": "2020-12-25T09:47:25.000000Z",
        "created_at": "2020-12-25T09:47:25.000000Z",
        "id": 15,
        "buckets": [
            {
                "id": 8881,
                "name": "bucket-music",
                "type": "File",
                "metadata_template": null
            },
            {
                "id": 8883,
                "name": "api-test",
                "type": "File",
                "metadata_template": null
            }
        ],
        "status_check": 2,
        "external_ids": ["spotify", "isrc", "deezer"]
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'http://127.0.0.1:8080/api/base-projects/15' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"test", "region":"eu-west-1", "buckets":[8881,8883],"type":"AVR", "audio_type":"linein", "external_ids":["spotify", "isrc", "deezer"]}'
```

{% endtab %}
{% endtabs %}

## Delete a project

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/base-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Get the status of the project's buckets

<mark style="color:blue;">`GET`</mark> `https://us-api-v2.acrcloud.com/api/base-projects/:id/buckets-status`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | The project id |

#### Headers

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

Response

| Nmae    | Type   | Description                         |
| ------- | ------ | ----------------------------------- |
| buckets | string | The buckets your porject are using. |
| nodes   | string | The server nodes for the buckets    |
| status  | string | <p>1: healthy<br>0: unhealthy</p>   |

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

````
```json
{
    "ACRCloudFile": [
        {
            "buckets": [
                {
                    "name": "ACRCloud Music",
                    "id": 23
                }
            ],
            "nodes": {
                "node": "46671216359c47fc0c1b236194f7cca0",
                "status": 1
            }
        }
    ]
}
```
````

{% endtab %}
{% endtabs %}

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

```
curl --location --request GET 'https://us-api-v2.acrcloud.com/api/base-projects/:your_project_id/buckets-status' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer your_token'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://us-api-v2.acrcloud.com/api/base-projects/:project_id/buckets-status"

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

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

print(response.text)
```

{% endtab %}
{% endtabs %}

## Get the statistics of the project

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/base-projects/:id/day-stat`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Query Parameters

| Name  | Type   | Description               |
| ----- | ------ | ------------------------- |
| start | string | The start date YYYY-MM-DD |
| end   | string | The end date              |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```
curl --request GET 'https://api-v2.acrcloud.com/api/base-projects/:id/day-stat?start=2021-04-09&end=2021-04-23'
--header 'Accept: application/json' \
--header 'Authorization: Bearer your_token'
```

{% endtab %}
{% endtabs %}


# OfflineDBs

## Create an offline db

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

#### Headers

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

#### Request Body

| Name        | Type   | Description                                                                                                                                                                                         |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name        | string | The offline db name                                                                                                                                                                                 |
| region      | string | us-west-2,eu-west-1,ap-southeast-1                                                                                                                                                                  |
| buckets     | array  | The bucket id array                                                                                                                                                                                 |
| audio\_type | string | <p>linein or recorded. It's the type of audios you want to recognize.<br>linein: Audio of the original files without noise.<br>recorded: Audio captured via microphone or noisy audio files<br></p> |

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

```
```

{% endtab %}
{% endtabs %}

## Rebuild the offline db

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/offlinedbs/:id`

#### Path Parameters

| Name | Type   | Description       |
| ---- | ------ | ----------------- |
| id   | number | The offline db id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Delete the offline db

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/offlinedbs/:id`

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | The offlinedb id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Download the offlinedb

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/offlinedbs/:id`

#### Path Parameters

| Name | Type   | Description      |
| ---- | ------ | ---------------- |
| id   | string | The offlinedb id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}


# BM Projects


# Custom Streams Projects

## Create Custom Streams Project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects`

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name               | Type   | Description                                                                                                                                                                                      |
| ------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| external\_ids      | string | spotify,deezer,isrc,upc,musicbrainz                                                                                                                                                              |
| metadata\_template | string | The streams metadata template                                                                                                                                                                    |
| region             | string | eu-west-1,us-west-2,ap-southeast-1                                                                                                                                                               |
| name               | string | Project name                                                                                                                                                                                     |
| buckets            | string | Bucket ids array                                                                                                                                                                                 |
| type               | string | <p>BM-ACRC or BM-LOCAL<br>BM-ACRC: Ingesting the streams audio data on our server.<br>BM-LOCAL: ingesting the streams audio data on your local server. Please refer to Local monitoring Tool</p> |

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

```
{
    "data":{
        "uid":1,
        "access_key":"************",
        "type":"BM-ACRC",
        "state":1,
        "name":"bm-test",
        "region":"ap-southeast-1",
        "bucket_group":"8881",
        "external_id":"",
        "updated_at":"2021-01-04 10:42:24",
        "created_at":"2021-01-04 10:42:24",
        "id":13528,
        "buckets":[
            {
                "id":8881,
                "uid":1,
                "name":"bucket-music",
                "type":"File",
                "node":"127.0.0.1-871",
                "state":1,
                "region":"ap-southeast-1",
                "metadata_template":"{"artist":{"default":"abc"}, "album":{
"type":"select", "default":"334", "options":["123", "334"]}}",
                "labels":[
                    "Music",
                    "Video"
                ],
                "net_type":1,
                "created_at":"2019-03-01 15:31:25",
                "updated_at":"2020-12-24 08:26:35",
                "num":1,
                "size":"300000",
                "access_permission":"private"
            }
        ],
        "status_check":2,
        "external_ids":[
            "spotify","deezer","isrc"
        ],
        "metadata_template":"StreamId,City,FM",
        "monitoring_num":0
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-cs-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"test", "region":"eu-west-1", "buckets":[8881,8883],"type":"BM-ACRC", "external_ids":["spotify", "isrc", "deezer"]}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/bm-cs-projects"

payload = {
  "name": "test",
  "region": "eu-west-1",
  "buckets": [
    8881,
    8883
  ],
  "type": "BM-ACRC",
  "external_ids": [
    "spotify",
    "isrc",
    "deezer"
  ]
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {your token}',
  'Content-Type': 'application/json'
}

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

print(response.text)
```

{% endtab %}
{% endtabs %}

## List the projects

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects`

#### Query Parameters

| Name      | Type   | Description |
| --------- | ------ | ----------- |
| page      | string |             |
| region    | string |             |
| types     | string |             |
| per\_page | string |             |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Accept        | string | application/json |
| Authorization | string | Bearer token     |

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

```
{
    "data":[
        {
            "id":12345,
            "name":"test",
            "uid":1,
            "type":"BM-ACRC",
            "region":"ap-southeast-1",
            "state":1,
            "access_key":"************",
            "bucket_group":"8891,8880",
            "external_id":"",
            "noise":1,
            "created_at":"2020-07-20 15:56:21",
            "updated_at":"2020-07-21 03:43:01",
            "buckets":[
                {
                    "id":8891,
                    "uid":1,
                    "name":"vue-bucket",
                    "type":"File",
                    "node":"127.0.0.1-871",
                    "state":1,
                    "region":"ap-southeast-1",
                    "metadata_template":"album",
                    "labels":[
                        "Music",
                        "Video"
                    ],
                    "net_type":1,
                    "created_at":"2019-07-30 09:02:43",
                    "updated_at":"2019-08-16 07:17:32",
                    "num":2,
                    "size":"600",
                    "access_permission":"private",
                    "access_users":[
                        "olym.yin@gmail.com"
                    ]
                },
                {
                    "id":8880,
                    "uid":0,
                    "name":"ACRCloud Music",
                    "type":"ACRCloudFile",
                    "node":"127.0.0.1-890",
                    "state":1,
                    "region":"ap-southeast-1",
                    "metadata_template":"",
                    "labels":[
                        "Music"
                    ],
                    "net_type":1,
                    "created_at":"2019-03-01 15:31:25",
                    "updated_at":"-0001-11-30 00:00:00",
                    "num":10000,
                    "size":10000,
                    "access_permission":"private"
                }
            ],
            "status_check":2,
            "external_ids":[

            ],
            "metadata_template":"city,country",
            "monitoring_num":0
        }
    ],
    "links":{
        "first":"https://api-v2.acrcloud.com/api/bm-cs-projects?page=1",
        "last":"https://api-v2.acrcloud.com/api/bm-cs-projects?page=1",
        "prev":null,
        "next":null
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":1,
        "path":"https://api-v2.acrcloud.com/api/bm-cs-projects",
        "per_page":"20",
        "to":1,
        "total":1
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Update a project

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Accept        | string | application/json |
| Authorization | string | Bearer token     |

#### Request Body

| Name               | Type   | Description |
| ------------------ | ------ | ----------- |
| name               | string |             |
| buckets            | string |             |
| external\_ids      | string |             |
| metadata\_template | string |             |

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

```
{
    "data":{
        "uid":1,
        "access_key":"**************",
        "type":"BM-ACRC",
        "state":1,
        "name":"bm-test",
        "region":"ap-southeast-1",
        "bucket_group":"8881",
        "external_id":"",
        "updated_at":"2021-01-04 10:42:24",
        "created_at":"2021-01-04 10:42:24",
        "id":13528,
        "buckets":[
            {
                "id":8881,
                "uid":1,
                "name":"bucket-music",
                "type":"File",
                "node":"127.0.0.1-871",
                "state":1,
                "region":"ap-southeast-1",
                "metadata_template":"{"artist":{"default":"abc"}, "album":{
"type":"select", "default":"334", "options":["123", "334"]}}",
                "labels":[
                    "Music",
                    "Video"
                ],
                "net_type":1,
                "created_at":"2019-03-01 15:31:25",
                "updated_at":"2020-12-24 08:26:35",
                "num":1,
                "size":"300000",
                "access_permission":"private"
            }
        ],
        "status_check":2,
        "external_ids":[
            "spotify","deezer","isrc"
        ],
        "metadata_template":"StreamId,City,FM",
        "monitoring_num":0
    }
}
```

{% endtab %}
{% endtabs %}

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

```python

import requests
import json

url = "http://127.0.0.1:8080/api/bm-cs-projects/13528"

payload = json.dumps({
  "name": "test",
  "buckets": [
    8881,
    8883
  ],
  "external_ids": [
    "spotify",
    "isrc",
    "deezer"
  ]
})
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

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

print(response.text)
```

{% endtab %}
{% endtabs %}

## Delete a project

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Set result callback url

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:id/result-callback`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name                  | Type   | Description |
| --------------------- | ------ | ----------- |
| result\_callback\_url | string |             |

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

```
{
    "data":{
        "id":13528,
        "name":"bm-test",
        "uid":1,
        "type":"BM-ACRC",
        "region":"ap-southeast-1",
        "state":1,
        "access_key":"***********",
        "bucket_group":"8881",
        "external_id":"",
        "noise":1,
        "created_at":"2021-01-04 10:42:24",
        "updated_at":"2021-01-04 10:42:24",
        "buckets":[
            {
                "id":8881,
                "uid":1,
                "name":"bucket-music",
                "type":"File",
                "node":"127.0.0.1-871",
                "state":1,
                "region":"ap-southeast-1",
                "metadata_template":"{"artist":{"default":"abc"}, "album":{
"type":"select", "default":"334", "options":["123", "334"]}}",
                "labels":[
                    "Music",
                    "Video"
                ],
                "net_type":1,
                "created_at":"2019-03-01 15:31:25",
                "updated_at":"2020-12-24 08:26:35",
                "num":1,
                "size":"300000",
                "access_permission":"private"
            }
        ],
        "status_check":2,
        "external_ids":[

        ],
        "metadata_template":"StreamId,City,FM",
        "result_callback_url":"https://callback.acrcloud.com",
        "result_callback_send_type":"JSON",
        "result_callback_send_noresult":"NO",
        "result_callback_retry":0,
        "monitoring_num":0
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-cs-projects/12345/result-callback' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"result_callback_url":"{your callback URL}"}'
```

{% endtab %}
{% endtabs %}

> The following is the example of the results of the monitoring system posting to your results callback URL

{% tabs %}
{% tab title="Sample result of Music(Callback)" %}

```
{
	"stream_url": "xxxx",
	"stream_id": "s-Ixxxxd",
	"status": 1,
	"data": {
		"status": {
			"msg": "Success",
			"version": "1.0",
			"code": 0
		},
		"result_type": 0,
		"metadata": {
			"music": [{
				"album": {
					"name": "Creedence Clearwater Revival - Best Of"
				},
				"play_offset_ms": 75500,
				"sample_begin_time_offset_ms": 6440,
				"title": "Proud Mary",
				"result_from": 3,
				"release_date": "2008-01-01",
				"sample_end_time_offset_ms": 9420,
				"genres": [{
					"name": "Country"
				}, {
					"name": "Pop"
				}, {
					"name": "Rock"
				}, {
					"name": "Rock & Roll/Rockabilly"
				}],
				"label": "Universal Music",
				"duration_ms": 186506,
				"score": 100.0,
				"db_begin_time_offset_ms": 72200,
				"artists": [{
					"name": "Creedence Clearwater Revival"
				}],
				"db_end_time_offset_ms": 75180,
				"external_ids": {
					"isrc": "USFI86900049",
					"upc": "888072308701"
				},
				"acrid": "463aeeb5840215833abe6bf7b02304f6",
				"external_metadata": {
					"spotify": {
						"track": {
							"name": "Proud Mary",
							"id": "5Op2Ra4kgzlTpEmD9NUanY"
						},
						"album": {
							"name": "Creedence Clearwater Revival - Best Of"
						},
						"artists": [{
							"name": "Creedence Clearwater Revival"
						}]
					},
					"lyricfind": {
						"lfid": "001-1188346"
					},
					"youtube": {
						"vid": "5hid10EgMXE"
					},
					"musicstory": {
						"track": {
							"id": "9258633"
						},
						"album": {
							"id": "677371"
						},
						"release": {
							"id": "1640721"
						}
					},
					"musicbrainz": {
						"track": {
							"id": "1632ee2b-4f4b-42eb-909f-8279e66dc1ce"
						}
					},
					"deezer": {
						"track": {
							"name": "Proud Mary",
							"id": "883642"
						},
						"album": {
							"name": "Creedence Clearwater Revival - Best Of"
						},
						"artists": [{
							"name": "Creedence Clearwater Revival"
						}]
					}
				}
			}],
			"timestamp_utc": "2022-02-22 12:19:28",
			"played_duration": 173,
			"type": "delay"
		}
	}
}
```

{% endtab %}
{% endtabs %}

## Set state notification callback

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:id/state-notification`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name                                  | Type   | Description                                                                                                  |
| ------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------ |
| state\_notification\_email            | string | state\_notification\_email: if the streams' states change, we will send a notification to the email you set. |
| state\_notification\_email\_frequency | string | <p>state\_notification\_email\_frequency:<br>0:High<br>1:Low<br>2:None</p>                                   |
| state\_notification\_url              | string | state\_notification\_url: if the streams' states change, we will post a request to this url you set.         |

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

```
{
    "data":{
        "id":13528,
        "name":"bm-test",
        "uid":1,
        "type":"BM-ACRC",
        "region":"ap-southeast-1",
        "state":1,
        "access_key":"***************",
        "bucket_group":"8881",
        "external_id":"",
        "noise":1,
        "created_at":"2021-01-04 10:42:24",
        "updated_at":"2021-01-04 10:42:24",
        "buckets":[
            {
                "id":8881,
                "uid":1,
                "name":"bucket-music",
                "type":"File",
                "node":"127.0.0.1-871",
                "state":1,
                "region":"ap-southeast-1",
                "metadata_template":"{"artist":{"default":"abc"}, "album":{
"type":"select", "default":"334", "options":["123", "334"]}}",
                "labels":[
                    "Music",
                    "Video"
                ],
                "net_type":1,
                "created_at":"2019-03-01 15:31:25",
                "updated_at":"2020-12-24 08:26:35",
                "num":1,
                "size":"300000",
                "access_permission":"private"
            }
        ],
        "status_check":2,
        "external_ids":[

        ],
        "metadata_template":"StreamId,City,FM",
        "result_callback_url":"https://callback.acrcloud.com",
        "result_callback_send_type":"JSON",
        "result_callback_send_noresult":"NO",
        "result_callback_retry":0,
        "state_notification_url":"http://test.notification.com",
        "state_notification_email":"olym@acrcloud.com",
        "state_notification_email_frequency":"LOW",
        "monitoring_num":2
    }
}
```

{% endtab %}
{% endtabs %}


# Streams

## Add a stream

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams`

#### Path Parameters

| Name                                  | Type   | Description |
| ------------------------------------- | ------ | ----------- |
| pid<mark style="color:red;">\*</mark> | string | Project Id. |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name                                           | Type    | Description                                                                                          |
| ---------------------------------------------- | ------- | ---------------------------------------------------------------------------------------------------- |
| stream\_urls<mark style="color:red;">\*</mark> | array   |                                                                                                      |
| name<mark style="color:red;">\*</mark>         | string  |                                                                                                      |
| config\_id<mark style="color:red;">\*</mark>   | integer | Please see the config list [here](https://console.acrcloud.com/bm/?region=eu-west-1#/custom-configs) |
| user\_defined                                  | string  | User-defined stream metadata                                                                         |

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

```
{
    "data":
        {
            "stream_id":"s-AO****",
            "uid":19,
            "mcp_id":12417,
            "stream_type":"Audio",
            "name":"asdfasdf",
            "state":"Running",
            "code":0,
            "stream_urls":[
                "http://*******"
            ],
            "current_url":"http://*******",
            "region":"eu-west-1",
            "user_defined":null,
            "pitch_shift":0,
            "check_pitch_shift":0,
            "remark":"",
            "created_at":"2020-06-07 07:42:16",
            "updated_at":"2021-01-04 10:06:37",
            "record_video":0,
            "stream_rec_type":0,
            "epg":"",
            "config":{
                "id":1,
                "name":"non-realtime for music",
                "uid":0,
                "rec_length":10,
                "interval":0,
                "rec_timeout":5,
                "monitor_timeout":25,
                "noise":1,
                "delay":1,
                "record":{
                    "record":0,
                    "record_after":8,
                    "record_before":5
                },
                "created_at":"2018-05-31T03:20:53.000000Z"
            },
            "timemap":0,
            "ucf":0
        }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-cs-projects/{your_project_id}/streams' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"stream_urls":["https://streamurl.com/1234"],"name":"test","config_id":3, "user_defined":{"country":"France"}}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-v2.acrcloud.com/api/bm-cs-projects/{your_project_id}/streams"

payload = {
  "stream_urls": [
    "https://streamurl.com/1234"
  ],
  "name": "test",
  "config_id": 3,
  "user_defined": {"country": "France"}
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer {your token}',
  'Content-Type': 'application/json'
}

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

print(response.text)

```

{% endtab %}
{% endtabs %}

## List streams in a project

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| pid  | string | The Project ID |

#### Query Parameters

| Name          | Type   | Description                                                           |
| ------------- | ------ | --------------------------------------------------------------------- |
| timemap       | number | 0 or 1                                                                |
| state         | string | All,Running,Timeout,Paused,Invalid URL,Mute,Other. Default is All.    |
| search\_value | string | Search by Name, StreamID, URL, User-defind, Remark                    |
| sort          | string | sort by 'created\_at', 'stream\_id', 'name', Default is 'created\_at' |
| order         | string | order by desc or asc, default is desc.                                |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": [
    {
      "stream_id": "s-At*****",
      "uid": 19,
      "mcp_id": 12417,
      "stream_type": "Audio",
      "name": "test",
      "state": "Running",
      "code": 0,
      "stream_urls": [
        "http://*******"
      ],
      "current_url": "http://*******",
      "region": "eu-west-1",
      "user_defined": null,
      "pitch_shift": 0,
      "check_pitch_shift": 0,
      "remark": "",
      "created_at": "2019-09-19 09:59:17",
      "updated_at": "2021-02-21 23:03:04",
      "record_video": 0,
      "stream_rec_type": 0,
      "epg": "",
      "config": {
        "id": 15,
        "name": "non-realtime and recording stream",
        "uid": 72,
        "rec_length": 10,
        "interval": 0,
        "rec_timeout": 5,
        "monitor_timeout": 25,
        "noise": 1,
        "delay": 1,
        "record": {
          "record": 10,
          "record_after": 0,
          "record_before": 0
        },
        "created_at": "2018-07-26T03:19:15.000000Z"
      },
      "timemap": 1,
      "ucf": 0
    }
  ],
  "links": {
    "first": "https://api-v2.acrcloud.com/api/bm-cs-projects/12848/streams?page=1",
    "last": "https://api-v2.acrcloud.com/api/bm-cs-projects/12848/streams?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "path": "https://api-v2.acrcloud.com/api/bm-cs-projects/12848/streams",
    "per_page": 50,
    "to": 1,
    "total": 1
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/13528/streams' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Update a stream

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id`

#### Path Parameters

| Name       | Type   | Description    |
| ---------- | ------ | -------------- |
| pid        | number | The project id |
| stream\_id | string | The stream id  |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-type  | string | application/json |

#### Request Body

| Name          | Type   | Description                           |
| ------------- | ------ | ------------------------------------- |
| name          | string | The stream name                       |
| stream\_urls  | array  | The stream urls                       |
| config\_id    | number | The config id                         |
| user\_defined | object | User-defined metadata for this stream |

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

```
{
    "data":
        {
            "stream_id":"s-At*****",
            "uid":19,
            "mcp_id":12417,
            "stream_type":"Audio",
            "name":"test2",
            "state":"Running",
            "code":0,
            "stream_urls":[
                "https://*******"
            ],
            "current_url":"https://*******",
            "region":"eu-west-1",
            "user_defined":null,
            "pitch_shift":0,
            "check_pitch_shift":0,
            "remark":"",
            "created_at":"2020-06-07 07:42:16",
            "updated_at":"2021-01-04 10:06:37",
            "record_video":0,
            "stream_rec_type":0,
            "epg":"",
            "config":{
                "id":1,
                "name":"non-realtime for music",
                "uid":0,
                "rec_length":10,
                "interval":0,
                "rec_timeout":5,
                "monitor_timeout":25,
                "noise":1,
                "delay":1,
                "record":{
                    "record":0,
                    "record_after":8,
                    "record_before":5
                },
                "created_at":"2018-05-31T03:20:53.000000Z"
            },
            "timemap":0,
            "ucf":0
        }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'https://api-v2.acrcloud.com/api/bm-cs-projects/13528/streams/s-0xAHfNh' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"stream_urls":["https://streamurl.com/1234"],"name":"test2","config_id":1}'
```

{% endtab %}
{% endtabs %}

## Delete a stream

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_ids`

#### Path Parameters

| Name        | Type   | Description                           |
| ----------- | ------ | ------------------------------------- |
| pid         | number | The project id                        |
| stream\_ids | string | Multiple stream ids, separated by "," |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/bm-cs-projects/13528/streams/s-rHmM7rc' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Pause a stream

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_ids/pause`

#### Path Parameters

| Name        | Type   | Description                                  |
| ----------- | ------ | -------------------------------------------- |
| pid         | number |                                              |
| stream\_ids | string | One or multiple stream ids, separated by ',' |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Restart a stream

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_ids/restart`

#### Path Parameters

| Name        | Type   | Description                                  |
| ----------- | ------ | -------------------------------------------- |
| pid         | string |                                              |
| stream\_ids | string | One or multiple stream ids, separated by ',' |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}


# Streams Results

## Get the stream monitoring results

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/results`

#### Path Parameters

| Name       | Type   | Description                                |
| ---------- | ------ | ------------------------------------------ |
| pid        | number | The project id                             |
| stream\_id | string | ID of the cake to get, for free of course. |

#### Query Parameters

| Name                  | Type   | Description                                                                                                           |
| --------------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| type                  | string | <p>last: get the last results<br>day: get the day results<br>Default is day</p>                                       |
| date                  | string | Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)                                              |
| min\_duration         | number | Only return the results of played\_duration greater than or equal to min\_duration seconds (default: 0)               |
| max\_duration         | number | Only return the results of played\_duration less than or equal to max\_duration seconds (default: 3600)               |
| isrc\_country         | string | Only return results that match the isrc country code (E.g. DE, FR, IT, US)                                            |
| with\_false\_positive | number | <p>0: does not return results marked as false positive. (Default)</p><p>1: returns results marked false positive.</p> |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
    "data": [
        {
            "status": {
                "msg": "Success",
                "code": 0,
                "version": "1.0"
            },
            "result_type": 0,
            "metadata": {
                "type": "delay",
                "timestamp_utc": "2021-01-07 10:18:45",
                "played_duration": 232,
                "music": [
                    {
                        "album": {
                            "name": "Angkara"
                        },
                        "play_offset_ms": 4780,
                        "sample_begin_time_offset_ms": 4940,
                        "title": "Angkara",
                        "result_from": 3,
                        "release_date": "2020-07-18",
                        "sample_end_time_offset_ms": 9580,
                        "label": "SEVENTEEN ELEVEN MUSIC SDN BHD",
                        "duration_ms": 240780,
                        "score": 100,
                        "db_begin_time_offset_ms": 0,
                        "artists": [
                            {
                                "name": "Siti Nordiana"
                            }
                        ],
                        "db_end_time_offset_ms": 4640,
                        "external_ids": {},
                        "acrid": "65e0152da24e3a79935c296ca1c541bf",
                        "external_metadata": {}
                    }
                ]
            }
        }
    ]
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/results?type=day&date=20210201' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}

{% tab title="Curl #last" %}

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/results?type=last' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

#### The following is a sample script that displays the results in real-time

```
<?php

$project_id = "{project_id}";
$stream_id = "{stream_id}";
$token = "{bearer token}"; // https://docs.acrcloud.com/reference/console-api/accesstoken

$opts = [
    "http" => [
        "method" => "GET",
        "header" => "Accept: application/json\r\n" .
            "Authorization: Bearer " . $token . "\r\n"
    ]
];
$context = stream_context_create($opts);

$data = file_get_contents("https://api-v2.acrcloud.com/api/bm-cs-projects/" . $project_id . "/streams/" . $stream_id . "/results?type=last", false, $context);

$obj = json_decode($data, true);
# var_dump($obj);
$title = "";
$artists = "";
if (isset($obj['data']) && count($obj['data']) > 0) {
    $metadata = $obj['data'][0]['metadata'];
    if (array_key_exists('music', $metadata)) {
        $music = $metadata['music'][0];
        $title = $music['title'];
        $arlist = [];
        if (array_key_exists('artists', $music)) {
            foreach($music['artists'] as $ar) {
                $arlist[] = $ar['name'];
            }
        }
        if (count($arlist) > 0) {
            $artists = implode(', ', $arlist);
        }
    }
} 
$ret = ['title'=>$title, 'artists'=>$artists, 'result'=>$obj];
print_r(json_encode($ret));
?>
```

## Getting results not recognized but detected as music. (Note: This API is only available for streams with music detection enabled)

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/unknown_results`

#### Path Parameters

| Name                                         | Type   | Description    |
| -------------------------------------------- | ------ | -------------- |
| pid<mark style="color:red;">\*</mark>        | number | The project id |
| stream\_id<mark style="color:red;">\*</mark> | string | stream\_id     |

#### Query Parameters

| Name                                   | Type   | Description                                                                                             |
| -------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| date<mark style="color:red;">\*</mark> | string | Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)                                |
| min\_duration                          | number | Only return the results of played\_duration greater than or equal to min\_duration seconds (default: 0) |
| max\_duration                          | number | Only return the results of played\_duration less than or equal to max\_duration seconds (default: 3600) |

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token     |
| Accept                                          | string | application/json |

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

```json
{
    "data": [
        {
            "start_timestamp_utc": "2023-10-18 00:11:02",
            "end_timestamp_utc": "2023-10-18 00:12:05",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:20:06",
            "end_timestamp_utc": "2023-10-18 00:21:24",
            "played_duration": 78,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:36:12",
            "end_timestamp_utc": "2023-10-18 00:37:13",
            "played_duration": 61,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 00:58:54",
            "end_timestamp_utc": "2023-10-18 00:59:57",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 01:04:28",
            "end_timestamp_utc": "2023-10-18 01:05:35",
            "played_duration": 67,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 02:38:06",
            "end_timestamp_utc": "2023-10-18 02:39:16",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 03:20:48",
            "end_timestamp_utc": "2023-10-18 03:22:04",
            "played_duration": 76,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 05:29:10",
            "end_timestamp_utc": "2023-10-18 05:30:18",
            "played_duration": 68,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 07:21:34",
            "end_timestamp_utc": "2023-10-18 07:22:51",
            "played_duration": 77,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:18:52",
            "end_timestamp_utc": "2023-10-18 08:20:08",
            "played_duration": 76,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:41:13",
            "end_timestamp_utc": "2023-10-18 08:42:20",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 08:42:30",
            "end_timestamp_utc": "2023-10-18 08:43:37",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 09:24:51",
            "end_timestamp_utc": "2023-10-18 09:26:01",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 09:43:02",
            "end_timestamp_utc": "2023-10-18 09:44:06",
            "played_duration": 64,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 11:24:38",
            "end_timestamp_utc": "2023-10-18 11:25:48",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:03:12",
            "end_timestamp_utc": "2023-10-18 12:04:15",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:14:14",
            "end_timestamp_utc": "2023-10-18 12:15:17",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:19:33",
            "end_timestamp_utc": "2023-10-18 12:20:47",
            "played_duration": 74,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:28:30",
            "end_timestamp_utc": "2023-10-18 12:29:50",
            "played_duration": 80,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 12:53:57",
            "end_timestamp_utc": "2023-10-18 12:55:15",
            "played_duration": 78,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 14:01:51",
            "end_timestamp_utc": "2023-10-18 14:02:54",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 14:58:57",
            "end_timestamp_utc": "2023-10-18 14:59:59",
            "played_duration": 62,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 15:38:38",
            "end_timestamp_utc": "2023-10-18 15:39:43",
            "played_duration": 65,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 17:01:36",
            "end_timestamp_utc": "2023-10-18 17:02:39",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 17:23:08",
            "end_timestamp_utc": "2023-10-18 17:24:08",
            "played_duration": 60,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 18:01:47",
            "end_timestamp_utc": "2023-10-18 18:02:50",
            "played_duration": 63,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 18:55:37",
            "end_timestamp_utc": "2023-10-18 18:56:44",
            "played_duration": 67,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-10-18 21:41:16",
            "end_timestamp_utc": "2023-10-18 21:42:26",
            "played_duration": 70,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-10-18 22:02:03",
            "end_timestamp_utc": "2023-10-18 22:03:13",
            "played_duration": 70,
            "name": "Background music"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

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

```
curl --location 'https://api-v2.acrcloud.com/api/bm-cs-projects/1234/streams/s-xxxxx/unknown_results?date=20231018&min_duration=60&max_duration=80' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}


# Streams State

## Get the state of the stream

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/state`

#### Path Parameters

| Name       | Type   | Description    |
| ---------- | ------ | -------------- |
| pid        | number | The project id |
| stream\_id | string | The stream id  |

#### Query Parameters

| Name        | Type    | Description                                                                                               |
| ----------- | ------- | --------------------------------------------------------------------------------------------------------- |
| timeoffset  | integer | Time offset from UTC(e.g: The timeoffset of Tokyo(UTC+9) is -540, the timeoffset of Dubai(UTC+4) is -240) |
| start\_date | string  | Start date(YYYYmmdd, e.g: 20210301)                                                                       |
| end\_date   | string  | End date(YYYYmmdd, e.g: 20210302)                                                                         |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": {
    "total_time": 318895,
    "valid_time": 312323,
    "timeoffset": -480,
    "state_list": [
      {
        "code": 0,
        "start": "2021-03-26 00:00:00",
        "end": "2021-03-26 00:06:38",
        "duration": 398
      },
      {
        "code": 12,
        "start": "2021-03-26 00:06:38",
        "end": "2021-03-26 00:10:58",
        "duration": 260
      },
      {
        "code": 0,
        "start": "2021-03-26 00:10:58",
        "end": "2021-03-26 00:19:40",
        "duration": 522
      },
      {
        "code": 12,
        "start": "2021-03-26 00:19:40",
        "end": "2021-03-26 00:21:10",
        "duration": 90
      },
      {
        "code": 0,
        "start": "2021-03-26 00:21:10",
        "end": "2021-03-26 00:45:19",
        "duration": 1449
      },
      {
        "code": 12,
        "start": "2021-03-26 00:45:19",
        "end": "2021-03-26 01:10:54",
        "duration": 1535
      },
      {
        "code": 0,
        "start": "2021-03-26 01:10:54",
        "end": "2021-03-26 01:15:55",
        "duration": 301
      },
      {
        "code": 12,
        "start": "2021-03-26 01:15:55",
        "end": "2021-03-26 02:31:12",
        "duration": 4517
      },
      {
        "code": 0,
        "start": "2021-03-26 02:31:12",
        "end": "2021-03-26 02:56:40",
        "duration": 1528
      },
      {
        "code": 12,
        "start": "2021-03-26 02:56:40",
        "end": "2021-03-26 02:56:50",
        "duration": 10
      },
      {
        "code": 0,
        "start": "2021-03-26 02:56:50",
        "end": "2021-03-26 03:30:52",
        "duration": 2042
      },
      {
        "code": 12,
        "start": "2021-03-26 03:30:52",
        "end": "2021-03-26 03:31:01",
        "duration": 9
      },
      {
        "code": 0,
        "start": "2021-03-26 03:31:01",
        "end": "2021-03-26 04:11:00",
        "duration": 2399
      },
      {
        "code": 12,
        "start": "2021-03-26 04:11:00",
        "end": "2021-03-26 04:11:09",
        "duration": 9
      },
      {
        "code": 0,
        "start": "2021-03-26 04:11:09",
        "end": "2021-03-26 05:58:13",
        "duration": 6424
      },
      {
        "code": 0,
        "start": "2021-03-26 05:58:13",
        "end": "2021-03-26 08:00:00",
        "duration": 7307
      },
      {
        "code": 0,
        "start": "2021-03-26 08:00:00",
        "end": "2021-03-27 08:00:00",
        "duration": 86400
      },
      {
        "code": 0,
        "start": "2021-03-27 08:00:00",
        "end": "2021-03-27 22:01:26",
        "duration": 50486
      },
      {
        "code": 1,
        "start": "2021-03-27 22:01:26",
        "end": "2021-03-27 22:02:26",
        "duration": 60
      },
      {
        "code": 0,
        "start": "2021-03-27 22:02:26",
        "end": "2021-03-27 22:02:47",
        "duration": 21
      },
      {
        "code": 1,
        "start": "2021-03-27 22:02:47",
        "end": "2021-03-27 22:03:00",
        "duration": 13
      },
      {
        "code": 0,
        "start": "2021-03-27 22:03:00",
        "end": "2021-03-28 08:00:00",
        "duration": 35820
      },
      {
        "code": 0,
        "start": "2021-03-28 08:00:00",
        "end": "2021-03-29 05:46:49",
        "duration": 78409
      },
      {
        "code": 1,
        "start": "2021-03-29 05:46:49",
        "end": "2021-03-29 05:47:57",
        "duration": 68
      },
      {
        "code": 0,
        "start": "2021-03-29 05:47:57",
        "end": "2021-03-29 08:00:00",
        "duration": 7923
      },
      {
        "code": 0,
        "start": "2021-03-29 08:00:00",
        "end": "2021-03-29 16:34:54",
        "duration": 30894
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12417/streams/s-0xAHfNh/state?timeoffset=0&start_date=20210301&end_date=20210302' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## The details of the state code

| Code | Name        |
| ---- | ----------- |
| 0    | Running     |
| 1    | Timeout     |
| 4    | Paused      |
| 6    | Invalid URL |
| 10   | Deleted     |
| 12   | Mute        |


# Recordings

Please make sure that your channels have enabled Timemap before getting the recording.

## Get the recording of the results.

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/recordings`

This endpoint allows you to get the recordings of the results of your channels.

#### Path Parameters

| Name       | Type   | Description    |
| ---------- | ------ | -------------- |
| pid        | number | The project id |
| stream\_id | string | The stream id  |

#### Query Parameters

| Name             | Type    | Description                                                                                |
| ---------------- | ------- | ------------------------------------------------------------------------------------------ |
| timestamp\_utc   | string  | The start time of the recording, the format is YYYYmmddHHMMSS (for example 20210101120809) |
| played\_duration | integer | The duration of the recording(seconds)                                                     |
| record\_before   | integer | How many seconds of recording to add forward(default 0).                                   |
| record\_after    | integer | How many seconds of recording to add backwards(default 0).                                 |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |
| Accept        | string | \*/\*        |

{% tabs %}
{% tab title="200 Get recording successfully." %}

```
```

{% endtab %}

{% tab title="404 Could not get the recording." %}

```
{    "message": "The recording is not available."    }
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/10079/streams/s-XXXXXXX/recordings?timestamp_utc=20210607000210&played_duration=30' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}


# Analytics

This api is only applicable to projects bound to ACRCloud Music

## Get analytics data for the last 7 days

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:project_id/analytics/results`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| project\_id<mark style="color:red;">\*</mark> | Number | The project id |

#### Query Parameters

| Name                                           | Type   | Description                                                                                                                                 |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------- |
| stats\_type<mark style="color:red;">\*</mark>  | String | <p>Type of data, including date, track, artists, label, stream.</p><p>If result\_type is custom, then only include date, track, stream.</p> |
| result\_type<mark style="color:red;">\*</mark> | String | Type of result, including music, custom                                                                                                     |

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token     |
| Accept<mark style="color:red;">\*</mark>        | String | application/json |

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

```javascript
{
    "data": {
        "id": "aaaaaa285bccccccc9210ffc4cdddddd",
        "project_id": 12345,
        "stats_type": "date",
        "result_type": "music",
        "start_timestamp_utc": "2022-07-27 00:00:00",
        "end_timestamp_utc": "2022-08-02 23:59:59",
        "results": [
            {
                "date": "2022-07-27",
                "play_time": 130057,
                "plays": 1130,
                "rank": 1
            },
            {
                "date": "2022-07-28",
                "play_time": 90462,
                "plays": 917,
                "rank": 2
            },
            {
                "date": "2022-07-29",
                "play_time": 138791,
                "plays": 1178,
                "rank": 3
            },
            {
                "date": "2022-07-30",
                "play_time": 159087,
                "plays": 1126,
                "rank": 4
            },
            {
                "date": "2022-07-31",
                "play_time": 161067,
                "plays": 1209,
                "rank": 5
            },
            {
                "date": "2022-08-01",
                "play_time": 133762,
                "plays": 1187,
                "rank": 6
            },
            {
                "date": "2022-08-02",
                "play_time": 135043,
                "plays": 1195,
                "rank": 7
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

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

```shell
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-cs-projects/12345/analytics/results?result_type=music&stats_type=date' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
```

{% endtab %}
{% endtabs %}


# User Reports

## Insert user results

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-cs-projects/:pid/streams/:stream_id/user-reports`

This endpoint allows you to insert the results just like in Timemap or UCF.

#### Path Parameters

| Name       | Type   | Description    |
| ---------- | ------ | -------------- |
| pid        | number | The project id |
| stream\_id | string | The stream id  |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Accept        | string | application/json |
| Authorization | string | Bearer token     |
| Content-Type  | string | application/json |

#### Request Body

| Name                    | Type   | Description                                                                                                                        |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| data                    | array  | Result list (\[result1, result2, result3...])                                                                                      |
| result.from             | string | api                                                                                                                                |
| result.title            | string | The title of the result                                                                                                            |
| result.timeoffset       | string | UTC time offsets (For example, UK time is UTC + 00:00, the timeoffset is 0; Hong Kong time is UTC + 08:00, the timeoffset is -480) |
| reuslt.start\_timestamp | string | YYYY-mm-dd HH:MM:SS (For example, 2021-02-01 12:13:14), it is your Local Time.                                                     |
| result.end\_timestamp   | string | YYYY-mm-dd HH:MM:SS (For example, 2021-02-01 12:15:26), it is your Local Time.                                                     |
| result.user\_defined    | string | Other fields of the result (For example, {"artists": "xxx", "album": "xxx", "isrc": "xxx"})                                        |

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

```
{
  "data": {
    "id": 984590,
    "result": {
      "start_timestamp_utc": "2021-05-25 03:55:49",
      "end_timestamp_utc": "2021-05-25 03:56:37",
      "record_timestamp": "",
      "title": "xxx",
      "artists": "xxx",
      "album": "xxx",
      "acrid": "null",
      "duration": 48,
      "played_duration": 48,
      "monitor_type": "",
      "result_type": "custom",
      "from": "api-report",
      "raw_metadata": {
        "title": "xxx",
        "artist": "xxx",
        "album": "xxx"
      },
      "start_timestamp_local": "2021-05-25 11:55:49",
      "end_timestamp_local": "2021-05-25 11:56:37"
    }
  }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="First Tab" %}

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-cs-projects/17913/stream_id/s-XXXXXX/user-reports' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
--header 'Content-Type: application/json' \
--data-raw '{"data":[{"from": "api", "title": "xxxx", "timeoffset": 0, "start_timestamp": "2021-02-01 12:13:14", "end_timestamp": "2021-02-01 12:15:26", "user_defined": {"artists": "xxx", "album": "xxx"}}]}'
```

{% endtab %}
{% endtabs %}


# Broadcast Database Projects

## Create a project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects`

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name    | Type   | Description                        |
| ------- | ------ | ---------------------------------- |
| region  | string | eu-west-1,us-west-2,ap-southeast-1 |
| name    | string | The project name                   |
| buckets | array  | Bucket ids array                   |

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

```
{
  "data": {
    "id": 12345,
    "name": "test",
    "uid": 2,
    "region": "eu-west-1",
    "bucket_ids": "14661",
    "updated_at": "2021-02-22 03:38:28",
    "created_at": "2021-02-22 03:38:27",
    "access_key": "**********",
    "buckets": [
      {
        "id": 14661,
        "uid": 2,
        "name": "test",
        "type": "File",
        "node": "10.12.12.236-850",
        "state": 1,
        "region": "eu-west-1",
        "metadata_template": "isrc, artist, album",
        "labels": [
          "Music"
        ],
        "net_type": 1,
        "created_at": "2020-07-06 11:25:08",
        "updated_at": "2020-07-06 11:25:08",
        "num": 0,
        "size": 0,
        "access_permission": "private"
      }
    ],
    "config": {
      "record": {
        
      },
      "ucf": {
        
      },
      "callback_result": {
        "enabled": 0,
        "type_name": "diy",
        "diy_url": "",
        "diy_send_type": 2,
        "diy_send_noresult": 0,
        "diy_result_type": -1,
        "r3d_source": "",
        "r3d_url": "",
        "r3d_key1": "",
        "r3d_key2": "",
        "r3d_result_type": "0"
      },
      "callback_state": {
        "enabled": 0,
        "url": "",
        "send_type": 2
      },
      "email_state": {
        "email": "",
        "type": 2
      },
      "access_permission": {
        "add_tv": 0,
        "edit_url": 0,
        "can_modify": 1
      }
    },
    "monitoring_num": 0,
    "type": "BM-Database",
    "status_check": 2
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-bd-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"region": "eu-west-1", "name": "test1", "buckets": [14661]}'
```

{% endtab %}
{% endtabs %}

## Update a project

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name    | Type   | Description      |
| ------- | ------ | ---------------- |
| name    | string | The project name |
| buckets | array  |                  |

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

```
{
  "data": {
    "id": 12345,
    "name": "test2",
    "uid": 2,
    "region": "eu-west-1",
    "bucket_ids": "23,14661",
    "updated_at": "2021-02-22 03:44:08",
    "created_at": "2021-02-22 03:38:27",
    "access_key": "**************",
    "buckets": [
      {
        "id": 23,
        "uid": 0,
        "name": "ACRCloud Music",
        "type": "ACRCloudFile",
        "node": "52.50.121.26-8870",
        "state": 1,
        "region": "global",
        "metadata_template": "",
        "labels": [
          "Music"
        ],
        "net_type": 0,
        "created_at": "2015-05-05 04:22:19",
        "updated_at": "2020-05-13 19:28:15",
        "num": 72002117,
        "size": 397184,
        "access_permission": "private"
      },
      {
        "id": 14661,
        "uid": 72,
        "name": "test",
        "type": "File",
        "node": "10.12.12.236-850",
        "state": 1,
        "region": "eu-west-1",
        "metadata_template": "isrc, artist, album",
        "labels": [
          "Music"
        ],
        "net_type": 1,
        "created_at": "2020-07-06 11:25:08",
        "updated_at": "2020-07-06 11:25:08",
        "num": 0,
        "size": 0,
        "access_permission": "private"
      }
    ],
    "config": {
      "record": {
        
      },
      "ucf": {
        
      },
      "callback_result": {
        "enabled": 0,
        "type_name": "diy",
        "diy_url": "",
        "diy_send_type": 2,
        "diy_send_noresult": 0,
        "diy_result_type": -1,
        "r3d_source": "",
        "r3d_url": "",
        "r3d_key1": "",
        "r3d_key2": "",
        "r3d_result_type": "0"
      },
      "callback_state": {
        "enabled": 0,
        "url": "",
        "send_type": 2
      },
      "email_state": {
        "email": "",
        "type": 2
      },
      "access_permission": {
        "add_tv": 0,
        "edit_url": 0,
        "can_modify": 1
      }
    },
    "monitoring_num": 0,
    "type": "BM-Database",
    "status_check": 2
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request PUT 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"region": "eu-west-1", "name": "test2", "buckets": [14661, 23]}'
```

{% endtab %}
{% endtabs %}

## Delete a project

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
```

{% endtab %}
{% endtabs %}

## List the projects

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects`

#### Query Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| region | string |             |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": [
    {
      "id": 12345,
      "name": "test",
      "uid": 2,
      "region": "eu-west-1",
      "bucket_ids": "23",
      "updated_at": "2020-07-27 03:35:51",
      "created_at": "2020-06-16 10:09:35",
      "access_key": "***************",
      "buckets": [
        {
          "id": 23,
          "uid": 0,
          "name": "ACRCloud Music",
          "type": "ACRCloudFile",
          "node": "52.50.121.26-8870",
          "state": 1,
          "region": "global",
          "metadata_template": "",
          "labels": [
            "Music"
          ],
          "net_type": 0,
          "created_at": "2015-05-05 04:22:19",
          "updated_at": "2020-05-13 19:28:15",
          "num": 72002117,
          "size": 397184,
          "access_permission": "private"
        }
      ],
      "config": {
        "record": {
          
        },
        "ucf": {
          
        },
        "callback_result": {
          "enabled": 0,
          "type_name": "diy",
          "diy_url": "",
          "diy_send_type": 2,
          "diy_send_noresult": 0,
          "diy_result_type": 1,
          "r3d_source": "",
          "r3d_url": "",
          "r3d_key1": "",
          "r3d_key2": "",
          "r3d_result_type": "0"
        },
        "callback_state": {
          "enabled": 0,
          "url": "",
          "send_type": 2
        },
        "email_state": {
          "email": "",
          "type": 2
        },
        "access_permission": {
          "add_tv": 0,
          "edit_url": 0,
          "can_modify": 1
        }
      },
      "monitoring_num": 1,
      "type": "BM-Database",
      "status_check": 2
    }
  ],
  "links": {
    "first": "https://api-v2.acrcloud.com/api/bm-bd-projects?page=1",
    "last": "https://api-v2.acrcloud.com/api/bm-bd-projects?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "path": "https://api-v2.acrcloud.com/api/bm-bd-projects",
    "per_page": "20",
    "to": 2,
    "total": 2
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects?region=eu-west-1&page=1&per_page=20' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
```

{% endtab %}
{% endtabs %}

## Set results callback URL

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:id/result-callback`

After you set the results callback URL, the monitoring system will post the result to your callback URL in real-time.

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | the project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name                             | Type   | Description                                                                           |
| -------------------------------- | ------ | ------------------------------------------------------------------------------------- |
| result\_callback\_url            | string | set the callback url                                                                  |
| result\_callback\_send\_noresult | number | result\_callback\_send\_noresult: whether inform you when no content detected. 0 or 1 |
| result\_callback\_               | string | <p>result\_callback\_result\_type:<br>0: RealTime<br>1: Delay</p>                     |

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

```
{
    "data":{
        "id":12345,
        "name":"monitor_test",
        "uid":2,
        "region":"eu-west-1",
        "bucket_ids":"23",
        "updated_at":"2019-11-18 03:34:09",
        "created_at":"2019-03-19 03:15:48",
        "access_key":"**************",
        "buckets":[
            {
                "id":23,
                "uid":0,
                "name":"ACRCloud Music",
                "type":"ACRCloudFile",
                "node":"52.50.121.26-8870",
                "state":1,
                "region":"global",
                "metadata_template":"",
                "labels":[
                    "Music"
                ],
                "net_type":0,
                "created_at":"2015-05-05 04:22:19",
                "updated_at":"2020-05-13 19:28:15",
                "num":72002117,
                "size":397184,
                "access_permission":"private"
            }
        ],
        "config":{
            "record":{

            },
            "ucf":{

            },
            "callback_result":{
                "enabled":1,
                "type_name":"diy",
                "diy_url":"http://test.acrcloud.com",
                "diy_send_type":2,
                "diy_send_noresult":0,
                "diy_result_type":0,
                "r3d_source":"",
                "r3d_url":"",
                "r3d_key1":"",
                "r3d_key2":"",
                "r3d_result_type":"0"
            },
            "callback_state":{
                "enabled":0,
                "url":"",
                "send_type":2
            },
            "email_state":{
                "email":"",
                "type":2
            },
            "access_permission":{
                "add_tv":0,
                "edit_url":1,
                "can_modify":1
            }
        },
        "monitoring_num":4,
        "type":"BM-Database",
        "status_check":2
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345/result-callback?type=diy' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your token}' \
--data-raw '{"result_callback_url": "http://*****", "result_callback_send_noresult": false, "result_callback_send_type": "2", "result_callback_result_type": "1"}'
```

{% endtab %}
{% endtabs %}

> The following is the example of the results of the monitoring system posting to your results callback URL

{% tabs %}
{% tab title="Sample result of Music(Callback)" %}

```
{
  "stream_id": "100251",
  "stream_name": "BBC Radio 1",
  "stream_country": "United Kingdom",
  "bucket_id": "23",
  "status": 1,
  "user_defined": {
    "custom_id": "test_id"
  },
  "data": {
    "status": {
      "msg": "Success",
      "version": "1.0",
      "code": 0
    },
    "result_type": 0,
    "metadata": {
      "type": "delay",
      "timestamp_utc": "2020-01-14 05:49:18",
      "played_duration": 139,
      "music": [
        {
          "album": {
            "name": "I Know You"
          },
          "play_offset_ms": 19800,
          "genres": [
            {
              "name": "Dance"
            }
          ],
          "contributors": {
            "composers": [
              "Craig David",
              "Dan Smith",
              "Fraser T Smith",
              "Helen Culver"
            ],
            "lyricists": [
              "DANIEL CAMPBELL SMITH",
              "FRASER LANCE THORNEYCROFT SMITH",
              "CARMEN REECE",
              "CRAIG ASHLEY DAVID"
            ]
          },
          "lyrics": {
            "copyrights": [
              "Universal Music Publishing Group"
            ]
          },
          "title": "I Know You",
          "result_from": 3,
          "release_date": "2017-11-10",
          "sample_end_time_offset_ms": 9180,
          "sample_begin_time_offset_ms": 3520,
          "label": "Speakerbox/Insanity Records",
          "duration_ms": 214760,
          "score": 100,
          "db_begin_time_offset_ms": 13860,
          "artists": [
            {
              "name": "Craig David"
            }
          ],
          "db_end_time_offset_ms": 19520,
          "external_ids": {
            "isrc": [
              "GBARL1701677",
              "GBARL1800085"
            ],
            "upc": [
              "886446809496",
              "886446747439",
              "886446617541"
            ]
          },
          "acrid": "9564199dacc709123aee61c9556bacd2",
          "external_metadata": {
            "spotify": [
              {
                "track": {
                  "name": "I Know You",
                  "id": "34t13rSSZtr22CjcmroMmh"
                },
                "album": {
                  "name": "I Know You",
                  "id": "1SaIescHHJvcb0oyGVVIme"
                },
                "artists": [
                  {
                    "name": "Craig David",
                    "id": "2JyWXPbkqI5ZJa3gwqVa0c"
                  },
                  {
                    "name": "Bastille",
                    "id": "7EQ0qTo7fWT7DPxmxtSYEc"
                  }
                ]
              },
              {
                "track": {
                  "name": "I Know You",
                  "id": "5lRzEC0Hyj92nEr9JkDxM2"
                },
                "album": {
                  "name": "The Time Is Now (Deluxe)",
                  "id": "51vRvV83RdWGP9FpzGe4SQ"
                },
                "artists": [
                  {
                    "name": "Craig David",
                    "id": "2JyWXPbkqI5ZJa3gwqVa0c"
                  },
                  {
                    "name": "Bastille",
                    "id": "7EQ0qTo7fWT7DPxmxtSYEc"
                  }
                ]
              }
            ],
            "deezer": [
              {
                "track": {
                  "name": "I Know You",
                  "id": "419827392"
                },
                "album": {
                  "name": "I Know You",
                  "id": "50234022"
                },
                "artists": [
                  {
                    "name": "Craig David",
                    "id": 110
                  },
                  {
                    "name": "Craig David",
                    "id": 110
                  },
                  {
                    "name": "Bastille",
                    "id": 1352097
                  }
                ]
              },
              {
                "track": {
                  "name": "I Know You",
                  "id": "450179142"
                },
                "album": {
                  "name": "The Time Is Now (Deluxe)",
                  "id": "55045462"
                },
                "artists": [
                  {
                    "name": "Craig David",
                    "id": "110"
                  }
                ]
              },
              {
                "track": {
                  "name": "I Know You",
                  "id": "478445942"
                },
                "album": {
                  "id": "59933892"
                },
                "artists": [
                  {
                    "id": 110,
                    "name": "Craig David"
                  },
                  {
                    "id": 1352097,
                    "name": "Bastille"
                  }
                ]
              }
            ]
          }
        }
      ],
      "record_timestamp": "20200114054918"
    }
  }
}
```

{% endtab %}

{% tab title="Sample result of Custom Files(Callback)" %}

```
{
  "stream_id": "100251",
  "stream_name": "BBC Radio 1",
  "stream_country": "United Kingdom",
  "bucket_id": "23",
  "status": 1,
  "user_defined": {
    "custom_id": "test_id"
  },
  "data": { 
        "status": {
            "msg": "Success",
            "code": 0,
            "version": "1.0"
        },
        "metadata": {
            "timestamp_utc": "2015-07-27 12:56:46",
            "played_duration": 30,
            "custom_files": [
                {
                    "bucket_id": "51",
                    "title": "You are beautiful",
                    "artist": "James",
                    "acrid": "5343bc191634b042622bf474ed46121a",
                    "audio_id": "3",
                }
            ]
        },
        "result_type": 0 
    }
}
```

{% endtab %}
{% endtabs %}

## Set state notification callback

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:id/state-notification`

After you set the state callback URL, the monitoring system will post the states to your callback URL in real-time when the state of the channel changes.

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name                 | Type   | Description                                                             |
| -------------------- | ------ | ----------------------------------------------------------------------- |
| state\_callback\_url | string | If the streams state change, we will post a result to this url you set. |

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

```
{
    "data":{
        "id":12345,
        "name":"monitor_test",
        "uid":2,
        "region":"eu-west-1",
        "bucket_ids":"23",
        "updated_at":"2019-11-18 03:34:09",
        "created_at":"2019-03-19 03:15:48",
        "access_key":"***************",
        "buckets":[
            {
                "id":23,
                "uid":0,
                "name":"ACRCloud Music",
                "type":"ACRCloudFile",
                "node":"52.50.121.26-8870",
                "state":1,
                "region":"global",
                "metadata_template":"",
                "labels":[
                    "Music"
                ],
                "net_type":0,
                "created_at":"2015-05-05 04:22:19",
                "updated_at":"2020-05-13 19:28:15",
                "num":72002117,
                "size":397184,
                "access_permission":"private"
            }
        ],
        "config":{
            "record":{

            },
            "ucf":{

            },
            "callback_result":{
                "enabled":0,
                "type_name":"diy",
                "diy_url":"",
                "diy_send_type":2,
                "diy_send_noresult":0,
                "diy_result_type":0,
                "r3d_source":"",
                "r3d_url":"",
                "r3d_key1":"",
                "r3d_key2":"",
                "r3d_result_type":"0"
            },
            "callback_state":{
                "enabled":1,
                "url":"http://test.acrcloud.com",
                "send_type":2
            },
            "email_state":{
                "email":"",
                "type":2
            },
            "access_permission":{
                "add_tv":0,
                "edit_url":1,
                "can_modify":1
            }
        },
        "monitoring_num":4,
        "type":"BM-Database",
        "status_check":2
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345/state-notification' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {your token}' \
--data-raw '{"state_callback_url": "http://www.xxxx.com/state_callback", "state_callback_type": "2"}'
```

{% endtab %}
{% endtabs %}

#### Example of monitoring system sending state data to your callback URL

```
{
    "status":[
        {
            "stream_name":"Radio Fermo Uno",
            "code":6,
            "timestamp":"2022-01-22 14:02:00",
            "stream_id":"222195",
            "state":"invalid_url",
            "type":"unknown"
        }
    ]
}
```

#### The details of the state code

| Code | State Name  |
| ---- | ----------- |
| 0    | Running     |
| 1    | Timeout     |
| 4    | Paused      |
| 6    | Invaild URL |
| 10   | Deleted     |
| 12   | Mute        |


# Channels

## List the channels in this project

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels`

This endpoint allows you to get free cakes.

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | string | The project id |

#### Query Parameters

| Name          | Type   | Description                                                       |
| ------------- | ------ | ----------------------------------------------------------------- |
| state         | string | All,Running,Timeout,Paused,Invalid URL,Mute,Other. Default is All |
| timemap       | string | 0 or 1                                                            |
| search\_type  | string | channel\_id, channel\_name, city, custom\_id, mytuner\_id         |
| search\_value | string |                                                                   |
| page          | number | The page number                                                   |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
    "data": [
        {
            "uid": 19,
            "project_id": 179,
            "id": 100251,
            "type": "Radio",
            "name": "BBC Radio 1",
            "sub_title": "London - 98.8 FM",
            "language": "English",
            "city": "London",
            "province": null,
            "country": "United Kingdom",
            "continent": "Europe",
            "website": "http://www.bbc.co.uk/radio1",
            "twitter": "http://twitter.com/BBCR1",
            "mytuner": "https://mytuner-radio.com/radio/409791",
            "urls": [],
            "status_code": 0,
            "monitor_at": "2018-02-26 07:56:50",
            "timemap": 0,
            "user_defined": [],
            "add_at": "2020-03-25 00:00:00"
        },
        {
            "uid": 19,
            "project_id": 179,
            "id": 100252,
            "type": "Radio",
            "name": "BBC Radio 2",
            "sub_title": "London - 89.1 FM",
            "language": "English",
            "city": "London",
            "province": null,
            "country": "United Kingdom",
            "continent": "Europe",
            "website": "http://www.bbc.co.uk/radio2",
            "twitter": "http://twitter.com/BBCRadio2",
            "mytuner": "https://mytuner-radio.com/radio/409758",
            "urls": [],
            "status_code": 0,
            "monitor_at": "2018-02-26 07:56:50",
            "timemap": 0,
            "user_defined": [],
            "add_at": "2020-03-25 00:00:00"
        }
    ],
    "links": {
        "first": "https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels?page=1",
        "last": "https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels",
        "per_page": 50,
        "to": 2,
        "total": 2
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Add channels to your project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| pid  | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name     | Type   | Description       |
| -------- | ------ | ----------------- |
| channels | string | channel\_id array |

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345/channels' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"channels": [238766]}'
```

{% endtab %}
{% endtabs %}

## Delete channels from your project

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_ids`

#### Path Parameters

| Name         | Type   | Description                  |
| ------------ | ------ | ---------------------------- |
| pid          | string | The project id               |
| channel\_ids | string | One or multiple channel ids, |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/bm-bd-projects/12345/channels/238766?is_marked=0' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
```

{% endtab %}
{% endtabs %}

## Set custom\_id for channel

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/user-defined`

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | string | The project id |
| channel\_id | string | The channel id |

#### Query Parameters

| Name       | Type   | Description             |
| ---------- | ------ | ----------------------- |
| custom\_id | string | Custom ID, can be empty |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

**Response**

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

```json
{
    "data": {
        "uid": 72,
        "project_id": 3086,
        "id": 219046,
        "type": "Radio",
        "name": "Cadena COPE",
        "sub_title": "Madrid - 999 AM",
        "language": "",
        "city": "Madrid",
        "province": null,
        "country": "Spain",
        "continent": "Europe",
        "website": "http://www.cope.es/",
        "twitter": "https://twitter.com/cope_es",
        "mytuner": "https://mytuner-radio.com/radio/410556",
        "urls": [],
        "status_code": 0,
        "monitor_at": "2019-06-06 08:55:41",
        "timemap": 0,
        "timemap_lifecycle": null,
        "coversong": 0,
        "coversong_at": "",
        "user_defined": {
            "id": "custom_id"
        },
        "add_at": "2025-02-24 06:45:10"
    }
}
```

{% endtab %}
{% endtabs %}


# Channels Results

## Get non-real-time results of channel monitoring

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/results`

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | number | The project id |
| channel\_id | number | The channel id |

#### Query Parameters

| Name                  | Type   | Description                                                                                                           |
| --------------------- | ------ | --------------------------------------------------------------------------------------------------------------------- |
| type                  | string | <p>last: get the last result<br>day: get the day result<br>Default is day.</p>                                        |
| date                  | string | get the results for a certain day you specified. The format is YYYYmmdd (E.g. 20210201)                               |
| min\_duration         | number | Only return the results of played\_duration greater than or equal to min\_duration seconds (default: 0)               |
| max\_duration         | number | Only return the results of played\_duration less than or equal to max\_duration seconds (default: 3600)               |
| isrc\_country         | string | Only return results that match the isrc country code (E.g. DE, FR, IT, US)                                            |
| with\_false\_positive | number | <p>0: does not return results marked as false positive. (Default)</p><p>1: returns results marked false positive.</p> |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
    "data": [
        {
            "status": {
                "msg": "Success",
                "code": 0,
                "version": "1.0"
            },
            "result_type": 0,
            "metadata": {
                "type": "delay",
                "timestamp_utc": "2021-01-07 10:20:25",
                "played_duration": 117,
                "music": [
                    {
                        "album": {
                            "name": "Shoot For The Stars Aim For The Moon"
                        },
                        "play_offset_ms": 30520,
                        "sample_begin_time_offset_ms": 2420,
                        "title": "What You Know Bout Love",
                        "result_from": 3,
                        "release_date": "2020-07-03",
                        "sample_end_time_offset_ms": 8460,
                        "genres": [
                            {
                                "name": "Hip Hop"
                            }
                        ],
                        "label": "Victor Victor Worldwide",
                        "db_end_time_offset_ms": 29240,
                        "score": 100,
                        "db_begin_time_offset_ms": 23200,
                        "artists": [
                            {
                                "name": "Pop Smoke"
                            }
                        ],
                        "duration_ms": 160000,
                        "external_ids": {
                            "isrc": [
                                "USUM72013339",
                                "USUM72013343",
                                "QZNMT2001964"
                            ],
                            "upc": [
                                "00602507456573",
                                "00602507456672",
                                "00602507456566"
                            ]
                        },
                        "acrid": "dda6ca5475ba126aa02b88ebe9b9b4cd",
                        "external_metadata": {
                            "spotify": [
                                {
                                    "album": {
                                        "name": "Shoot For The Stars Aim For The Moon",
                                        "id": "7e7t0MCrNDcJZsPwUKjmOc"
                                    },
                                    "track": {
                                        "name": "What You Know Bout Love",
                                        "id": "1tkg4EHVoqnhR6iFEXb60y"
                                    },
                                    "artists": [
                                        {
                                            "name": "Pop Smoke",
                                            "id": "0eDvMgVFoNV3TpwtrVCoTj"
                                        }
                                    ]
                                },
                                {
                                    "album": {
                                        "name": "Shoot For The Stars Aim For The Moon",
                                        "id": "3BjyBrktXCnnJ0gHifkyAk"
                                    },
                                    "track": {
                                        "name": "What You Know Bout Love",
                                        "id": "4g7ErSF4oImNnITtyiFowz"
                                    },
                                    "artists": [
                                        {
                                            "name": "Pop Smoke",
                                            "id": "0eDvMgVFoNV3TpwtrVCoTj"
                                        }
                                    ]
                                },
                                {
                                    "album": {
                                        "name": "Shoot For The Stars Aim For The Moon (Deluxe)",
                                        "id": "45HGJedVnKuOXNFW8fVuDz"
                                    },
                                    "track": {
                                        "name": "What You Know Bout Love",
                                        "id": "3jia9xE2RlTZKSy78z1mIz"
                                    },
                                    "artists": [
                                        {
                                            "name": "Pop Smoke",
                                            "id": "0eDvMgVFoNV3TpwtrVCoTj"
                                        }
                                    ]
                                }
                            ],
                            "deezer": [
                                {
                                    "album": {
                                        "name": ""
                                    },
                                    "track": {
                                        "name": "What You Know Bout Love",
                                        "id": "1081877402"
                                    },
                                    "artists": [
                                        {
                                            "name": "Pop Smoke"
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                ],
                "record_timestamp": "20210107102025"
            }
        }
    ]
}
```

{% endtab %}

{% tab title="404 Could not find a cake matching this query." %}

```
{    "message": "Ain't no cake like that."}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels/100251/results?type=day&date=20210201' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}

{% tab title="Curl #last" %}

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels/100251/results?type=last' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Get real-time results of channel monitoring

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/realtime_results`

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | number | The project id |
| channel\_id | number | The channel id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": {
    "status": {
      "msg": "Success",
      "code": 0,
      "version": "1.0"
    },
    "result_type": 0,
    "metadata": {
      "timestamp_utc": "2021-02-24 08:29:44",
      "music": [
        {
          "album": {
            "name": "Coco"
          },
          "play_offset_ms": 13240,
          "sample_begin_time_offset_ms": 0,
          "contributors": {
            "composers": [
              "Golden Landis Von Jones",
              "Omer Fedi",
              "Jace Logan Jennings",
              "Jonathan Kirk"
            ],
            "lyricists": [
              "Golden Landis Von Jones",
              "Omer Fedi",
              "Jace Logan Jennings",
              "Jonathan Kirk"
            ]
          },
          "title": "Coco",
          "result_from": 3,
          "release_date": "2020-12-04",
          "sample_end_time_offset_ms": 9080,
          "genres": [
            {
              "name": "Rap"
            }
          ],
          "label": "SME - Records/Columbia",
          "duration_ms": 142000,
          "score": 100,
          "db_begin_time_offset_ms": 3520,
          "artists": [
            {
              "name": "24kGoldn"
            },
            {
              "name": "DaBaby"
            }
          ],
          "db_end_time_offset_ms": 12600,
          "external_ids": {
            "isrc": [
              "USQX92004163",
              "USANG2128624",
              "USQX92005136"
            ],
            "upc": [
              "886448929031",
              "024543215974",
              "886448929048"
            ]
          },
          "acrid": "052b6bc22d274731acf51d51449a3a5f",
          "external_metadata": {
            "spotify": [
              {
                "album": {
                  "name": "Coco (feat. DaBaby)"
                },
                "track": {
                  "name": "Coco (feat. DaBaby)",
                  "id": "2V6pjeOCuPBVlatcWTXUtP"
                },
                "artists": [
                  {
                    "name": "24kGoldn"
                  },
                  {
                    "name": "DaBaby"
                  }
                ]
              }
            ],
            "deezer": [
              {
                "album": {
                  "name": ""
                },
                "track": {
                  "name": "Coco (feat. DaBaby)",
                  "id": "1160241372"
                },
                "artists": [
                  {
                    "name": "24kgoldn"
                  },
                  {
                    "name": "DaBaby"
                  }
                ]
              }
            ]
          }
        }
      ]
    }
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels/100251/realtime_results' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

#### The following is a sample script that displays the results in real-time

```
<?php

$project_id = "{project_id}";
$channel_id = "{channel_id}";
$token = "{bearer token}"; // https://docs.acrcloud.com/reference/console-api/accesstoken

$opts = [
    "http" => [
        "method" => "GET",
        "header" => "Accept: application/json\r\n" .
            "Authorization: Bearer " . $token . "\r\n"
    ]
];
$context = stream_context_create($opts);

$data = file_get_contents("https://api-v2.acrcloud.com/api/bm-bd-projects/" . $project_id . "/channels/" . $channel_id . "/realtime_results", false, $context);

$obj = json_decode($data, true);
# var_dump($obj);
$title = "";
$artists = "";
$metadata = $obj['data']['metadata'];
if (array_key_exists('music', $metadata)) {
    $music = $metadata['music'][0];
    $title = $music['title'];
    $arlist = [];
    if (array_key_exists('artists', $music)) {
        foreach($music['artists'] as $ar) {
            $arlist[] = $ar['name'];
        }
    }
    if (count($arlist) > 0) {
        $artists = implode(', ', $arlist);
    }
}

$ret = ['title'=>$title, 'artists'=>$artists, 'result'=>$obj];
print_r(json_encode($ret));
?>
```

## Getting results not recognized but detected as music. (Note: This API is only available for channels with music detection enabled)

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/unknown_results`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| pid<mark style="color:red;">\*</mark>         | Number | The project id |
| channel\_id<mark style="color:red;">\*</mark> | Number | channel\_id    |

#### Query Parameters

| Name                                   | Type   | Description                                                                                             |
| -------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| date<mark style="color:red;">\*</mark> | String | Get all the results on this date. The format is YYYYmmdd (E.g. 20210201)                                |
| min\_duration                          | Number | Only return the results of played\_duration greater than or equal to min\_duration seconds (default: 0) |
| max\_duration                          | Number | Only return the results of played\_duration less than or equal to max\_duration seconds (default: 3600) |

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token     |
| Accept<mark style="color:red;">\*</mark>        | String | application/json |

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

````json
```json
{
    "data": [
        {
            "start_timestamp_utc": "2023-11-01 00:00:00",
            "end_timestamp_utc": "2023-11-01 00:00:12",
            "played_duration": 12,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-11-01 00:00:26",
            "end_timestamp_utc": "2023-11-01 00:00:29",
            "played_duration": 3,
            "name": "Foreground music"
        },
        {
            "start_timestamp_utc": "2023-11-01 00:00:29",
            "end_timestamp_utc": "2023-11-01 00:00:39",
            "played_duration": 10,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-11-01 00:01:39",
            "end_timestamp_utc": "2023-11-01 00:01:56",
            "played_duration": 17,
            "name": "Background music"
        },
        {
            "start_timestamp_utc": "2023-11-01 00:02:52",
            "end_timestamp_utc": "2023-11-01 00:03:16",
            "played_duration": 24,
            "name": "Background music"
        },
        ...
    ]
}
```
````

{% endtab %}
{% endtabs %}

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

```
curl --location 'https://api-v2.acrcloud.com/api/bm-bd-projects/1234/channels/200232/unknown_results?date=20231101' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}


# Channels State

## Get the state of the channel

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/state`

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | number | The project id |
| channel\_id | number | The channel id |

#### Query Parameters

| Name        | Type   | Description                                                                                               |
| ----------- | ------ | --------------------------------------------------------------------------------------------------------- |
| timeoffset  | string | Time offset from UTC(e.g: The timeoffset of Tokyo(UTC+9) is -540, the timeoffset of Dubai(UTC+4) is -240) |
| start\_date | string | Start date(YYYYmmdd, e.g: 20210301)                                                                       |
| end\_date   | string | End date(YYYYmmdd, e.g: 20210302)                                                                         |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": {
    "total_time": 318895,
    "valid_time": 312323,
    "timeoffset": 0,
    "state_list": [
      {
        "code": 0,
        "start": "2021-03-26 00:00:00",
        "end": "2021-03-26 00:06:38",
        "duration": 398
      },
      {
        "code": 12,
        "start": "2021-03-26 00:06:38",
        "end": "2021-03-26 00:10:58",
        "duration": 260
      },
      {
        "code": 0,
        "start": "2021-03-26 00:10:58",
        "end": "2021-03-26 00:19:40",
        "duration": 522
      },
      {
        "code": 12,
        "start": "2021-03-26 00:19:40",
        "end": "2021-03-26 00:21:10",
        "duration": 90
      },
      {
        "code": 0,
        "start": "2021-03-26 00:21:10",
        "end": "2021-03-26 00:45:19",
        "duration": 1449
      },
      {
        "code": 12,
        "start": "2021-03-26 00:45:19",
        "end": "2021-03-26 01:10:54",
        "duration": 1535
      },
      {
        "code": 0,
        "start": "2021-03-26 01:10:54",
        "end": "2021-03-26 01:15:55",
        "duration": 301
      },
      {
        "code": 12,
        "start": "2021-03-26 01:15:55",
        "end": "2021-03-26 02:31:12",
        "duration": 4517
      },
      {
        "code": 0,
        "start": "2021-03-26 02:31:12",
        "end": "2021-03-26 02:56:40",
        "duration": 1528
      },
      {
        "code": 12,
        "start": "2021-03-26 02:56:40",
        "end": "2021-03-26 02:56:50",
        "duration": 10
      },
      {
        "code": 0,
        "start": "2021-03-26 02:56:50",
        "end": "2021-03-26 03:30:52",
        "duration": 2042
      },
      {
        "code": 12,
        "start": "2021-03-26 03:30:52",
        "end": "2021-03-26 03:31:01",
        "duration": 9
      },
      {
        "code": 0,
        "start": "2021-03-26 03:31:01",
        "end": "2021-03-26 04:11:00",
        "duration": 2399
      },
      {
        "code": 12,
        "start": "2021-03-26 04:11:00",
        "end": "2021-03-26 04:11:09",
        "duration": 9
      },
      {
        "code": 0,
        "start": "2021-03-26 04:11:09",
        "end": "2021-03-26 05:58:13",
        "duration": 6424
      },
      {
        "code": 0,
        "start": "2021-03-26 05:58:13",
        "end": "2021-03-26 08:00:00",
        "duration": 7307
      },
      {
        "code": 0,
        "start": "2021-03-26 08:00:00",
        "end": "2021-03-27 08:00:00",
        "duration": 86400
      },
      {
        "code": 0,
        "start": "2021-03-27 08:00:00",
        "end": "2021-03-27 22:01:26",
        "duration": 50486
      },
      {
        "code": 1,
        "start": "2021-03-27 22:01:26",
        "end": "2021-03-27 22:02:26",
        "duration": 60
      },
      {
        "code": 0,
        "start": "2021-03-27 22:02:26",
        "end": "2021-03-27 22:02:47",
        "duration": 21
      },
      {
        "code": 1,
        "start": "2021-03-27 22:02:47",
        "end": "2021-03-27 22:03:00",
        "duration": 13
      },
      {
        "code": 0,
        "start": "2021-03-27 22:03:00",
        "end": "2021-03-28 08:00:00",
        "duration": 35820
      },
      {
        "code": 0,
        "start": "2021-03-28 08:00:00",
        "end": "2021-03-29 05:46:49",
        "duration": 78409
      },
      {
        "code": 1,
        "start": "2021-03-29 05:46:49",
        "end": "2021-03-29 05:47:57",
        "duration": 68
      },
      {
        "code": 0,
        "start": "2021-03-29 05:47:57",
        "end": "2021-03-29 08:00:00",
        "duration": 7923
      },
      {
        "code": 0,
        "start": "2021-03-29 08:00:00",
        "end": "2021-03-29 16:34:54",
        "duration": 30894
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/1234/channels/295704/state?timeoffset=0&start_date=20210301&end_date=20210302' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## The details of the state code

| Code | Name        |
| ---- | ----------- |
| 0    | Running     |
| 1    | Timeout     |
| 4    | Paused      |
| 6    | Invalid URL |
| 10   | Deleted     |
| 12   | Mute        |


# Recordings

Please make sure that your channels have enabled Timemap before getting the recording.

## Get the recording of the results.

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/recordings`

This endpoint allows you to get the recordings of the results of your channels.

#### Path Parameters

| Name        | Type   | Description     |
| ----------- | ------ | --------------- |
| pid         | number | The project id. |
| channel\_id | number | The channel id. |

#### Query Parameters

| Name             | Type    | Description                                                                                 |
| ---------------- | ------- | ------------------------------------------------------------------------------------------- |
| timestamp\_utc   | string  | The start time of the recording, the format is YYYYmmddHHMMSS (for example 20210101120809). |
| played\_duration | integer | The duration of the recording(seconds).                                                     |
| record\_before   | integer | How many seconds of recording to add forward(default 0).                                    |
| record\_after    | integer | How many seconds of recording to add backwards(default 0).                                  |

#### Headers

| Name          | Type   | Description  |
| ------------- | ------ | ------------ |
| Authorization | string | Bearer token |
| Accept        | string | \*/\*        |

{% tabs %}
{% tab title="200 Get recording successfully." %}

```
```

{% endtab %}

{% tab title="404 Could not get the recording." %}

```
{    "message": "The recording is not available."    }
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/100079/channels/100123/recordings?timestamp_utc=20210601121314&played_duration=30' \
--header 'Accept: */*' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}


# Analytics

This api is only applicable to projects bound to ACRCloud Music

## Get analytics data for the last 7 days

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:project_id/analytics/results`

#### Path Parameters

| Name                                          | Type   | Description    |
| --------------------------------------------- | ------ | -------------- |
| project\_id<mark style="color:red;">\*</mark> | Number | The project id |

#### Query Parameters

| Name                                           | Type   | Description                                                                                                                                   |
| ---------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| stats\_type<mark style="color:red;">\*</mark>  | String | <p>Type of data, including date, track, artists, label, channel.</p><p>If result\_type is custom, then only include date, track, channel.</p> |
| result\_type<mark style="color:red;">\*</mark> | String | Type of result, including music, custom                                                                                                       |

#### Headers

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token     |
| Accept<mark style="color:red;">\*</mark>        | String | application/json |

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

```javascript
{
    "data": {
        "id": "ddddcbffeccc2daf603dddde4ed0dddd",
        "project_id": 1234,
        "stats_type": "date",
        "result_type": "music",
        "start_timestamp_utc": "2022-07-27 00:00:00",
        "end_timestamp_utc": "2022-08-02 23:59:59",
        "results": [
            {
                "date": "2022-07-27",
                "play_time": 461059,
                "plays": 4249,
                "rank": 1
            },
            {
                "date": "2022-07-28",
                "play_time": 479187,
                "plays": 4434,
                "rank": 2
            },
            {
                "date": "2022-07-29",
                "play_time": 466170,
                "plays": 4211,
                "rank": 3
            },
            {
                "date": "2022-07-30",
                "play_time": 451512,
                "plays": 3863,
                "rank": 4
            },
            {
                "date": "2022-07-31",
                "play_time": 479693,
                "plays": 4174,
                "rank": 5
            },
            {
                "date": "2022-08-01",
                "play_time": 468885,
                "plays": 4256,
                "rank": 6
            },
            {
                "date": "2022-08-02",
                "play_time": 466158,
                "plays": 4091,
                "rank": 7
            }
        ]
    }
}
```

{% endtab %}
{% endtabs %}

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

```shell
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-bd-projects/1234/analytics/results?result_type=music&stats_type=date' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
```

{% endtab %}
{% endtabs %}


# User Reports

## Insert user results

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-bd-projects/:pid/channels/:channel_id/user-reports`

This endpoint allows you to insert the results just like in Timemap or UCF

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | string | The project id |
| channel\_id | string | The channel id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Accept        | string | application/json |
| Authorization | string | Bearer token     |
| Content-Type  | string | application/json |

#### Request Body

| Name                    | Type   | Description                                                                                                                        |
| ----------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------- |
| data                    | array  | Result list (\[result1, result2, result3...])                                                                                      |
| result.from             | string | api                                                                                                                                |
| result.title            | string | The title of the result                                                                                                            |
| result.timeoffset       | number | UTC time offsets (For example, UK time is UTC + 00:00, the timeoffset is 0; Hong Kong time is UTC + 08:00, the timeoffset is -480) |
| result.start\_timestamp | string | YYYY-mm-dd HH:MM:SS (For example, 2021-02-01 12:13:14), it is your Local Time.                                                     |
| result.end\_timestamp   | string | YYYY-mm-dd HH:MM:SS (For example, 2021-02-01 12:15:26), it is your Local Time.                                                     |
| result.user\_defined    | object | Other fields of the result (For example, {"artists": "xxx", "album": "xxx", "isrc": "xxx"})                                        |

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

```
{
  "data": {
    "id": 984587,
    "result": {
      "start_timestamp_utc": "2021-05-25 02:35:42",
      "end_timestamp_utc": "2021-05-25 02:36:25",
      "title": "xxx",
      "artist": "",
      "album": "",
      "acrid": "null",
      "duration": 43,
      "played_duration": 43,
      "monitor_type": "",
      "result_type": "custom",
      "from": "api-report",
      "raw_metadata": {
        "title": "xxx",
        "artists": "xxx",
        "album": "xxx"
      },
      "start_timestamp_local": "2021-05-25 10:35:42",
      "end_timestamp_local": "2021-05-25 10:36:25"
    }
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-bd-projects/179/channels/100251/user-reports' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
--header 'Content-Type: application/json' \
--data-raw '{"data":[{"from": "api", "title": "xxxx", "timeoffset": 0, "start_timestamp": "2021-02-01 12:13:14", "end_timestamp": "2021-02-01 12:15:26", "user_defined": {"artists": "xxx", "album": "xxx"}}]}'
```

{% endtab %}
{% endtabs %}


# Historical Results Projects

## Create a project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/bm-hist-projects`

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |
| Content-Type  | string | application/json |

#### Request Body

| Name          | Type   | Description                        |
| ------------- | ------ | ---------------------------------- |
| region        | string | eu-west-1,us-west-2,ap-southeast-1 |
| name          | string | The project name                   |
| stations      | array  | Station ids array                  |
| project\_type | string | radio,tv                           |

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

```
{
  "data": {
    "uid": 1,
    "name": "tv",
    "region": "eu-west-1",
    "access_key": "xxxxxxxxxxxxxxxxxxxxxxx",
    "state": 1,
    "months": [],
    "total_price": 0,
    "total_months": 0,
    "unit_price": 50,
    "payment_status": 0,
    "paid_amount": 0,
    "paid_at": "",
    "report_id": 0,
    "updated_at": "2026-05-08 09:20:45",
    "created_at": "2026-05-08 09:20:45",
    "id": 1,
    "total_channels": 0,
    "total_resutls": 0,
    "total_durations": 0,
    "monthly_details": {},
    "project_type": "tv"
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/bm-hist-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}' \
--header 'Content-Type: application/json' \
--data-raw '{"region":"eu-west-1","name":"test","project_type":"tv","stations":[]}'
```

{% endtab %}
{% endtabs %}

## List the projects

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-hist-projects`

#### Query Parameters

| Name      | Type   | Description                        |
| --------- | ------ | ---------------------------------- |
| region    | string | eu-west-1,us-west-2,ap-southeast-1 |
| page      | number | Page number                        |
| per\_page | number | Items per page                     |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": [
    {
      "id": 1,
      "uid": 1,
      "name": "tv2",
      "region": "eu-west-1",
      "access_key": "xxxxxxxxxxxxxxxxxxxxx",
      "state": 1,
      "months": [],
      "total_price": 0,
      "total_months": 0,
      "unit_price": 50,
      "payment_status": 0,
      "paid_amount": 0,
      "paid_at": "",
      "report_id": 0,
      "updated_at": "2026-05-08 09:20:45",
      "created_at": "2026-05-08 09:20:45",
      "total_channels": 0,
      "total_resutls": 0,
      "total_durations": 0,
      "monthly_details": {},
      "project_type": "tv"
    }
  ],
  "links": {
    "first": "https://api-v2.acrcloud.com/api/bm-hist-projects?page=1",
    "last": "https://api-v2.acrcloud.com/api/bm-hist-projects?page=1",
    "prev": null,
    "next": null
  },
  "meta": {
    "current_page": 1,
    "from": 1,
    "last_page": 1,
    "path": "https://api-v2.acrcloud.com/api/bm-hist-projects",
    "per_page": "20",
    "to": 1,
    "total": 1
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-hist-projects?region=eu-west-1&page=1&per_page=20' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}

## Get a project

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-hist-projects/:id`

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| id   | number | The project id |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": {
    "id": 1,
    "uid": 1,
    "name": "tv2",
    "region": "eu-west-1",
    "access_key": "xxxxxxxxxxxxxxxxxxxx",
    "state": 1,
    "months": [],
    "total_price": 0,
    "total_months": 0,
    "unit_price": 50,
    "payment_status": 0,
    "paid_amount": 0,
    "paid_at": "",
    "report_id": 0,
    "updated_at": "2026-05-08 09:20:45",
    "created_at": "2026-05-08 09:20:45",
    "total_channels": 0,
    "total_resutls": 0,
    "total_durations": 0,
    "monthly_details": {},
    "project_type": "tv"
  }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-hist-projects/1' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}


# Channels Results

## Get results of a channel on a specified day

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/bm-hist-projects/:pid/channels/:channel_id/results`

#### Path Parameters

| Name        | Type   | Description    |
| ----------- | ------ | -------------- |
| pid         | number | The project id |
| channel\_id | number | The channel id |

#### Query Parameters

| Name | Type   | Description                                                                             |
| ---- | ------ | --------------------------------------------------------------------------------------- |
| date | string | Get the results for a certain day you specified. The format is YYYYmmdd (E.g. 20250221) |

#### Headers

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| Authorization | string | Bearer token     |
| Accept        | string | application/json |

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

```
{
  "data": [
    {
      "status": {
        "msg": "Success",
        "code": 0,
        "version": "1.0"
      },
      "result_type": 0,
      "metadata": {
        "type": "historical",
        "timestamp_utc": "2025-02-21 10:20:25",
        "played_duration": 117,
        "record_timestamp": "20250221102025",
        "music": [
          {
            "title": "What You Know Bout Love",
            "artists": [
              {
                "name": "Pop Smoke"
              }
            ],
            "album": {
              "name": "Shoot For The Stars Aim For The Moon"
            },
            "release_date": "2020-07-03",
            "duration_ms": 160000,
            "score": 100,
            "acrid": "dda6ca5475ba126aa02b88ebe9b9b4cd",
            "external_ids": {
              "isrc": [
                "USUM72013339"
              ],
              "upc": [
                "00602507456573"
              ]
            }
          }
        ]
      }
    }
  ]
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/bm-hist-projects/1/channels/243253/results?date=20250221' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer {your token}'
```

{% endtab %}
{% endtabs %}


# METADATA


# Music (Broadcast Monitoring with Broadcast Database)

Example of JSON result with ACRCloud Music bucket in Broadcast Database of Broadcast Monitoring service.

```bash
{
  "status": {
    "msg": "Success",
    "code": 0,
    "version": "1.0"
  },
  "result_type": 0,
  "metadata": {
    "type": "delay",
    "timestamp_utc": "2020-07-06 04:38:43",
    "played_duration": 73,
    "music": [
      {
        "album": {
          "name": "Wish"
        },
        "play_offset_ms": 154600,
        "sample_begin_time_offset_ms": 0,
        "lyrics": {
          "copyrights": [
            "Universal Music Publishing Group"
          ]
        },
        "contributors": {
          "composers": [
            "Perry Bamonte",
            "Porl Thompson",
            "Boris Williams",
            "Simon Gallup",
            "Robert Smith"
          ],
          "lyricists": [
            "Boris Williams",
            "Porl Thompson",
            "Perry Bamonte",
            "Robert James Smith",
            "Simon Johnathon Gallup"
          ]
        },
        "title": "Friday I'm In Love ( LP Version )",
        "result_from": 3,
        "release_date": "1992-04-07",
        "sample_end_time_offset_ms": 9120,
        "genres": [
          {
            "name": "Pop"
          }
        ],
        "label": "Elektra Records",
        "db_end_time_offset_ms": 154540,
        "score": 100,
        "db_begin_time_offset_ms": 145420,
        "artists": [
          {
            "name": "The Cure"
          }
        ],
        "duration_ms": 214400,
        "external_ids": {
          "isrc": [
            "USEE10180267",
            "USEE19200008",
            "GBALB9200002"
          ],
          "iswc": [
            "T0100954037"
          ],
          "upc": [
            "075596130967",
            "075596211765",
            "00731451326127"
          ]
        },
        "acrid": "4b10ecaa3dbcc60e9f7924919722e133",
        "external_metadata": {
          "musicbrainz": [
            {
              "track": {
                "id": "59294de3-aaff-4d2d-bdc4-cbfe91de892e"
              }
            }
          ],
          "spotify": [
            {
              "album": {
                "name": "Wish",
                "id": "6tCOXpiN1FvDBl0eT6WtG3"
              },
              "track": {
                "name": "Friday I'm In Love",
                "id": "20CNpCKq1oTdvekXaboyeq"
              },
              "artists": [
                {
                  "name": "The Cure",
                  "id": "7bu3H8JO7d0UbMoVzbo70s"
                }
              ]
            }
          ],
          "deezer": [
            {
              "album": {
                "name": "Wish",
                "id": "1344846"
              },
              "track": {
                "name": "Friday I'm In Love ( LP Version )",
                "id": "14611440"
              },
              "artists": [
                {
                  "name": "The Cure",
                  "id": "381"
                }
              ]
            }
          ],
          "youtube": [
            {
              "vid": "mGgMZpGYiy8"
            }
          ]
        }
      }
    ],
    "record_timestamp": "20200706043843"
  }
}
```

### Metadata fields

| Name                              | Description                                                                                        |
| --------------------------------- | -------------------------------------------------------------------------------------------------- |
| music                             | Music fields                                                                                       |
| acrid                             | ACRCloud unique identifier                                                                         |
| timestamp\_utc                    | Server time of sending results, Timestamp of the song started for custom monitoring, UTC time zone |
| title                             | Track title                                                                                        |
| album                             | Album fields                                                                                       |
| id                                | Identifier of the artists , album or 3rd parties fields                                            |
| name                              | Name of the artists or album                                                                       |
| artists                           | Artists fields                                                                                     |
| duration\_ms                      | Duration of the track in millisecond                                                               |
| play\_offset\_ms                  | The time position of the audio/song being played (millisecond)                                     |
| external\_ids                     | External standard code                                                                             |
| isrc                              | ISRC code                                                                                          |
| upc                               | UPC code                                                                                           |
| external\_metadata                | External 3rd party IDs and metadata                                                                |
| track                             | Track fields                                                                                       |
| genres                            | Genres fields                                                                                      |
| label                             | Music label name                                                                                   |
| release\_date                     | Release data of the track, format:YYYY-MM-DD                                                       |
| spotify                           | Spotify fields                                                                                     |
| deezer                            | Deezer fields                                                                                      |
| lyricfind                         | LyricFind fields                                                                                   |
| lfid                              | LyricsFind's lyric ID                                                                              |
| youtube                           | YouTube fields                                                                                     |
| vid                               | Youtube video ID                                                                                   |
| musicbrainz                       | MusicBrainz Identifier - MBID                                                                      |
| iswc                              | ISWC - International Standard Musical Work Code                                                    |
| \*db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)                            |
| \*db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                                  |
| \*sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond)              |
| \*sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)                    |
| \*played\_duration                | Actual duration of the track played in the streams for Broadcast Monitoring service, in second     |
| score                             | Match confidence score. Range: 70 - 100                                                            |
| lyrics                            | Lyrics related metadata                                                                            |
| +copyrights                       | Publishers or copyright organizations for lyrics                                                   |
| +contributors                     | Contributor information for this track                                                             |
| +composers                        | Composers of the song                                                                              |
| +lyricists                        | Writers of the lyrics                                                                              |
| language                          | Language of the song, ISO 639-1 codes                                                              |
| +work                             | Publishing metadata fields for works                                                               |
| +ISWC                             | ISWC code                                                                                          |
| +name                             | Name of the work                                                                                   |
| +creators                         | The creator of the work                                                                            |
| +ipi                              | IPI code for the party                                                                             |

{% hint style="info" %}
**Please note: Only&#x20;*****ACRID,*** ***Track Title, Artists Name*****&#x20;and&#x20;*****Album Name*****&#x20;fields are required, other fields are optional.**

\* fields are visible in Broadcast Monitoring service only, if you want to use these fields in recognition service, please contact us.\
\
+fields are visible upon request, please contact us if you need those fields.
{% endhint %}


# Custom Files

An example of custom-defined metadata for Audio & Video Recognition, Broadcast Monitoring, Hybrid Recognition and Offline Recognition projects.

### JSON structure

```bash
{
    "custom_files": [
        {
            "bucket_id": "51",
            "title": "You are beautiful",
            "artist": "James",
            "acrid": "5343bc191634b042622bf474ed46121a",
            "audio_id": "3"
        }
    ]
}
```

### Metadata fields

| Name                              | Description                                                                           |
| --------------------------------- | ------------------------------------------------------------------------------------- |
| custom\_files                     | Custom uploaded file fields                                                           |
| arcid                             | ACRCloud unique identifier                                                            |
| title                             | File name                                                                             |
| audio\_id                         | User defined identifier                                                               |
| play\_offset\_ms                  | Position of the recognition in the file if the file was playing (millisecond)         |
| \*db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)               |
| \*db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                     |
| \*sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond) |
| \*sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)       |

{% hint style="info" %}
***\* fields are visible in Broadcast Monitoring service only, if you want to use these fields in recognition service, please contact us.***

**Please note: Only&#x20;*****Title, ARCID, Audio\_ID*****&#x20;are required fields.**
{% endhint %}


# File Scanning

## Create a FS container

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/fs-containers`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_token |

#### Request Body

| Name                                          | Type   | Description                                                                                                                                                               |
| --------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name<mark style="color:red;">\*</mark>        | String | Your container name                                                                                                                                                       |
| region<mark style="color:red;">\*</mark>      | String | eu-west-1,us-west-2,ap-southeast-1                                                                                                                                        |
| audio\_type<mark style="color:red;">\*</mark> | String | <p>linein or recorded. Default is linein<br>linein: Audio of original file or stream without noise</p><p>recorded: Audio captured via microphone or noisy audio files</p> |
| buckets<mark style="color:red;">\*</mark>     | Array  | <p>The project detects content from the buckets. The format is bucket id/name array. For example:<br>\[8881,8882,"ACRCloud Music"]<br></p>                                |
| engine<mark style="color:red;">\*</mark>      | Number | <p>1:Audio Fingerprinting<br>2:Cover Songs<br>3:Audio Fingerprinting & Cover songs<br>4:Speech to Text<br>5: AI Music Detection</p>                                       |
| policy<mark style="color:red;">\*</mark>      | JSON   | <p>{"type":"traverse", "interval":0, "rec\_length:10}<br>or<br>{"type":"points", "points":3}</p>                                                                          |
| callback\_url                                 | String | Result callback url                                                                                                                                                       |
| deepright                                     | Bool   | <p>0 or 1<br>0: disable the derivative works detection<br>1: enable the derivative works detection</p>                                                                    |
| music\_detection                              | Bool   | <p>0 or 1<br>0: disable music/speech detection<br>1: enable music/speech detection</p>                                                                                    |
| ai\_detection                                 | Bool   | <p>0 or 1<br>0: disable ai detection<br>1: enable ai detection</p>                                                                                                        |

{% tabs %}
{% tab title="201: Created " %}

````json
```json
{
    "data": {
        "id": 123456,
        "uid": 123,
        "region": "eu-west-1",
        "name": "container name",
        "buckets": [
            {
                "id": 23,
                "name": "ACRCloud Music",
                "type": "ACRCloudFile",
                "metadata_template": null
            }
        ],
        "audio_type": "linein",
        "num": 1,
        "size": 14,
        "policy": {
            "type": "traverse",
            "interval": 0,
            "rec_length": 10,
            "ai_detection": 1,
            "deepright":true
        },
        "engine": 1,
        "callback_url": null,
        "created_at": "2023-04-28T07:53:40.000000Z",
        "updated_at": "2023-04-28T07:53:40.000000Z"
    }
}
```
````

{% endtab %}
{% endtabs %}

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

```python
import requests

url = "https://api-v2.acrcloud.com/api/fs-containers"

payload={
  "name":"test", 
  "region":"eu-west-1", 
  "buckets":[8881,8882,"ACRCloud Music"],
  "audio_type":"linein",
  "engine":1,
  "policy":{"type":"traverse", "interval":0, "rec_length":10}
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}
{% endtabs %}

## Get all the containers

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/fs-containers`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_token |
| Content-Type                                    | String | application/json   |

#### Query Parameters

| Name   | Type   | Description                                                                          |
| ------ | ------ | ------------------------------------------------------------------------------------ |
| region | String | <p>list the continers in the region.<br>eu-west-1<br>us-west-2<br>ap-southeast-1</p> |
| name   | String | search by name                                                                       |

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

{% endtab %}
{% endtabs %}

## Update a container

<mark style="color:blue;">`PUT`</mark> `https://api-v2.acrcloud.com/api/fs-containers/:container_id`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_token |
| Content-Type                                    | String | application/json   |

#### Request Body

| Name                   | Type   | Description                                                                                                                                                               |
| ---------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| name                   | String | Your container name                                                                                                                                                       |
| audio\_type            | String | <p>linein or recorded. Default is linein<br>linein: Audio of original file or stream without noise</p><p>recorded: Audio captured via microphone or noisy audio files</p> |
| buckets                | Array  | <p>The project detects content from the buckets. The format is bucket id/name array. For example:<br>\[8881,8882,"ACRCloud Music"]<br></p>                                |
| engine                 | Number | <p>1:Audio Fingerprinting<br>2:Cover Songs<br>3:Audio Fingerprinting & Cover songs<br>4:Speech to Text</p>                                                                |
| policy                 | JSON   | <p>{"type":"traverse", "interval":0, "rec\_length:10}<br>or<br>{"type":"points", "points":3}</p>                                                                          |
| callback\_url          | String | Result webhook url                                                                                                                                                        |
| callback\_sign\_secret | JSON   | {"kid":"xx","secret":"xxxx"}                                                                                                                                              |
| deepright              | Bool   | <p>0 or 1<br>0: disable the derivative works detection<br>1: enable the derivative works detection</p>                                                                    |
| music\_detection       | Bool   | <p>0 or 1<br>0: disable music/speech detection<br>1: enable music/speech detection</p>                                                                                    |
| ai\_detection          | Bool   | <p>0 or 1<br>0: disable ai detection<br>1: enable ai detection</p>                                                                                                        |

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

```python
import requests

url = "https://api-v2.acrcloud.com/api/fs-containers/123456"

payload={
  "name":"test", 
  "buckets":["ACRCloud Music"],
  "audio_type":"linein",
  "engine":1,
  "policy":{"type":"traverse", "interval":0, "rec_length":10},
  "deepright":1
}
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

response = requests.(url, headers=headers, json=payload)

print(response.text)
```

{% endtab %}
{% endtabs %}

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

````json
```json
{
    "data": {
        "id": 123456,
        "uid": 123,
        "region": "eu-west-1",
        "name": "container name",
        "buckets": [
            {
                "id": 23,
                "name": "ACRCloud Music",
                "type": "ACRCloudFile",
                "metadata_template": null
            }
        ],
        "audio_type": "linein",
        "num": 1,
        "size": 14,
        "policy": {
            "type": "traverse",
            "interval": 0,
            "rec_length": 10,
            "ai_detection": 1,
            "deepright":true
        },
        "engine": 1,
        "callback_url": null,
        "created_at": "2023-04-28T07:53:40.000000Z",
        "updated_at": "2023-04-28T07:53:40.000000Z"
    }
}
```
````

{% endtab %}
{% endtabs %}

## Show one container

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/fs-containers/:container_id`

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_token |
| Content-Type                                    | String | application/json   |

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

```
{
    "data": {
        "id": 123456,
        "uid": 123,
        "region": "eu-west-1",
        "name": "container name",
        "buckets": [
            {
                "id": 23,
                "name": "ACRCloud Music",
                "type": "ACRCloudFile",
                "metadata_template": null
            }
        ],
        "audio_type": "linein",
        "num": 1,    //the number of the files in the container
        "size": 14,  //the total duration(seconds) of the uploaded files in this container
        "policy": {
            "type": "traverse",
            "interval": 0,
            "rec_length": 10
        },
        "engine": 1,
        "callback_url": null,
        "created_at": "2023-04-28T07:53:40.000000Z",
        "updated_at": "2023-04-28T07:53:40.000000Z"
    }
}
```

{% endtab %}
{% endtabs %}

## Delete one container

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/fs-containers/:container_id`

#### Path Parameters

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| container\_id<mark style="color:red;">\*</mark> | Number | The Container ID |

#### Headers

| Name                                            | Type   | Description        |
| ----------------------------------------------- | ------ | ------------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer your\_token |
| Content-Type                                    | String | application/json   |

{% tabs %}
{% tab title="204: No Content " %}

```
```

{% endtab %}
{% endtabs %}


# FsFiles

## List the files and results

<mark style="color:blue;">`GET`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files`

This endpoint will not show the youtube channels/playlists results.\
Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

#### Path Parameters

| Name          | Type   | Description      |
| ------------- | ------ | ---------------- |
| container\_id | number | The container id |

#### Query Parameters

| Name         | Type   | Description                                                                                                                                   |
| ------------ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------- |
| page         | number | The page number                                                                                                                               |
| per\_page    | number | The results number per page                                                                                                                   |
| search       | string | Search by name or URI                                                                                                                         |
| with\_result | number | <p>1:list the files with results.<br>0:will not list the results (default)</p>                                                                |
| state        | String | <p>0:processing<br>1:Ready (Recognize results from a file.)<br>-1: No results (No results were recognized from the file.)<br>-2,-3: Error</p> |

#### Headers

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

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

```
curl --location --request GET 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:your_container_id/files?page=1&per_page=20' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YourAccessToken'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:your_container_id/files?page=1&per_page=20"

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

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

print(response.text)
```

{% endtab %}
{% endtabs %}

## Response descriptions

<table><thead><tr><th>Field Name</th><th width="100">Type</th><th>Description</th></tr></thead><tbody><tr><td>id</td><td>String</td><td>The id of the file</td></tr><tr><td>uid</td><td>Integer</td><td>The id of the acrcloud console account</td></tr><tr><td>cid</td><td>Integer</td><td>The id of the fs container</td></tr><tr><td>name</td><td>String</td><td>The name of the file</td></tr><tr><td>duration</td><td>Integer</td><td>The duration of the audio file</td></tr><tr><td>uri</td><td>String</td><td>The uri of the file.<br>if the data_type is audio/fingerprint<br><strong>format: audio:file_name</strong><br>if the data_type is audio_url<br><strong>format: audio_url:url_path</strong><br>if the data_type is platforms, such as youtube, twitter, tiktok...<br><strong>format: platform:video:platform_id</strong><br>youtube:video:7wtfhZwyrcc</td></tr><tr><td>data_type</td><td>String</td><td>audio: upload the audio file to the container<br>fingerprint: upload the acrcloud fingerprint to the container<br>audio_url: upload the http/https/ftp url to the container<br>platforms: upload the platform url, such as <a href="https://www.youtube.com/watch?v=t3MWVt4GKy8">https://www.youtube.com/watch?v=t3MWVt4GKy8</a></td></tr><tr><td>engine</td><td>Integer</td><td>What engine was used to recognize this file?<br>1: audio fingerprint<br>2: cover song identification<br>3: audio fingerprint &#x26; cover song identification<br>4: Speech recognition (STT)<br>5: AI Music Detection</td></tr><tr><td>count</td><td>Integer</td><td>This field is temporarily not in use.</td></tr><tr><td>state</td><td>Integer</td><td>Current state of the document:<br>0:processing<br>1:Ready (Recognize results from a file.)<br>-1: No results (No results were recognized from the file.)<br>-2,-3: Error</td></tr><tr><td>total</td><td>Integer</td><td>This field is temporarily not in use.<br>The total sub-files does this file contains</td></tr><tr><td>results</td><td>JSON</td><td><p>{<br>"music":[], //audio fingerprint music results<br>"cover_songs":[], // cover songs results<br>"custom_files":[], // audio fingerprint custom files matched results<br>"speech":[], //STT results<br>"music_speech":[] // music/speech detection results.</p><p>"ai_detection":[] // AI music detection results.<br>}</p></td></tr><tr><td>created_at</td><td>String</td><td>The creation time(UTC+0) of the file</td></tr><tr><td>updated_at</td><td>String</td><td>The update time(UTC+0) of the file</td></tr><tr><td>deepright</td><td>Bool</td><td>This field indicates whether Derivative Works Detection is enabled.</td></tr></tbody></table>

{% tabs %}
{% tab title="200 Successfully retrieved." %}

```
{
    "data":[
        {
            "id":"fd0cbc13-bb69-41ed-abbb-1ed6f25c3b02",
            "uid":19,
            "cid":10005,
            "name":"Camilo - Millones (Official Video)",
            "duration":222,
            "uri":"youtube:video:krP539YBF7U",
            "data_type":"youtube",
            "engine":1,
            "count":1,
            "state":1,
            "created_at":"2021-04-08T10:23:29.000000Z",
            "updated_at":"2021-04-23T02:58:04.000000Z",
            "total":1,
            "deepright":False,  //True:enabled the "Derivative Works Detection"
            "music_detected":1, //0:Unknown, 1: Music or Music with speech, 2: Others
            "results":{
               "music_speech": [
                    {
                        "start": 0,
                        "end": 222,
                        "label": "m" //m:Music, ms:Music & Speech, s:Speech, o:Others
                    }
                ],
                "ai_detection": [
                   {
                     "start": 0,
                     "end": 249.74,
                     "prediction": "human",
                     "likely_source": "Human",
                     "ai_probability": 26.97,
                     "duration": 249.74,
                     "source_probabilities": [
                          {
                              "source": "suno",
                              "probability": 8.3
                          },
                          {
                              "source": "udio",
                              "probability": 9
                          },
                          {
                               "source": "sonauto",
                               "probability": 5
                          },
                          {
                               "source": "mureka",
                               "probability": 5.3
                          },
                          {
                               "source": "riffusion",
                               "probability": 5.3
                          }
                     ]
                  }
                ],
                "music":[
                    {
                        "offset":0,
                        "played_duration":220,
                        "type":"traverse",
                        "result":{
                            "album":{
                                "name":"Mis Manos"
                            },
                            "play_offset_ms":19780,
                            "sample_begin_time_offset_ms":0,
                            "contributors":{
                                "composers":[
                                    "Camilo Echeverry",
                                    "Édgar Barrera"
                                ],
                                "lyricists":[
                                    "Camilo Echeverry",
                                    "Édgar Barrera"
                                ]
                            },
                            "title":"Millones",
                            "result_from":3,
                            "release_date":"2021-03-04",
                            "sample_end_time_offset_ms":9440,
                            "genres":[
                                {
                                    "name":"Latin Pop"
                                }
                            ],
                            "label":"SME - Sony Music Latin",
                            "db_end_time_offset_ms":19300,
                            "score":100,
                            "db_begin_time_offset_ms":9860,
                            "artists":[
                                {
                                    "name":"Camilo"
                                }
                            ],
                            "duration_ms":221000,
                            "external_ids":{
                                "isrc":"USSD12100051",
                                "upc":"886449088867"
                            },
                            "acrid":"300f34d92ec1f3a7397bb2bb9cddf884",
                            "external_metadata":{
                                "spotify":{
                                    "album":{
                                        "name":"Mis Manos"
                                    },
                                    "track":{
                                        "name":"Millones",
                                        "id":"3YAnNBdk0uHyakXXzMbNJq"
                                    },
                                    "artists":[
                                        {
                                            "name":"Camilo"
                                        }
                                    ]
                                },
                                "deezer":{
                                    "album":{
                                        "name":""
                                    },
                                    "track":{
                                        "name":"Millones",
                                        "id":"1260566282"
                                    },
                                    "artists":[
                                        {
                                            "name":"Camilo"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        },
        {
            "id":"5c2cfaa2-6024-4775-ac24-1aa7b4786c86",
            "uid":19,
            "cid":10005,
            "name":"Lil Tjay - Love Hurts (Feat. Toosii) [Official Video]",
            "duration":247,
            "uri":"youtube:video:V-IDVYH3YjA",
            "data_type":"youtube",
            "engine":1,
            "count":1,
            "state":1,
            "created_at":"2021-04-08T08:26:55.000000Z",
            "updated_at":"2021-04-23T02:58:04.000000Z",
            "total":1,
            "music_detected":1
            "results":{
                "music_speech": [
                    {
                        "start": 0,
                        "end": 247,
                        "label": "m"
                    }
                ],
                "music":[
                    {
                        "offset":14,
                        "played_duration":5,
                        "type":"traverse",
                        "result":{
                            "album":{
                                "name":"my ex called"
                            },
                            "play_offset_ms":6440,
                            "sample_begin_time_offset_ms":4260,
                            "title":"my ex called",
                            "result_from":3,
                            "release_date":"2020-02-21",
                            "sample_end_time_offset_ms":8860,
                            "label":"Thrill$",
                            "db_end_time_offset_ms":4600,
                            "score":100,
                            "db_begin_time_offset_ms":0,
                            "artists":[
                                {
                                    "name":"Thrill$"
                                }
                            ],
                            "duration_ms":168920,
                            "external_ids":{
                                "isrc":"QZJG52083365",
                                "upc":"194923628486"
                            },
                            "acrid":"269e27604f4be4c3167fc3751f5551c3",
                            "external_metadata":{
                                "deezer":{
                                    "album":{
                                        "name":""
                                    },
                                    "track":{
                                        "name":"Havit",
                                        "id":"1098021672"
                                    },
                                    "artists":[
                                        {
                                            "name":"Of_mannyg"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    {
                        "offset":24,
                        "played_duration":14,
                        "type":"traverse",
                        "result":{
                            "album":{
                                "name":"Lost Files"
                            },
                            "play_offset_ms":5340,
                            "sample_begin_time_offset_ms":4080,
                            "title":"In the Streets",
                            "result_from":1,
                            "release_date":"2020-10-26",
                            "sample_end_time_offset_ms":9260,
                            "label":"Hitta Huncho",
                            "db_end_time_offset_ms":5180,
                            "score":100,
                            "db_begin_time_offset_ms":0,
                            "artists":[
                                {
                                    "name":"Hitta Huncho"
                                }
                            ],
                            "duration_ms":160940,
                            "external_ids":{
                                "isrc":"TCAFE2056515",
                                "upc":"859742903298"
                            },
                            "acrid":"e63ee358a9357a1e181cd8ce858d78fd",
                            "external_metadata":{
                                "deezer":{
                                    "album":{
                                        "name":""
                                    },
                                    "track":{
                                        "name":"In the Streets",
                                        "id":"1131507852"
                                    },
                                    "artists":[
                                        {
                                            "name":"Hitta Huncho"
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    {
                        "offset":30,
                        "played_duration":209,
                        "type":"traverse",
                        "result":{
                            "album":{
                                "name":"Destined 2 Win"
                            },
                            "play_offset_ms":25880,
                            "sample_begin_time_offset_ms":0,
                            "title":"Love Hurts",
                            "result_from":1,
                            "release_date":"2021-04-02",
                            "sample_end_time_offset_ms":8200,
                            "genres":[
                                {
                                    "name":"Hip Hop"
                                }
                            ],
                            "label":"Columbia",
                            "db_end_time_offset_ms":24100,
                            "score":100,
                            "db_begin_time_offset_ms":15900,
                            "artists":[
                                {
                                    "name":"Lil Tjay"
                                }
                            ],
                            "duration_ms":222100,
                            "external_ids":{
                                "isrc":"USSM12101539",
                                "upc":"886449173587"
                            },
                            "acrid":"d981bc8a8a55b06d15d5ea0f4957873c",
                            "external_metadata":{
                                "spotify":{
                                    "album":{
                                        "name":"Destined 2 Win"
                                    },
                                    "track":{
                                        "name":"Love Hurts (feat. Toosii)",
                                        "id":"2ULQtFHTzUK0DqcqWUlXxw"
                                    },
                                    "artists":[
                                        {
                                            "name":"Lil Tjay"
                                        },
                                        {
                                            "name":"Toosii"
                                        }
                                    ]
                                }
                            }
                        }
                    }
                ]
            }
        }
    ],
    "links":{
        "first":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files?page=1",
        "last":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files?page=1",
        "prev":null,
        "next":null
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":1,
        "path":"https://ap-api-v2.acrcloud.com/api/fs-containers/10005/files",
        "per_page":"20",
        "to":2,
        "total":2
    }
}
```

{% endtab %}
{% endtabs %}

## Upload a file or platform web URL

<mark style="color:green;">`POST`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files`

Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

#### Path Parameters

| Name                                            | Type   | Description      |
| ----------------------------------------------- | ------ | ---------------- |
| container\_id<mark style="color:red;">\*</mark> | number | The container id |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token |

#### Request Body

| Name                                         | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| -------------------------------------------- | ------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| file                                         | object | The audio or fingerprint file, The audio/fingerprint file size needs to be less than 500MB.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| data\_type<mark style="color:red;">\*</mark> | string | <p><em><strong>audio</strong></em>: Upload an audio file<br>fingerprint: Upload a fingerprint file<br><em><strong>platforms</strong></em>: platforms url. Currently, supported platforms are Youtube,Twitter, Tiktok, Vimeo, Brightcove...etc. You can post the platform's web url to this endpoint.<br><em><strong>audio\_url</strong></em>: Downloadable audio url.<br><em><strong>isrc</strong></em>: Supports posting ISRC data to the container. This data type is available when the container has derivative works detection or AI music detection enabled.</p>                                                                                                                                                                                                                                                           |
| url                                          | string | <p>If the datatype is <strong>platforms</strong> or <strong>audio\_url,</strong> you need to add this parameter.<br>For example:<br><a href="https://www.youtube.com/watch?v=d_xYl5hpiRs"><https://www.youtube.com/watch?v=d_xYl5hpiRs></a><br><a href="https://twitter.com/i/status/1439937773885079552"><https://twitter.com/i/status/1439937773885079552></a><br><a href="https://www.facebook.com/mlb/videos/1009106336326140"><https://www.facebook.com/mlb/videos/1009106336326140></a><br><a href="https://www.tiktok.com/@pepiyearsong/video/6954003071336779009"><https://www.tiktok.com/@pepiyearsong/video/6954003071336779009></a><br><a href="https://www.instagram.com/p/CQz5NlrDeXW/"><https://www.instagram.com/p/CQz5NlrDeXW/></a><br><a href="https://vimeo.com/54763818"><https://vimeo.com/54763818></a></p> |
| name                                         | string | If you do not pass this parameter, we will use the file path or url path as the file name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| isrc                                         | string | If you set the data\_type is isrc, then this field input the value of the isrc.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |

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

```
{
    "data": {
        "uid": 19,
        "cid": 10005,
        "name": "886443683402_US4D80623007.lo",
        "duration": 159.56,
        "uri": "audio:886443683402_US4D80623007.lo",
        "data_type": "audio",
        "method": 1,
        "count": 0,
        "state": 0,
        "updated_at": "2021-04-23T07:33:21.000000Z",
        "created_at": "2021-04-23T07:33:21.000000Z",
        "id": "9d0f2c36-0265-46c2-b3e4-c0c2d0b9eb92",
        "total": 1
    }
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl (audio)" %}

```
curl --location --request POST 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--form 'file=@"/Users/olym/Downloads/886443683402_US4D80623007.mp3"' \
--form 'data_type="audio"'
```

{% endtab %}

{% tab title="Curl (platforms)" %}

```
curl --location --request POST 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"data_type":"platforms", "url":"https://twitter.com/i/status/1439937773885079552"}'
```

{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" lineNumbers="true" %}

```python
import requests

url = "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files"

payload={'data_type': 'audio'}
files=[
  ('file',('886443683402_US4D80623007.mp3',open('886443683402_US4D80623007.mp3','rb'),'application/octet-stream'))
]
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token'
}

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

{% endcode %}
{% endtab %}

{% tab title="Python(platforms)" %}

```
import requests

url = "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files"

payload={
    'data_type': 'platforms',
    'url':'https://www.youtube.com/watch?v=d_xYl5hpiRs'
}

headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer token',
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, json=payload)
```

{% endtab %}

{% tab title="PHP" %}

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/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('886443683402_US4D80623007.lo'),'data_type' => 'fingerprint'),
  CURLOPT_HTTPHEADER => array(
    'Accept: application/json',
    'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI2IiwianRpIjoiZGMzNjIyOThhMDAyN2NmZDMzZGU3MjBhYThhY2I0MTgyMzJhN2I5ZTA4MzdjNTI0M2UxODIxYzcwMTA5NDIwZTg0ZGJhY2Q4YTRhZWM0YzAiLCJpYXQiOjE2MTg4MjA1NTAuMDA2OTYzLCJuYmYiOjE2MTg4MjA1NTAuMDA2OTY3LCJleHAiOjE2NTAzNTY1NDkuOTkwNTQxLCJzdWIiOiIxOSIsInNjb3BlcyI6WyIqIl19.G7L5T2fQljhK2D1za669Q3cIIbyBT0oE8Z_IWQyL0sofZvIOYymVqW55w6b_nX6emkJj7JfylAI7q7-CVxXUN4tRcJCv9-AxFprhQubKvy59_6B5jd38jsOGHdlmMN5x7Mt3xl9WUPd1ODFg6Vqp3tR3nQ9J9eqUjrZgu54Yyx-1_gekBx87GCvcJxfmiDTBmr8J4Ze5099W_Bsj5UHGUb1X-GhNxVzfTFranTsvSEFDEA5jrBvNGIRkvqMUCx4jK7sJstlnlvTUmJ6WK0owl946ULiJhPe5jlM2_CKDckw81Ri6ecV1zAOWncTWi1Oa5qUkpEVf6pBtzk4_OLLjWUZ3MRz7xO2BiFYTuWxaQKNL9W4RhWbsf'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;
```

{% endtab %}
{% endtabs %}

## Presigned Upload

Upload files directly to S3 using a presigned URL, bypassing the API server.\
Recommended for large files (>100MB) to avoid timeout issues.

This is a three-step process:

1. **Get a presigned URL** — Request a temporary S3 upload URL from the API.
2. **Upload to S3** — PUT the file directly to S3 using the presigned URL.
3. **Submit file metadata** — Notify the API that the file has been uploaded to trigger recognition.

### Step 1: Get Presigned Upload URL

<mark style="color:blue;">`GET`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/presigned-upload`

#### Query Parameters

| Name           | Location | Required | Description                       |
| -------------- | -------- | -------- | --------------------------------- |
| `filename`     | query    | No       | File name (e.g. `song.mp3`)       |
| `content_type` | query    | No       | MIME type (default: `audio/mpeg`) |

#### Headers

| Name            | Location | Required | Description             |
| --------------- | -------- | -------- | ----------------------- |
| `Authorization` | header   | Yes      | `Bearer {access_token}` |

#### Example

```bash
curl -X GET "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/{container_id}/presigned-upload?filename=song.mp3" \
 -H "Authorization: Bearer {access_token}"
```

#### Response

```json
{
 "data": {
 "presigned_url": "https://{bucket-name}.s3.{region}.amazonaws.com/fs/queue/abc123.mp3?X-Amz-...",
 "key": "fs/queue/abc123.mp3",
 "method": "PUT",
 "headers": {
 "Content-Type": "audio/mpeg"
 },
 "expires_in": 3600,
 "file_id": "abc123-def456-...",
 "usage": "PUT the file to presigned_url, then POST /{cid}/files with {data_type:'audio', key:'<key>', filename:'<filename>'}"
 }
}
```

| Field           | Description                                           |
| --------------- | ----------------------------------------------------- |
| `presigned_url` | Temporary S3 URL for direct upload (valid for 1 hour) |
| `key`           | S3 object key, used in Step 3                         |
| `method`        | HTTP method for upload (`PUT`)                        |
| `headers`       | Required headers for the PUT request                  |
| `expires_in`    | URL expiration time in seconds                        |
| `file_id`       | Generated file ID                                     |

### Step 2: Upload File to S3

<mark style="color:green;">`PUT`</mark> `{presigned_url}`

#### Headers

| Header         | Required | Description                               |
| -------------- | -------- | ----------------------------------------- |
| `Content-Type` | Yes      | Must match the `content_type` from Step 1 |

#### Example

```bash
curl -X PUT "https://{bucket-name}.s3.{region}.amazonaws.com/fs/queue/abc123.mp3?X-Amz-..." \
 -H "Content-Type: audio/mpeg" \
 --data-binary @song.mp3
```

> **Note:** Do not send the `Authorization` header to S3. The presigned URL contains all necessary credentials.

### Step 3: Submit File Metadata

After the file has been uploaded to S3, submit the file metadata to trigger the recognition process.

<mark style="color:green;">`POST`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files`

#### Headers

| Name            | Location | Required | Description             |
| --------------- | -------- | -------- | ----------------------- |
| `Authorization` | header   | Yes      | `Bearer {access_token}` |
| `Content-Type`  | header   | Yes      | `application/json`      |

#### Request Body

```json
{
 "data_type": "audio",
 "key": "fs/queue/abc123.mp3",
 "filename": "song.mp3"
}
```

| Field       | Required | Description                        |
| ----------- | -------- | ---------------------------------- |
| `data_type` | Yes      | Must be `audio`                    |
| `key`       | Yes      | S3 object key from Step 1 response |
| `filename`  | Yes      | Original file name                 |

#### Example

```bash
curl -X POST "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/{container_id}/files" \
 -H "Authorization: Bearer {access_token}" \
 -H "Content-Type: application/json" \
 -d '{
 "data_type": "audio",
 "key": "fs/queue/abc123.mp3",
 "filename": "song.mp3"
 }'
```

#### Response (201 Created)

```json
{
 "data": {
 "file_id": "abc123-def456-...",
 "name": "song.mp3",
 "state": 0,
 "duration": 0,
 ...
 }
}
```

### Full Example (Python)

```python
import requests

BASE_URL = "https://api-{ContainerRegion}.acrcloud.com/api"
ACCESS_TOKEN = "***"
CONTAINER_ID = 0  # Replace with your own container ID
FILE_PATH = "song.mp3"

headers = {"Authorization": f"Bearer {ACCESS_TOKEN}"}

# Step 1: Get presigned URL
resp = requests.get(
 f"{BASE_URL}/fs-containers/{CONTAINER_ID}/presigned-upload",
 params={"filename": "song.mp3"},
 headers=headers
)
data = resp.json()["data"]
presigned_url = data["presigned_url"]
s3_key = data["key"]
print(f"Presigned URL obtained, key={s3_key}")

# Step 2: Upload file directly to S3
with open(FILE_PATH, "rb") as f:
 requests.put(
 presigned_url,
 headers={"Content-Type": "audio/mpeg"},
 data=f
 )
print("File uploaded to S3")

# Step 3: Submit metadata to trigger recognition
resp = requests.post(
 f"{BASE_URL}/fs-containers/{CONTAINER_ID}/files",
 headers={
 **headers,
 "Content-Type": "application/json"
 },
 json={
 "data_type": "audio",
 "key": s3_key,
 "filename": "song.mp3"
 }
)
print(f"File submitted, status={resp.status_code}")
print(resp.json())
```

### Comparison

|                | Direct Upload (POST /files)       | Presigned Upload       |
| -------------- | --------------------------------- | ---------------------- |
| Max file size  | Limited by Nginx/gunicorn timeout | No limit (S3 direct)   |
| Server load    | High (bandwidth + memory)         | None (bypasses server) |
| Timeout risk   | High for large files              | Low                    |
| URL expiration | N/A                               | 1 hour                 |
| Complexity     | Simple (1 request)                | 3 requests             |

### Error Handling

| Status | Error                 | Solution                                      |
| ------ | --------------------- | --------------------------------------------- |
| 401    | Unauthorized          | Check access token                            |
| 403    | Forbidden             | Check container permissions                   |
| 404    | Container not found   | Verify container ID                           |
| 410    | Expired presigned URL | Request a new URL (Step 1)                    |
| 502    | Upload timeout        | Use presigned upload instead of direct upload |

## Show the one file or multiple files's results

<mark style="color:blue;">`GET`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files/:file_ids`

Suit for getting the youtube channels/playlists results\
Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

#### Path Parameters

| Name          | Type   | Description                                                                    |
| ------------- | ------ | ------------------------------------------------------------------------------ |
| container\_id | number | The container id                                                               |
| file\_ids     | string | The file ids, if you want to get multiple files, separate file IDs with comma. |

#### Query Parameters

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

#### Headers

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

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

````
```json
{
    "data": [
        {
            "id": "e1cc5a16-e7b2-4261-9ab8-c20e1db70ac0",
            "uid": 1,
            "cid": 11655,
            "name": "/vod/video-3/01G6D3Z2SSDEDEGHP9ZSX8KC20/audio.mp4",
            "duration": 7,
            "uri": "audio_url:/01G6D3Z2SSDEDEGHP9ZSX8KC20/audio.mp4",
            "url": "https://test.com/01G6D3Z2SSDEDEGHP9ZSX8KC20/audio.mp4",
            "data_type": "audio_url",
            "engine": 1,
            "count": 1,
            "state": 1,
            "subscribed": 0,
            "detail": "",
            "created_at": "2022-07-06T03:50:33.000000Z",
            "updated_at": "2022-07-06T03:50:33.000000Z",
            "total": 1,
            "results": {
                "ai_detection": [
                   {
                     "start": 0,
                     "end": 249.74,
                     "prediction": "human",
                     "likely_source": "Human",
                     "ai_probability": 26.97,
                     "duration": 249.74,
                     "source_probabilities": [
                          {
                              "source": "suno",
                              "probability": 8.3
                          },
                          {
                              "source": "udio",
                              "probability": 9
                          },
                          {
                               "source": "sonauto",
                               "probability": 5
                          },
                          {
                               "source": "mureka",
                               "probability": 5.3
                          },
                          {
                               "source": "riffusion",
                               "probability": 5.3
                          }
                     ]
                  }
                ],
                "music": [
                    {
                        "played_duration": 7,
                        "offset": 0,
                        "type": "traverse",
                        "result": {
                            "album": {
                                "id": "3RQQmkQEvNCY4prGKE6oc5",
                                "name": "Un Verano Sin Ti"
                            },
                            "play_offset_ms": 87400,
                            "genres": [
                                {
                                    "name": "Latin"
                                }
                            ],
                            "title": "Efecto",
                            "result_from": 3,
                            "release_date": "2022-05-06",
                            "sample_end_time_offset_ms": 6160,
                            "sample_begin_time_offset_ms": 0,
                            "label": "Rimas Entertainment LLC",
                            "duration_ms": 213061,
                            "score": 100,
                            "db_begin_time_offset_ms": 80720,
                            "artists": [
                                {
                                    "id": "4q3ewBCX7sLwd24euuV69X",
                                    "name": "Bad Bunny"
                                }
                            ],
                            "db_end_time_offset_ms": 86880,
                            "external_ids": {
                                "isrc": "QM6MZ2214884",
                                "upc": "196626945068"
                            },
                            "acrid": "fd4e72b6dd70cdc0dde7f1f81a5c4df3",
                            "external_metadata": {
                                "musicbrainz": {
                                    "track": {
                                        "id": "782ee794-afb3-4adb-a1d7-c6fdc1d945de"
                                    }
                                },
                                "spotify": {
                                    "track": {
                                        "id": "5Eax0qFko2dh7Rl2lYs3bx",
                                        "name": "Efecto"
                                    },
                                    "album": {
                                        "name": "Un Verano Sin Ti"
                                    },
                                    "artists": [
                                        {
                                            "name": "Bad Bunny"
                                        }
                                    ]
                                },
                                "deezer": {
                                    "track": {
                                        "id": "1741494377",
                                        "name": "Efecto"
                                    },
                                    "album": {
                                        "name": "Un Verano Sin Ti"
                                    },
                                    "artists": [
                                        {
                                            "name": "Bad Bunny"
                                        }
                                    ]
                                },
                                "youtube": {
                                    "vid": "yO-XR4qXm1k"
                                }
                            }
                        }
                    }
                ]
            }
        }
    ]
}
```
````

{% endtab %}
{% endtabs %}

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

```
curl --location --request GET 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:your_container_id/files/f60c40d8-f35e-488e-bca4-105d85b080dc' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer YourAccessToken'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:your_container_id/files/f60c40d8-f35e-488e-bca4-105d85b080dc"

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

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

print(response.text)
```

{% endtab %}
{% endtabs %}

## Delete the files

<mark style="color:red;">`DELETE`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files/:ids`

Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

#### Path Parameters

| Name          | Type   | Description                     |
| ------------- | ------ | ------------------------------- |
| container\_id | string | The container id                |
| ids           | string | The files ids, seperated by "," |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

## Rescan the files

<mark style="color:orange;">`PUT`</mark> `https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/:container_id/files/:file_id/rescan`

Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

#### Path Parameters

| Name          | Type   | Description                   |
| ------------- | ------ | ----------------------------- |
| container\_id | String | The container id              |
| file\_ids     | String | The file ids, separate by ',' |

#### Headers

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

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

```javascript
{
    // Response
}
```

{% endtab %}
{% endtabs %}

{% tabs %}
{% tab title="Curl" %}
{% code overflow="wrap" lineNumbers="true" %}

```shell
curl --location --request PUT 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files/fd0cbc13-bb69-41ed-abbb-1ed6f25c3b02/rescan' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endcode %}
{% endtab %}

{% tab title="Python" %}
{% code overflow="wrap" lineNumbers="true" %}

```python
import requests

url = "https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/10005/files/fd0cbc13-bb69-41ed-abbb-1ed6f25c3b02/rescan"

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

response = requests.request("PUT", url, headers=headers)
```

{% endcode %}
{% endtab %}
{% endtabs %}

## Post result and state with json format to callback url

<mark style="color:green;">`POST`</mark> `https://callback-url.com/path`

#### Request Body

| Name                                       | Type   | Description                                                                                                                                                                                             |
| ------------------------------------------ | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| file\_id<mark style="color:red;">\*</mark> | String | The file id                                                                                                                                                                                             |
| cid<mark style="color:red;">\*</mark>      | String | The container id                                                                                                                                                                                        |
| state<mark style="color:red;">\*</mark>    | String | <p>1:Ready (Recognize results from a file.)<br>-1: No results (No results were recognized from the file.)<br>-2,-3: Error</p>                                                                           |
| results                                    | String | <p>if the state = 1, the results will be posted to the callback url</p><p>The format is:<br>{</p><p>"music":\[{},{}...],</p><p>"custom\_files":\[{},{},...],</p><p>"cover\_files":\[{},{},...]<br>}</p> |
| name                                       | String | the file name                                                                                                                                                                                           |

```python
import requests

post_data = {
  'file_id':"c7331194-ccbe-4c3f-8e82-40d7b8358993",
  'state':1,
  'cid':1000,
  'name': "FILE Name",
  'results': {
        "music":[
                    {
                        "played_duration":164,
                        "type":"traverse",
                        "result":{
                            "album":{
                                "name":"Indie Brit Romance"
                            },
                            "play_offset_ms":10000,
                            "sample_begin_time_offset_ms":0,
                            "title":"Broken Skies 3",
                            "result_from":1,
                            "release_date":"2016-06-28",
                            "sample_end_time_offset_ms":9280,
                            "genres":[
                                {
                                    "name":"Indie"
                                },
                                {
                                    "name":"Singer"
                                },
                                {
                                    "name":"Songwriter"
                                }
                            ],
                            "label":"Audio Network",
                            "duration_ms":167000,
                            "score":100,
                            "db_begin_time_offset_ms":0,
                            "artists":[
                                {
                                    "name":"Bob Bradley"
                                },
                                {
                                    "name":"Matt Parker"
                                }
                            ],
                            "db_end_time_offset_ms":9280,
                            "external_ids":{
                                "isrc":"GBFFM1621637"
                            },
                            "acrid":"e8b02eab3fd1d2745f460fb608b7b5c1",
                            "external_metadata":[

                            ]
                        },
                        "offset":0
        }]
}
r =  requests.post(callback_url, json=post_data, timeout=3)

```

## Download the integrated FS results

<mark style="color:green;">`GET`</mark> [https://api-{ContainerRegion}.acrcloud.com](https://ap-api-v2.acrcloud.com)/api/fs-containers/:container\_id/reports

The entire container fs results will be downloaded if no query parameter is specified.\
Please replace `{ContainerRegion} with`the region of your FS Container which is one of the following regions.\
Container Regions:\
eu-west-1,us-west-2,ap-southeast-1

**Headers**

| Name          | Value              |
| ------------- | ------------------ |
| Content-Type  | `application/json` |
| Authorization | `Bearer <token>`   |

#### Path Parameters

| Name          | Type   | Description         |
| ------------- | ------ | ------------------- |
| container\_id | string | The fs container id |

Query Parameters

| Name        | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                       |
| ----------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| ids         | string   | filter by file ids, separate by commas                                                                                                                                                                                                                                                                                                                                                                            |
| start\_date | datetime | <p>filter by start date, If filtered by time, both start\_date and end\_date need to exist simultaneously.<br>format: YYYY-MM-DD</p>                                                                                                                                                                                                                                                                              |
| end\_date   | datetime | <p>filter by end date, If filtered by time, both start\_date and end\_date need to exist simultaneously.<br>format:YYYY-MM-DD</p>                                                                                                                                                                                                                                                                                 |
| type        | string   | <p>values: all, merged, music, cover\_songs, custom.<br>default value: all (Download all results and compress them into a zip file, which needs to be unzipped to access the results.）<br>merged: csv content with merged all the results.<br>music: csv content with music result<br>cover\_songs: csv content with cover\_songs results<br>custom: csv content with the results from customer's buckets<br></p> |

Examples

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

```sh
curl --location 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/CONTIANER_ID/reports?ids=72eb3a04-5a49-4b5e-aab0-4bdd8f5fff6d' \
--header 'Authorization: Bearer YOUR_TOKEN' -o fs_report.zip

curl --location 'https://api-{ContainerRegion}.acrcloud.com/api/fs-containers/CONTIANER_ID/reports?type=merged&ids=72eb3a04-5a49-4b5e-aab0-4bdd8f5fff6d' \
--header 'Authorization: Bearer YOUR_TOKEN' -o fs_report.csv


```

{% endtab %}
{% endtabs %}


# Metadata


# Music

An example of music metadata for Audio & Video Recognition project

### JSON structure

```json
{
    "music": [
        {
            "offset": 14,
            "played_duration": 5,
            "type": "traverse",
            "result": {
                "album": {
                    "name": "my ex called"
                },
                "play_offset_ms": 6440,
                "sample_begin_time_offset_ms": 4260,
                "title": "my ex called",
                "result_from": 3,
                "release_date": "2020-02-21",
                "sample_end_time_offset_ms": 8860,
                "label": "Thrill$",
                "db_end_time_offset_ms": 4600,
                "score": 100,
                "db_begin_time_offset_ms": 0,
                "artists": [
                    {
                        "name": "Thrill$"
                    }
                ],
                "duration_ms": 168920,
                "external_ids": {
                    "isrc": "QZJG52083365",
                    "upc": "194923628486"
                },
                "acrid": "269e27604f4be4c3167fc3751f5551c3",
                "external_metadata": {
                    "deezer": {
                        "album": {
                            "name": ""
                        },
                        "track": {
                            "name": "Havit",
                            "id": "1098021672"
                        },
                        "artists": [
                            {
                                "name": "Of_mannyg"
                            }
                        ]
                    }
                }
            }
        },
        {
            "offset": 24,
            "played_duration": 14,
            "type": "traverse",
            "result": {
                "album": {
                    "name": "Lost Files"
                },
                "play_offset_ms": 5340,
                "sample_begin_time_offset_ms": 4080,
                "title": "In the Streets",
                "result_from": 1,
                "release_date": "2020-10-26",
                "sample_end_time_offset_ms": 9260,
                "label": "Hitta Huncho",
                "db_end_time_offset_ms": 5180,
                "score": 100,
                "db_begin_time_offset_ms": 0,
                "artists": [
                    {
                        "name": "Hitta Huncho"
                    }
                ],
                "duration_ms": 160940,
                "external_ids": {
                    "isrc": "TCAFE2056515",
                    "upc": "859742903298"
                },
                "acrid": "e63ee358a9357a1e181cd8ce858d78fd",
                "external_metadata": {
                    "deezer": {
                        "album": {
                            "name": ""
                        },
                        "track": {
                            "name": "In the Streets",
                            "id": "1131507852"
                        },
                        "artists": [
                            {
                                "name": "Hitta Huncho"
                            }
                        ]
                    }
                }
            }
        },
        {
            "offset": 30,
            "played_duration": 209,
            "type": "traverse",
            "result": {
                "album": {
                    "name": "Destined 2 Win"
                },
                "play_offset_ms": 25880,
                "sample_begin_time_offset_ms": 0,
                "title": "Love Hurts",
                "result_from": 1,
                "release_date": "2021-04-02",
                "sample_end_time_offset_ms": 8200,
                "genres": [
                    {
                        "name": "Hip Hop"
                    }
                ],
                "label": "Columbia",
                "db_end_time_offset_ms": 24100,
                "score": 100,
                "db_begin_time_offset_ms": 15900,
                "artists": [
                    {
                        "name": "Lil Tjay"
                    }
                ],
                "duration_ms": 222100,
                "external_ids": {
                    "isrc": "USSM12101539",
                    "upc": "886449173587"
                },
                "acrid": "d981bc8a8a55b06d15d5ea0f4957873c",
                "external_metadata": {
                    "spotify": {
                        "album": {
                            "name": "Destined 2 Win"
                        },
                        "track": {
                            "name": "Love Hurts (feat. Toosii)",
                            "id": "2ULQtFHTzUK0DqcqWUlXxw"
                        },
                        "artists": [
                            {
                                "name": "Lil Tjay"
                            },
                            {
                                "name": "Toosii"
                            }
                        ]
                    }
                },
                "distributors":["Sony Music Entertainment"]
            }
        }
    ]
}
```

### Metadata fields

| Name                            | Description                                                                                                                                                                                                       |
| ------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| music                           | Music fields                                                                                                                                                                                                      |
| acrid                           | ACRCloud unique identifier                                                                                                                                                                                        |
| timestamp\_utc                  | Server time of sending results, Timestamp of the song started for custom monitoring, UTC time zone                                                                                                                |
| title                           | Track title                                                                                                                                                                                                       |
| album                           | Album fields                                                                                                                                                                                                      |
| id                              | Identifier of the artists , album or 3rd parties fields                                                                                                                                                           |
| name                            | Name of the artists or album                                                                                                                                                                                      |
| artists                         | Artists fields                                                                                                                                                                                                    |
| duration\_ms                    | Duration of the track in millisecond                                                                                                                                                                              |
| play\_offset\_ms                | The time position of the audio/song being played (millisecond)                                                                                                                                                    |
| external\_ids                   | External standard code                                                                                                                                                                                            |
| isrc                            | ISRC code                                                                                                                                                                                                         |
| upc                             | UPC code                                                                                                                                                                                                          |
| external\_metadata              | External 3rd party IDs and metadata                                                                                                                                                                               |
| track                           | Track fields                                                                                                                                                                                                      |
| genres                          | Genres fields                                                                                                                                                                                                     |
| label                           | Music label name                                                                                                                                                                                                  |
| release\_date                   | Release data of the track, format:YYYY-MM-DD                                                                                                                                                                      |
| spotify                         | Spotify fields                                                                                                                                                                                                    |
| deezer                          | Deezer fields                                                                                                                                                                                                     |
| lyricfind                       | LyricFind fields                                                                                                                                                                                                  |
| lfid                            | LyricsFind's lyric ID                                                                                                                                                                                             |
| youtube                         | YouTube fields                                                                                                                                                                                                    |
| vid                             | Youtube video ID                                                                                                                                                                                                  |
| musicbrainz                     | MusicBrainz Identifier - MBID                                                                                                                                                                                     |
| db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)                                                                                                                                           |
| db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                                                                                                                                                 |
| sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond)                                                                                                                             |
| sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)                                                                                                                                   |
| played\_duration                | Actual duration of the track played in the streams for Broadcast Monitoring service, in second                                                                                                                    |
| score                           | Match confidence score. Range: 70 - 100                                                                                                                                                                           |
| +contributors                   | Contributor information for this track                                                                                                                                                                            |
| +composers                      | Composers of the song                                                                                                                                                                                             |
| +lyricists                      | Writers of the lyrics                                                                                                                                                                                             |
| language                        | Language of the song, ISO 639-1 codes                                                                                                                                                                             |
| langs                           | Translation into different languages. Example: \[{"code":"ru", "name":"Я твой враг"}]                                                                                                                             |
| #rights\_claim                  | All relevant metadata fields to determine rights owners, available territories and rights claim policy for UGC platforms. These metadata fields are for copyright compliance users only.                          |
| #distributor                    | Information of distributor for this track                                                                                                                                                                         |
| #id                             | DDEX Party ID of the distributor, this ID won't change.                                                                                                                                                           |
| #name                           | Name of the distributor, This name might be changing from time to time.                                                                                                                                           |
| #rights\_claim\_policy          | Right policy for UGC platforms, the value options are "Monetize", "Allow", "ReportUsage" and "BlockAccess".                                                                                                       |
| #rights\_owners                 | Rights owners' name, example: \[{"name":"Warner Music Group", "share\_percentage":100}]                                                                                                                           |
| #territories                    | Territory codes for Included territories, ISO country codes applied.                                                                                                                                              |
| #excluded\_territories          | Territory codes for excluded territories, ISO country codes applied.                                                                                                                                              |
| #share\_percentage              | Percentage of the rights share for each rights owners.                                                                                                                                                            |
| #release\_by\_territories       | Release details by territories, indicate the release date for territories.                                                                                                                                        |
| +work                           | Publishing metadata fields for works                                                                                                                                                                              |
| +ISWC                           | ISWC code                                                                                                                                                                                                         |
| +name                           | Name of the work                                                                                                                                                                                                  |
| +creators                       | The creators of the work                                                                                                                                                                                          |
| +ipi                            | IPI code for the creator                                                                                                                                                                                          |
| +roles                          | The roles of the creator                                                                                                                                                                                          |
| time\_skew                      | Time skew refers to a temporal misalignment or timing offset between two audio signals. It means that the audio events (such as beats, notes, or spectral features) occur earlier or later in time than expected. |
| frequency\_skew                 | Frequency skew refers to a distortion in the frequency domain, where the spectral components of the audio are shifted upward or downward in frequency.                                                            |

{% hint style="info" %}
**Please note: Only&#x20;*****ACRID,*** ***Track Title, Artists Name, Album Name*****&#x20;and \*\_time\_offset\_ms fields are required, other fields are optional.**

\#fields are visible for the projects with copyright compliance option only.

+fields are visible upon request, please contact us if you need those fields.
{% endhint %}


# Custom Files

An example of custom-defined metadata for Audio & Video Recognition, Broadcast Monitoring, Hybrid Recognition and Offline Recognition projects.

### JSON structure

```bash
{
    "custom_files": [
        {
            "offset": 0,
            "played_duration": 14,
            "type": "traverse",
            "result": {
                "bucket_id": "51",
                "title": "You are beautiful",
                "artist": "James",
                "acrid": "5343bc191634b042622bf474ed46121a",
                "audio_id": "3"
            }
        }
    ]
}
```

### Metadata fields

| Name                              | Description                                                                           |
| --------------------------------- | ------------------------------------------------------------------------------------- |
| custom\_files                     | Custom uploaded file fields                                                           |
| arcid                             | ACRCloud unique identifier                                                            |
| title                             | File name                                                                             |
| audio\_id                         | User defined identifier                                                               |
| play\_offset\_ms                  | Position of the recognition in the file if the file was playing (millisecond)         |
| \*db\_begin\_time\_offset\_ms     | Position of beginning of the recognition on database file (millisecond)               |
| \*db\_end\_time\_offset\_ms       | Position of end of the recognition on database file (millisecond)                     |
| \*sample\_begin\_time\_offset\_ms | Position of beginning of the recognition in sample file sent by SDK/API (millisecond) |
| \*sample\_end\_time\_offset\_ms   | Position of end of the recognition in sample file sent by SDK/API (millisecond)       |

{% hint style="info" %}
***\* fields are visible in Broadcast Monitoring service only, if you want to use these fields in recognition service, please contact us.***

**Please note: Only&#x20;*****Title, ARCID, Audio\_ID*****&#x20;are required fields.**
{% endhint %}


# Cover Songs

An example cover songs metadata  for FS project.

```bash
{
    "cover_songs": [
        {
            "offset": 1.71,
            "played_duration": 297.32,
            "type": "traverse",
            "engine_type": "2",
            "result": {
                "title": "Carrying the Banner",
                "artists": [
                    {
                        "langs": [
                            {
                                "code": "en",
                                "name": "Newsies Ensemble"
                            }
                        ],
                        "name": "Newsies Ensemble",
                        "roles": [
                            "MainArtist"
                        ]
                    }
                ],
                "album": {
                    "name": null
                },
                "label": "Walt Disney Records",
                "release_date": null,
                "duration_ms": 373000,
                "external_ids": {
                    "isrc": "USWD10423231"
                },
                "distributors": [
                    "UMG"
                ],
                "external_metadata": {
                    "spotify": {
                        "track": {
                            "id": "0n1I8KDjS2HYeESQo4zPry"
                        }
                    },
                    "deezer": {
                        "track": {
                            "id": "1761602537"
                        }
                    },
                    "apple": {
                        "track": {
                            "id": "1440650771"
                        }
                    }
                }
            }
        }
    ]
}
```


# AI Music Detection

An example of ai detection metadata for FS project.

```json
{
    "ai_detection": [
        {
            "start": 0,
            "end": 168.68,
            "prediction": "ai_generated",   //ai_generated,human,no_vocals
            "likely_source": "Suno",        //Suno,Udio,Sonauto,Mureka,Riffusion,Human,no_vocals
            "ai_probability": 97.61,
            "duration": 168.68,
            "stem": "original",             //original, vocals, accompaniment
            "source_probabilities": [
                {
                    "source": "Suno",
                    "probability": 96
                },
                {
                    "source": "Udio",
                    "probability": 0.6
                },
                {
                    "source": "Sonauto",
                    "probability": 0.2
                },
                {
                    "source": "Mureka",
                    "probability": 0.8
                },
                {
                    "source": "Riffusion",
                    "probability": 0.2
                },
                {
                    "source": "Seedmusic",
                    "probability": 0.7
                },
                {
                    "source": "Minimax",
                    "probability": 0.2
                },
                {
                    "source": "Elevenlabs",
                    "probability": 0.1
                }
            ],
            "segments": [
                {
                    "start": 0,
                    "end": 168.68,
                    "prediction": "ai_generated",
                    "likely_source": "Suno",
                    "ai_probability": 98.64
                }
            ],
            "model_id": "lv1axtcv" // model version
        },
        {
            "start": 0,
            "end": 168.68,
            "prediction": "ai_generated",
            "likely_source": "Suno",
            "ai_probability": 93.05,
            "duration": 168.68,
            "source_probabilities": [
                {
                    "source": "Suno",
                    "probability": 88.3
                },
                {
                    "source": "Udio",
                    "probability": 1.1
                },
                {
                    "source": "Sonauto",
                    "probability": 0.6
                },
                {
                    "source": "Mureka",
                    "probability": 3.1
                },
                {
                    "source": "Rdiffusion",
                    "probability": 0.6
                },
                {
                    "source": "Seedmusic",
                    "probability": 1.2
                },
                {
                    "source": "Minimax",
                    "probability": 0.1
                },
                {
                    "source": "Elevenlabs",
                    "probability": 0.1
                }
            ],
            "stem": "vocals",
            "segments": [
                {
                    "start": 0,
                    "end": 156,
                    "prediction": "ai_generated",
                    "likely_source": "Suno",
                    "ai_probability": 96.74
                },
                {
                    "start": 156,
                    "end": 160,
                    "prediction": "ai_generated",
                    "likely_source": "Mureka",
                    "ai_probability": 61.83
                },
                {
                    "start": 160,
                    "end": 164,
                    "prediction": "human",
                    "likely_source": "Human",
                    "ai_probability": 19.3
                },
                {
                    "start": 164,
                    "end": 168.68,
                    "prediction": "ai_generated",
                    "likely_source": "Suno",
                    "ai_probability": 91.29
                }
            ],
            "model_id": "lv1axtcv"
        },
        {
            "start": 0,
            "end": 168.68,
            "prediction": "ai_generated",
            "likely_source": "Suno",
            "ai_probability": 97.58,
            "duration": 168.68,
            "source_probabilities": [
                {
                    "source": "Suno",
                    "probability": 96
                },
                {
                    "source": "Udio",
                    "probability": 0.7
                },
                {
                    "source": "Sonauto",
                    "probability": 0.3
                },
                {
                    "source": "Mureka",
                    "probability": 0.6
                },
                {
                    "source": "Rdiffusion",
                    "probability": 0.2
                },
                {
                    "source": "Seedmusic",
                    "probability": 0.6
                },
                {
                    "source": "Minimax",
                    "probability": 0.1
                },
                {
                    "source": "Elevenlabs",
                    "probability": 0.1
                }
            ],
            "stem": "accompaniment",
            "segments": [
                {
                    "start": 0,
                    "end": 168.68,
                    "prediction": "ai_generated",
                    "likely_source": "Suno",
                    "ai_probability": 98.56
                }
            ],
            "model_id": "lv1axtcv"
        }
    ]
}
```


# Music/Speech Detection

An example of music/speech detection metadata for FS project.

```json
 {
    "music_speech":[
         {
              "start": 0,
              "end": 222,
              "label": "m" //m:Music, ms:Music & Speech, s:Speech, o:Others
          }
    ]
}
```


# UCF Projects

## Create a ucf project

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/ucf-projects`

This endpoint allows you to get free cakes.

#### Headers

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

#### Request Body

| Name   | Type   | Description                                            |
| ------ | ------ | ------------------------------------------------------ |
| name   | string | The project name                                       |
| type   | string | BM or FILES, default is BM.                            |
| region | string | eu-west-1,us-west-2,ap-southeast-1                     |
| config | object | default is {"days":3,"mini\_ms":5000,"max\_ms":300000} |

{% tabs %}
{% tab title="200 Project successfully created." %}

```
{
    "data": {
        "uid": 1,
        "name": "test",
        "region": "eu-west-1",
        "type": "BM",
        "config": {
            "days": 3,
            "min_ms": 5000,
            "max_ms": 300000
        },
        "updated_at": "2020-12-28T04:57:13.000000Z",
        "created_at": "2020-12-28T04:57:13.000000Z",
        "id": 100000
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'http://127.0.0.1:8080/api/ucf-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"name":"test", "region":"eu-west-1", "type":"BM"}'
```

{% endtab %}

{% tab title="Python" %}

```python
import requests

url = "http://127.0.0.1:8080/api/ucf-projects"

payload={"name":"test", "region":"eu-west-1", "type":"BM"}"
headers = {
  'Accept': 'application/json',
  'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI2IiwianRpIjoiN2Y2N2NhNmE4NmMxOGZiMWZmYmVkOWM5OTQwNGQxNWI1MjU2NmE1NzVlNTdkMjFjYjBiM2Y4MWQzYTJmZjM1N2FiZjhmNjRjY2YyYWQ0NDkiLCJpYXQiOjE2MDg0NzIwODQsIm5iZiI6MTYwODQ3MjA4NCwiZXhwIjoxNjQwMDA4MDg0LCJzdWIiOiIxIiwic2NvcGVzIjpbIioiXX0.nTbfzMg2thStTmX2dy1ZEB1JSILpwzLv5DMDVaxUY5NaC9GAj_VLAKNVJyOWvY5Ti-LFFvcQ8W8rVL4NesXnJJ89jLYwMoskCcvs8ZZNIJEfo6CAj5Lzp0Thc3eqHRDbOtVhgZojmdI5BsU9nBVAowOnVbLDv_3MoqP3MGFlSuhfVKgQZwLiVavvVjLVIZkxaEczmhCZIW1Dr_sYWkYzyDFRcZ2paz1lMzFBp7zLtYEsbCa6odSyMQxzxKZ-6h3WgpRjx34vrC6THH-zpf8TTlTM7ddmq1mHr_o3JvAHzfZCjqAFs3YU3uIeVI-U_-XXXZCHusy-QW7cCmJOBSzztiUKzUpNu-UdSHStPVeobUQTv86mNBMtgAZEXyflTTs7YkC6I83N9AAIW-tXyt50VcmHBKRy3qjzC-SwgOphuOLfSNIz0sy7PSckztWsx07XNKck_M-ajSthnS7FE9TDJ5Q5WC3UPBq056CYZckqOPByCJKf3ktmiOGKBXof05Peq-Uts0A0K6V16y0vr5m_v2Honxt3F0wfEWApyqHjEHopOu3zjTN7r3SOrjJMDQgmDduZBrk_iLrX4ggu6I5P70s2HVyT5mpvJiULWamanYaYgQfDSVFLeM4X6ffihrgzlle55rzRazfdNjspU_VusZWik4DOpMjZ-iHA9oo_lEA',
  'Content-Type': 'application/json'
}

response = requests.post(url, headers=headers, json=payload)

print(response.text)

```

{% endtab %}
{% endtabs %}

## List the ucf projects

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects`

#### Query Parameters

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| region | string |             |

#### Headers

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

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

```
{
    "data": [
        {
            "id": 100000,
            "uid": 1,
            "name": "test",
            "region": "eu-west-1",
            "type": "BM",
            "config": {
                "days": 3,
                "min_ms": 5000,
                "max_ms": 300000
            },
            "created_at": "2020-12-28T04:57:13.000000Z",
            "updated_at": "2020-12-28T04:57:13.000000Z"
        }
    ],
    "links": {
        "first": "http://127.0.0.1:8080/api/ucf-projects?page=1",
        "last": "http://127.0.0.1:8080/api/ucf-projects?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://127.0.0.1:8080/api/ucf-projects",
        "per_page": 15,
        "to": 1,
        "total": 1
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'http://127.0.0.1:8080/api/ucf-projects' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Update a ucf project

<mark style="color:orange;">`PUT`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:id`

#### Path Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| id   | number | the ucf project id |

#### Headers

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

#### Request Body

| Name   | Type   | Description |
| ------ | ------ | ----------- |
| config | object |             |
| name   | string |             |

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

```
{
    "data": {
        "uid": 1,
        "name": "test",
        "region": "eu-west-1",
        "type": "BM",
        "config": {
            "days": 3,
            "min_ms": 5000,
            "max_ms": 300000
        },
        "updated_at": "2020-12-28T04:57:13.000000Z",
        "created_at": "2020-12-28T04:57:13.000000Z",
        "id": 100000
    }
}
```

{% endtab %}
{% endtabs %}

## Delete a ucf project

<mark style="color:red;">`DELETE`</mark> `/api/ucf-projects/:id`

#### Path Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| id   | number | The ucf project id |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}


# BM Streams

## Import bm streams

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/streams`

Import BM streams to project

#### Path Parameters

| Name | Type   | Description    |
| ---- | ------ | -------------- |
| pid  | number | The project id |

#### Headers

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

#### Request Body

| Name            | Type   | Description              |
| --------------- | ------ | ------------------------ |
| bm\_stream\_ids | array  | The BM streams ids array |
| from            | string | BM-CUSTOM or BM-DATABASE |
| bm\_project\_id | number | The BM project id        |

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

```
{
    "data": [
        {
            "uid": 1,
            "pid": 10263,
            "bm_stream_id": 191149,
            "bm_project_id": 871,
            "from": "BM-DATABASE",
            "state": 1,
            "updated_at": "2020-12-28T08:01:14.000000Z",
            "created_at": "2020-12-28T08:01:14.000000Z",
            "id": 79,
            "bm_stream_name": "(ΛΑΜΨΗ) Lampsi 92.3 FM",
            "bm_project_name": "test"
        },
        {
            "uid": 1,
            "pid": 10263,
            "bm_stream_id": 198144,
            "bm_project_id": 871,
            "from": "BM-DATABASE",
            "state": 1,
            "updated_at": "2020-12-28T08:01:14.000000Z",
            "created_at": "2020-12-28T08:01:14.000000Z",
            "id": 80,
            "bm_stream_name": ".977 Today's Hits",
            "bm_project_name": "test"
        }
    ]
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request POST 'https://api-v2.acrcloud.com/api/ucf-projects/10263/streams' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token' \
--header 'Content-Type: application/json' \
--data-raw '{"bm_stream_ids":["191149","198144"], "from":"BM-DATABASE", "bm_project_id":871}'
```

{% endtab %}
{% endtabs %}

## List the ucf streams

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/streams`

#### Path Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| pid  | string | The ucf project id |

#### Query Parameters

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

#### Headers

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

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

```
{
    "data": [
        {
            "id": 80,
            "uid": 1,
            "pid": 10263,
            "bm_stream_id": "198144",
            "bm_project_id": 871,
            "from": "BM-DATABASE",
            "state": 1,
            "updated_at": "2020-12-28T08:01:14.000000Z",
            "created_at": "2020-12-28T08:01:14.000000Z",
            "bm_stream_name": ".977 Today's Hits",
            "bm_project_name": "test"
        },
        {
            "id": 79,
            "uid": 1,
            "pid": 10263,
            "bm_stream_id": "191149",
            "bm_project_id": 871,
            "from": "BM-DATABASE",
            "state": 1,
            "updated_at": "2020-12-28T08:01:14.000000Z",
            "created_at": "2020-12-28T08:01:14.000000Z",
            "bm_stream_name": "(ΛΑΜΨΗ) Lampsi 92.3 FM",
            "bm_project_name": "test"
        }
    ],
    "links": {
        "first": "http://127.0.0.1:8080/api/ucf-projects/10263/streams?page=1",
        "last": "http://127.0.0.1:8080/api/ucf-projects/10263/streams?page=1",
        "prev": null,
        "next": null
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "last_page": 1,
        "path": "http://127.0.0.1:8080/api/ucf-projects/10263/streams",
        "per_page": 10,
        "to": 2,
        "total": 2
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/ucf-projects/10263/streams' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Delete the bm streams

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/streams/ids`

#### Path Parameters

| Name | Type   | Description                      |
| ---- | ------ | -------------------------------- |
| ids  | string | The streams ids. Sparated by ',' |
| pid  | number | The ucf project id               |

#### Headers

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

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'http://127.0.0.1:8080/api/ucf-projects/10263/streams/80' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}


# UCF Results

## List the ucf results

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results`

#### Path Parameters

| Name | Type   | Description        |
| ---- | ------ | ------------------ |
| pid  | number | The ucf project id |

#### Query Parameters

| Name         | Type    | Description                                                                                                                                                                                   |
| ------------ | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| page         | number  | The page number                                                                                                                                                                               |
| begin\_date  | string  | Filter the results by begin\_date. The format is "%Y-%m-%d" or "%Y-%m-%d %H:%M:%S"                                                                                                            |
| end\_date    | string  | Filter the results by end\_date. The format is "%Y-%m-%d" or "%Y-%m-%d %H:%M:%S"                                                                                                              |
| sortby       | string  | Sort the results by 'id', 'num', 'duration\_ms'. The default is sort by 'id'.                                                                                                                 |
| order        | string  | desc or asc. Default is desc.                                                                                                                                                                 |
| status       | string  | <p>0:Pending results.<br>2: Edited results.<br>6: Reported results.<br>10: Bucketed results.<br>14: Reported & Bucketed results.<br>-1: Deleted results<br>-2: Deleted & Reserved results</p> |
| min          | string  | Filter the results by minimum duration. (seconds)                                                                                                                                             |
| max          | string  | Filter the results by maximum duration.(seconds)                                                                                                                                              |
| streams      | string  | Filter the results by streams ids. Separated by ,                                                                                                                                             |
| ucf\_id      | string  | Filter the results by ucf id.                                                                                                                                                                 |
| label        | string  | <p>0: Unknown<br>1: Music<br>2: Speech<br>3: Music & Speech<br>4: Advertisement</p>                                                                                                           |
| per\_page    | boolean | The item number of one page                                                                                                                                                                   |
| label\_value | string  | if the label is advertisement, then the label\_value is the advertisement name                                                                                                                |

#### Headers

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

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

```
{
    "data":[
        {
            "id":340335,
            "acr_id":"d7a4ebc9685f23bdc843ed4146b35f69",
            "status":0,
            "label":2,
            "num":3,
            "duration_ms":131460,
            "metadata":null,
            "created_at":"2020-05-27 08:56:45",
            "pid":10263,
            "operators":[
                {"operator":"ACRCloud","updated_at":"2022-04-27 08:09:49"},
                {"operator":"ACRCloud","updated_at":"2022-04-27 08:10:27"}
            ],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340334,
            "acr_id":"4fc390bfb9db91e904084715c530e25d",
            "status":0,
            "label":3,
            "num":3,
            "duration_ms":157840,
            "metadata":null,
            "created_at":"2020-05-27 08:56:41",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340333,
            "acr_id":"4965aefe6b33202f9a1fb000d2a00bd6",
            "status":0,
            "label":1,
            "num":3,
            "duration_ms":136740,
            "metadata":null,
            "created_at":"2020-05-27 08:49:18",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340332,
            "acr_id":"e0e99fd9dc89da03e5081b856dcbf609",
            "status":0,
            "label":2,
            "num":2,
            "duration_ms":130900,
            "metadata":null,
            "created_at":"2020-05-27 08:49:14",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340331,
            "acr_id":"79242e7fdf8db9063b75e5406adb2985",
            "status":0,
            "label":3,
            "num":2,
            "duration_ms":158820,
            "metadata":null,
            "created_at":"2020-05-27 08:49:10",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340330,
            "acr_id":"0ea18f0ef7548f99129086bb29699e87",
            "status":0,
            "label":3,
            "num":4,
            "duration_ms":120760,
            "metadata":null,
            "created_at":"2020-05-27 08:44:06",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340328,
            "acr_id":"f3e85570e94ae78735c49c4574422bf3",
            "status":0,
            "label":3,
            "num":4,
            "duration_ms":201060,
            "metadata":null,
            "created_at":"2020-05-27 08:43:57",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340327,
            "acr_id":"6fae20c216b2b212931d0b92ac505542",
            "status":0,
            "label":1,
            "num":2,
            "duration_ms":303900,
            "metadata":null,
            "created_at":"2020-05-27 08:43:50",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340326,
            "acr_id":"0eba7a977facffeed6b15e08d47cf135",
            "status":0,
            "label":2,
            "num":2,
            "duration_ms":194400,
            "metadata":null,
            "created_at":"2020-05-27 08:38:50",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"
        },
        {
            "id":340325,
            "acr_id":"c0f1b9e0a46f417db2634f55ebbc7954",
            "status":0,
            "label":1,
            "num":2,
            "duration_ms":129000,
            "metadata":null,
            "created_at":"2020-05-27 08:33:50",
            "pid":10263,
            "operators":[],
            "updated_at":"2020-05-27 08:56:45"           
        }
    ],
    "links":{
        "first":"http://127.0.0.1:8080/api/ucf-projects/10263/results?per_page=10&status=0&page=1",
        "last":"http://127.0.0.1:8080/api/ucf-projects/10263/results?per_page=10&status=0&page=9",
        "prev":null,
        "next":"http://127.0.0.1:8080/api/ucf-projects/10263/results?per_page=10&status=0&page=2"
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":9,
        "path":"http://127.0.0.1:8080/api/ucf-projects/10263/results",
        "per_page":"10",
        "to":10,
        "total":90
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/ucf-projects/10263/results?page=1&per_page=10&status=0' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## List the details of one ucf item

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results/:ucf_id/details`

#### Path Parameters

| Name    | Type   | Description    |
| ------- | ------ | -------------- |
| pid     | number | The project id |
| ucf\_id | number | The ucf id     |

#### Query Parameters

| Name        | Type   | Description |
| ----------- | ------ | ----------- |
| page        | number |             |
| per\_page   | number |             |
| begin\_date | string |             |
| end\_date   | string |             |

#### Headers

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

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

```
{
    "data":[
        {
            "id":4708635,
            "duration_ms":137520,
            "acr_id":"d7a4ebc9685f23bdc843ed4146b35f69",
            "begin_time":"2020-05-26 08:41:33",
            "pid":10263,
            "stream":{
                "id":53,
                "uid":1,
                "pid":10263,
                "bm_stream_id":"s-U3P7kHj",
                "bm_project_id":10263,
                "from":"BM-CUSTOM",
                "state":2,
                "updated_at":"2020-12-28T07:55:04.000000Z",
                "created_at":"2020-05-28T03:53:03.000000Z",
                "bm_stream_name":"RTM KL FM",
                "bm_project_name":"PPM"
            }
        },
        {
            "id":4708634,
            "duration_ms":132500,
            "acr_id":"d7a4ebc9685f23bdc843ed4146b35f69",
            "begin_time":"2020-05-25 08:43:03",
            "pid":10263,
            "stream":{
                "id":53,
                "uid":1,
                "pid":10263,
                "bm_stream_id":"s-U3P7kHj",
                "bm_project_id":10263,
                "from":"BM-CUSTOM",
                "state":2,
                "updated_at":"2020-12-28T07:55:04.000000Z",
                "created_at":"2020-05-28T03:53:03.000000Z",
                "bm_stream_name":"RTM KL FM",
                "bm_project_name":"PPM"
            }
        },
        {
            "id":4708633,
            "duration_ms":131460,
            "acr_id":"d7a4ebc9685f23bdc843ed4146b35f69",
            "begin_time":"2020-05-24 05:17:36",
            "pid":10263,
            "stream":{
                "id":53,
                "uid":1,
                "pid":10263,
                "bm_stream_id":"s-U3P7kHj",
                "bm_project_id":10263,
                "from":"BM-CUSTOM",
                "state":2,
                "updated_at":"2020-12-28T07:55:04.000000Z",
                "created_at":"2020-05-28T03:53:03.000000Z",
                "bm_stream_name":"RTM KL FM",
                "bm_project_name":"PPM"
            }
        }
    ],
    "links":{
        "first":"http://127.0.0.1:8080/api/ucf-projects/10263/results/340335/details?per_page=10&page=1",
        "last":"http://127.0.0.1:8080/api/ucf-projects/10263/results/340335/details?per_page=10&page=1",
        "prev":null,
        "next":null
    },
    "meta":{
        "current_page":1,
        "from":1,
        "last_page":1,
        "path":"http://127.0.0.1:8080/api/ucf-projects/10263/results/340335/details",
        "per_page":"10",
        "to":3,
        "total":3
    }
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'http://127.0.0.1:8080/api/ucf-projects/10263/results/340335/details?page=1&per_page=10' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Get the ucf record url

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results/:ucf_id/record`

#### Path Parameters

| Name    | Type   | Description |
| ------- | ------ | ----------- |
| pid     | string |             |
| ucf\_id | string |             |

#### Query Parameters

| Name   | Type   | Description                                                                                                |
| ------ | ------ | ---------------------------------------------------------------------------------------------------------- |
| extend | string | The extend length(seconds) at the beginning and ending. Default is 20 seconds. The max value is 60 seconds |

#### Headers

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

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

```
{
    "stream_id":"16323",
    "begin":1590505455380,
    "end":1590505576220,
    "prefix_extend":20,
    "suffix_extend":20,
    "play_url":"https://api-v2.acrcloud.com/api/ucf-projects/10263/results/340337/play?stream_id=16323&begin=1590505455380&end=1590505576220&prefix=20&suffix=20"
}
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request GET 'https://api-v2.acrcloud.com/api/ucf-projects/10263/results/340337/record' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## Delete a ucf item

<mark style="color:red;">`DELETE`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results/:ucf_id`

#### Path Parameters

| Name                                      | Type   | Description                                                                                                                                                                                                           |
| ----------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| pid<mark style="color:red;">\*</mark>     | number | The ucf project id                                                                                                                                                                                                    |
| ucf\_id<mark style="color:red;">\*</mark> | number | The ucf id                                                                                                                                                                                                            |
| reserved                                  | number | 0 or 1, if you set to 1, the item will got into the Ignore & Reserved queue that means If the same content is detected again in the future, it will still enter this queue and will not reappear in the pending list. |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | string | Bearer token |

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

```
```

{% endtab %}
{% endtabs %}

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

```bash
curl --location --request DELETE 'https://api-v2.acrcloud.com/api/ucf-projects/results/4768035' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer token'
```

{% endtab %}
{% endtabs %}

## make a ucf item status pending

<mark style="color:green;">`POST`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results/:ucf_id/pending`

#### Path Parameters

| Name                                      | Type   | Description        |
| ----------------------------------------- | ------ | ------------------ |
| pid<mark style="color:red;">\*</mark>     | Number | The ucf project id |
| ucf\_id<mark style="color:red;">\*</mark> | Number | The ucf id         |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

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

```javascript
{
    "data": {
        "id": 2794388,
        "acr_id": "fb4e3147f7ed5b122266a754707b63ad",
        "status": 0,
        "label": 2,
        "num": 2,
        "duration_ms": 8300,
        "metadata": null,
        "operator": "",
        "created_at": "2022-02-18 15:02:39",
        "updated_at": "2022-02-21 04:37:48",
        "pid": 1
    }
}
```

{% endtab %}
{% endtabs %}

## Get one ucf item

<mark style="color:blue;">`GET`</mark> `https://api-v2.acrcloud.com/api/ucf-projects/:pid/results/:ucf_id`

#### Path Parameters

| Name                                      | Type          | Description              |
| ----------------------------------------- | ------------- | ------------------------ |
| pid<mark style="color:red;">\*</mark>     | Number        | The project id           |
| ucf\_id<mark style="color:red;">\*</mark> | Number/String | The UCF item id or acrid |

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

````json
```json
{
    "data": {
        "id": 325483111,
        "acr_id": "f111693a9ead2b2fda633543543f9d6a",
        "status": 0,
        "label": 4,
        "label_value": "",
        "num": 2,
        "duration_ms": 21760,
        "metadata": null,
        "begin_time": "2023-05-17 11:17:10",
        "fs_id": "668ad1b6-08cd-4313-b47e-79d9cc56e9aa",
        "created_at": "2023-05-18 09:42:49",
        "updated_at": "2023-05-22 07:56:33",
        "pid": 12345,
        "operators": [],
        "speech": [
            {
                "id": 0,
                "start": 0,
                "end": 2.16,
                "text": " Your U event is on at Dormezvous."
            },
            {
                "id": 1,
                "start": 2.16,
                "end": 5.68,
                "text": " For a limited time, get hot prices on your sleep essentials."
            },
            {
                "id": 2,
                "start": 5.68,
                "end": 7.32,
                "text": " Sleep well, stay well."
            },
            {
                "id": 3,
                "start": 7.32,
                "end": 8.32,
                "text": " Dormezvous."
            },
            {
                "id": 4,
                "start": 8.32,
                "end": 10.84,
                "text": " Are you thinking of a pool?"
            },
            {
                "id": 5,
                "start": 10.84,
                "end": 12.44,
                "text": " Above ground or in ground?"
            },
            {
                "id": 6,
                "start": 12.44,
                "end": 13.68,
                "text": " Trevi has good news for you."
            },
            {
                "id": 7,
                "start": 13.68,
                "end": 15.48,
                "text": " Book now and it'll be installed in June."
            },
            {
                "id": 8,
                "start": 15.48,
                "end": 20.240000000000002,
                "text": " And if you buy or rent a Trevi spa, it'll be delivered within 48 business hours."
            },
            {
                "id": 9,
                "start": 20.24,
                "end": 36.879999999999995,
                "text": " Starting Friday, take advantage of all Trevi's great weekend deals."
            }
        ]
    }
}
```
````

{% endtab %}
{% endtabs %}


# Metadata API

## Get music platforms metadata and links

<mark style="color:blue;">`GET`</mark> `https://eu-api-v2.acrcloud.com/api/external-metadata/tracks`

You can get metadata and links from the platforms(Spotify, Apple Music, Youtube, Deezer, Tidal, Gaana, AWA, KKBOX, SoundCloud)

You can test on [this page](https://console.acrcloud.com/metadata-links?#/reference).

#### Query Parameters

| Name           | Type   | Description                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| -------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| source\_url    | String | <p>the platform's url, for example::<br><a href="https://www.youtube.com/watch?v=5UMCrq-bBCg"><https://www.youtube.com/watch?v=5UMCrq-bBCg></a><br><a href="https://open.spotify.com/track/1p80LdxRV74UKvL8gnD7ky"><https://open.spotify.com/track/1p80LdxRV74UKvL8gnD7ky></a><br><a href="https://www.deezer.com/track/1290892992"><https://www.deezer.com/track/1290892992></a><br><a href="https://http/www.tidal.com/track/100366314"><br></a></p> |
| isrc           | String | ISRC                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| acr\_id        | String | ACRCloud Music ID                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| platforms      | String | <p>The platform's metadata you want to get.<br>for example:<br>spotify,youtube<br><br>The default value is: spotify,deezer,youtube,applemusic<br><br>The number of platforms in the platforms parameter of a single request cannot exceed 5.</p>                                                                                                                                                                                                       |
| query          | String | <p>Your search query, text format example: Eminem - Without Me<br><br>json format example( need to stringify the json data):<br>{"track":"Without Me", "artists":\["Eminem"]}</p>                                                                                                                                                                                                                                                                      |
| include\_works | Number | 1 or 0, if you set it to 1, the response metadata will contain the contributors and works metadata if the tracks have                                                                                                                                                                                                                                                                                                                                  |
| format         | String | query string format, text or json. Default value is text                                                                                                                                                                                                                                                                                                                                                                                               |

#### Headers

| Name                                            | Type   | Description                                                                                          |
| ----------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token. [How to create the token](https://docs.acrcloud.com/reference/console-api/accesstoken) |

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

```json
{
  "data": [
      {
          "name": "Blank Space",
          "disc_number": 1,
          "track_number": 6,
          "isrc": "USCJY1431309",
          "genres": [
              "Pop",
              "Music"
          ],
          "duration_ms": 230760,
          "release_date": "2014-01-01",
          "artists": [
              {
                  "name": "Taylor Swift"
              }
          ],
          "album": {
              "track_count": 20,
              "upc": "00602577145735",
              "release_date": "2018-10-26",
              "label": "NOW20thAnniversary",
              "cover": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/3000x3000bb.jpg",
              "covers": {
                  "small": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/64x64bb.jpg",
                  "medium": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/300x300bb.jpg",
                  "large": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/3000x3000bb.jpg"
              }
          },
          "external_metadata": {
              "applemusic": [
                  {
                      "id": "1437689373",
                      "link": "https://music.apple.com/us/album/blank-space/1437689355?i=1437689373",
                      "preview": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview112/v4/b7/20/d4/b720d476-169f-d94e-1bed-7d91d43f2883/mzaf_12311605322954569753.plus.aac.p.m4a",
                      "artists": [
                          {
                              "id": "159260351"
                          }
                      ],
                      "album": {
                          "id": "1437689355",
                          "cover": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/3000x3000bb.jpg"
                      }
                  },
                  {
                      "id": "1440933517",
                      "link": "https://music.apple.com/us/album/blank-space/1440933512?i=1440933517",
                      "preview": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview115/v4/81/bf/3d/81bf3ddc-75c0-46a3-d85b-9e79f0641a41/mzaf_2416740226777406648.plus.aac.p.m4a",
                      "artists": [
                          {
                              "id": "159260351"
                          }
                      ],
                      "album": {
                          "id": "1440933512",
                          "cover": "https://is2-ssl.mzstatic.com/image/thumb/Music124/v4/54/45/87/544587c8-3f71-8484-3fdb-186a7d7b7326/00843930013609.rgb.jpg/2400x2400bb.jpg"
                      }
                  },
                  {
                      "id": "1445765740",
                      "link": "https://music.apple.com/us/album/blank-space/1445765736?i=1445765740",
                      "preview": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview115/v4/20/3b/f8/203bf8a6-4f53-8e6b-ec00-8afd01241ebe/mzaf_2559055475772421277.plus.aac.p.m4a",
                      "artists": [
                          {
                              "id": "159260351"
                          }
                      ],
                      "album": {
                          "id": "1445765736",
                          "cover": "https://is5-ssl.mzstatic.com/image/thumb/Music124/v4/b2/38/d3/b238d354-1aec-f71b-8706-26fcb1738b6d/00843930039562.rgb.jpg/3000x3000bb.jpg"
                      }
                  }
              ],
              "deezer": [
                  {
                      "id": "89077521",
                      "link": "https://www.deezer.com/track/89077521",
                      "artists": [
                          {
                              "id": 12246
                          }
                      ],
                      "album": {
                          "id": 9007779,
                          "cover": "https://api.deezer.com/2.0/album/9007779/image"
                      }
                  }
              ],
              "youtube": [
                  {
                      "id": "dC9QIUKviJU",
                      "link": "https://music.youtube.com/watch?v=dC9QIUKviJU",
                      "artists": [
                          {
                              "id": "UCPC0L1d253x-KuMNwa05TpA",
                              "link": "https://music.youtube.com/channel/UCPC0L1d253x-KuMNwa05TpA"
                          }
                      ],
                      "album": {
                          "id": "MPREb_JiAQrbUtBdP",
                          "link": "https://music.youtube.com/browse/MPREb_JiAQrbUtBdP"
                      }
                  },
                  {
                      "id": "uakZpnmQGiE",
                      "link": "https://music.youtube.com/watch?v=uakZpnmQGiE",
                      "artists": [
                          {
                              "id": "UCPC0L1d253x-KuMNwa05TpA",
                              "link": "https://music.youtube.com/channel/UCPC0L1d253x-KuMNwa05TpA"
                          }
                      ],
                      "album": {
                          "id": "MPREb_FqCrQJ3iwcD",
                          "link": "https://music.youtube.com/browse/MPREb_FqCrQJ3iwcD"
                      }
                  },
                  {
                      "id": "QIfZAPkF7_M",
                      "link": "https://music.youtube.com/watch?v=QIfZAPkF7_M",
                      "artists": [
                          {
                              "id": "UCbhKnJtOmuOuaoY5hGwtYgA",
                              "link": "https://music.youtube.com/channel/UCbhKnJtOmuOuaoY5hGwtYgA"
                          }
                      ],
                      "album": {
                          "id": "MPREb_jucl3t8hdEz",
                          "link": "https://music.youtube.com/browse/MPREb_jucl3t8hdEz"
                      }
                  }
              ],
              "spotify": [
                  {
                      "id": "1437689373",
                      "link": "https://music.apple.com/us/album/blank-space/1437689355?i=1437689373",
                      "preview": "https://audio-ssl.itunes.apple.com/itunes-assets/AudioPreview112/v4/b7/20/d4/b720d476-169f-d94e-1bed-7d91d43f2883/mzaf_12311605322954569753.plus.aac.p.m4a",
                      "artists": [
                          {
                              "id": "159260351"
                          }
                      ],
                      "album": {
                          "id": "1437689355",
                          "cover": "https://is3-ssl.mzstatic.com/image/thumb/Music124/v4/0b/ae/32/0bae3256-7bb0-82f9-35f8-bca634c4aae8/18UMGIM62497.rgb.jpg/3000x3000bb.jpg"
                      }
                  }
              ]
          },
          "type": "track",
          "works": [
              {
                  "iswc": "T9155554271",
                  "contributors": [
                      {
                          "name": "MAX MARTIN",
                          "ipi": 254380962,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SHELLBACK ",
                          "ipi": 583608328,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SWIFT TAYLOR ALISON",
                          "ipi": 454808047,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SONY/ATV TREE PUBLISHING ",
                          "ipi": 425389934,
                          "roles": [
                              "Publisher"
                          ]
                      },
                      {
                          "name": "TAYLOR SWIFT MUSIC ",
                          "ipi": 497322918,
                          "roles": [
                              "Publisher"
                          ]
                      }
                  ],
                  "name": "BLANK SPACE VOICE MEMO"
              },
              {
                  "iswc": "T9156975165",
                  "contributors": [
                      {
                          "name": "MAX MARTIN",
                          "ipi": 254380962,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SHELLBACK ",
                          "ipi": 583608328,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SWIFT TAYLOR ALISON",
                          "ipi": 454808047,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "MXM MUSIC AB ",
                          "ipi": 657349509,
                          "roles": [
                              "Publisher"
                          ]
                      },
                      {
                          "name": "SONY/ATV TREE PUBLISHING ",
                          "ipi": 425389934,
                          "roles": [
                              "Publisher"
                          ]
                      },
                      {
                          "name": "KMR MUSIC ROYALTIES II SCSP ",
                          "ipi": 858735976,
                          "roles": [
                              "Publisher"
                          ]
                      },
                      {
                          "name": "TAYLOR SWIFT MUSIC ",
                          "ipi": 497322918,
                          "roles": [
                              "Publisher"
                          ]
                      }
                  ],
                  "name": "BLANK SPACE VOICE MEMO"
              },
              {
                  "iswc": "T9236690770",
                  "contributors": [
                      {
                          "name": "MAX MARTIN",
                          "ipi": 254380962,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SCHUSTER JOHAN KARL",
                          "ipi": 444712759,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "SWIFT TAYLOR ALISON",
                          "ipi": 454808047,
                          "roles": [
                              "Composer"
                          ]
                      },
                      {
                          "name": "PAYAMI ALI",
                          "ipi": 473985994,
                          "roles": [
                              "Composer"
                          ]
                      }
                  ],
                  "name": "BLANK SPACE/STYLE"
              }
          ]
      }
  ]
}
```

{% endtab %}
{% endtabs %}

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

```python

import requests

url = "https://eu-api-v2.acrcloud.com/api/external-metadata/tracks"
payload={}
headers = {
  'Authorization': 'Bearer your token'
}
params = {
   'query':json.dumps({"track": "jus sayin", "artists": ["steve lawler","Dateless"]}),
   'format':'json'
}
response = requests.get(url, headers=headers, params=params)

print(response.text)
```

{% endtab %}

{% tab title="NodeJs - Axios" %}

```javascript
const axios = require('axios');

let config = {
  method: 'get',
  maxBodyLength: Infinity,
  url: 'https://eu-api-v2.acrcloud.com/api/external-metadata/tracks',
  params: {
    query:JSON.stringify({"track": "jus sayin", "artists": ["steve lawler", "Dateless"]}),
    format:'json'
  },
  headers: { 
    'Authorization': 'Bearer YOUR_TOKEN'
  }
};

axios.request(config)
.then((response) => {
  console.log(JSON.stringify(response.data));
})
.catch((error) => {
  console.log(error);
});

```

{% endtab %}
{% endtabs %}


# Audio File Fingerprinting Tool

## Downloads

{% embed url="<https://github.com/acrcloud/acrcloud_extr_tools>" %}

## Usage

```
Usage: ./acr_extr [options] [-i infile]
For Example:
    # ./acr_extr -i inputfile
    # ./acr_extr -i inputfile -o outputfile

Getting help:
   -h      -- print basic options
   -v      -- print vertion

Options:
   -i           input file. 
  
   -o           Output file. If do not have this option, dir of output file is the same with input file.

   -au          If you add this option, it will save the audio data as decoded from input file(formatter: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 16 bit, mono 8000 Hz). 

                 example: ./acrcloud_extr -au -i inputfile

   --debug      If you add this option, it will print all infomation.
```


# Local Monitoring Tool

### Overview

This tool is used for [ACRCloud Local Broadcast Monitoring Service](https://console.acrcloud.com/bm#/dashboard)

Local Broadcast Monitoring System([GitHub](https://github.com/acrcloud/acrcloud_local_monitor)) is used to monitor live radio streams on your own local server.

### Requirements

* Python 2.7
* Works on Linux/Windows
* Follow one of the tutorials to create a project and get your host, access\_key.
  * [Broadcast Monitoring for Music](/get-started/tutorials/broadcast-monitoring-for-music)
  * [Broadcast Monitoring for Custom Content](/get-started/tutorials/broadcast-monitoring-for-custom-content)

### How To Use

1. You should register an account on the [ACRCloud platform](https://console.acrcloud.com/), and create a [Broadcast Monitoring project](/get-started/tutorials/broadcast-monitoring-for-music) with local monitoring type, you will get access\_key, then add your live radio streams in your project.
2. Clone the code in your local server.
3. Install MySQL, import acrcloud\_database.sql to your mysql server. `$mysql -uroot -p < acrcloud_database.sql`.
4. Modify configuration file (acrcloud\_config.py), fill access\_key, access\_secret and database info in the config file.
5. Run `python acrcloud_local_server.py` to start monitor server.
6. You can use client to refresh, get stream state, pause and restart stream, run `python acrcloud_client.py`.
7. You can use `Ctrl + \` to stop monitor server (in Linux).
8. You can get monitoring results in your MySql database.
9. If you want to record recognize audio, you can set config\["record"]\["record"]=3 (default is 0 and it means not record).<br>

   You can set config\["record"]\["record\_dir"] to specify the save path.<br>

   You can set config\["record"]\["record\_save\_days"] to specify the keep days of record files.<br>

   These config can be set in "acrcloud\_config.py"

### Python Dependency Library

1. [Twisted](https://github.com/twisted/twisted)
2. [requests](https://pypi.org/project/requests/)
3. [fuzzywuzzy](https://github.com/seatgeek/fuzzywuzzy)
4. [beautifulsoup4](https://pypi.python.org/pypi/beautifulsoup4)
5. [MySQL-Python](https://pypi.python.org/pypi/MySQL-python)

### Install on Windows

1. Install Windows Runtime Library
   * X86: [download and install Library(vcredist\_x86.exe)](https://www.microsoft.com/en-us/download/details.aspx?id=5555)
   * x64: [download and install Library(vcredist\_x64.exe)](https://www.microsoft.com/en-us/download/details.aspx?id=14632)
2. Install [Mysql](https://dev.mysql.com/downloads/installer/) on your windows
3. Create Databases(in acrcloud\_local\_monitor direction and run this command)

   `mysql -uroot -p < acrcloud_database.sql`
4. Install [Python](https://www.python.org/downloads/)
5. Install Python Dependency Library(in acrcloud\_local\_monitor direction and run the script)

   `.\install_python_packages_for_windows.bat`
6. Install [MySQL-python](https://pypi.org/project/MySQL-python/1.2.5/)
   * Open [https://www.lfd.uci.edu/\~gohlke/pythonlibs/](https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python)
   * Find and Download:

     `MySQL_python‑1.2.5‑cp27‑none‑win32.whl (or MySQL_python‑1.2.5‑cp27‑none‑win_amd64.whl)`
   * `python -m pip install MySQL_python‑1.2.5‑cp27‑none‑win32.whl`
   * `python -m pip install mysql-python`
7. Copy the ACRCloud Library into the acrcloud\_local\_monitor direction according to your system.
   * X86: copy from winlibs/win32/acrcloud\_stream\_decode.pyd to acrcloud\_local\_monitor direction
   * X64: copy from winlibs/win64/acrcloud\_stream\_decode.pyd to acrcloud\_local\_monitor direction
8. If you have created Local Project and add some streams, config the acrcloud\_config.py with your access\_key, and mysql information, then start the local server

   `python acrcloud_local_server.py`
9. Stop the local monitor server

   `python acrcloud_stop.py` and Ctrl-C

### Run as a Docker Container

1. Install Docker
   * If you are using Windows: Download [Docker Desktop for Windows](https://download.docker.com/win/stable/Docker%20for%20Windows%20Installer.exe) and install.
   * If you are using MacOs: Download [Docker Desktop for Mac](https://download.docker.com/mac/stable/Docker.dmg) and install.
   * If you are using Linux: Open the Terminal and input bash <(curl -s <https://get.docker.com/>)
2. Run following command
   * `git clone https://github.com/acrcloud/acrcloud_local_monitor`
   * `cd acrcloud_local_monitor`
   * Change the config file "acrcloud\_config.py", fill in your project "access\_key", and mysql setting(host, port, user, passwd), **if Mysql was installed in your computer, please create a remote user and set field "host" to your private IP(ifconfig in Linux or ipconfig in Windows, "host.docker.internal" in Mac OS)**
   * `docker build -t acrcloud/acr_local_monitor_image:v1 .`
   * `docker run --rm -itv /<Change to your directory>/acrcloud_local_monitor:/docker_local_monitor --name="acr_local_monitor" acrcloud/acr_local_monitor_image:v1`


# Live Channel Fingerprinting Tool

## Introduction

* The Live Channel Fingerprinting Tool ([Download](https://github.com/acrcloud/live_stream_client)) is used for extracting and uploading features from live TV channel streams in real-time.
* After the app is integrated, our SDK can detect your channels by recording the audio for just a few seconds in real-time.
* We assume that this tool will be running on your server, which already has quick network access to the streams so that our system guarantees the Real-Time performance to detect the live channels.

## Preparations

* Before using this tool, you must register on our platform and log into your dashboard.
* Sign up now for a free 14 day trial: <http://console.acrcloud.com/signup>
* Create a “Live Channel” bucket and add the url of your streams into it.
* [**Create a console access key pairs on account page**](https://console.acrcloud.com/account/keys#/old-accesskeys) and input this key pairs to your client.conf file
* Input your Live Bucket Name to the client.conf file.
* Run the stream.py
* Create a “Live Channel Detection” project and attach the bucket which contains your chosen stream urls.
* Then you can use our SDK to detect the current stream.

## **Install**

How to run:

1\) Download the tool.

`git clone https://github.com/acrcloud/live_stream_client live_stream_client`

2\) Enter the operating system you use.

`cd Linux/x86-64`

3\) Edit the client.conf file and replace the console key pairs ( access\_key, access\_secret ), bucket\_name with your own.

`python stream.py client.conf`

or

`nohup python stream.py client.conf &`

How to update/add stream URL:

1\) Update/add stream URL to the Live Channel Bucket on the [Console](https://console.acrcloud.com/)

2\) Kill stream.py process in your server.

`ps -ef | grep stream.py | grep -v grep | awk '{print $2}'| xargs kill -9`

3\) Restart the stream.py

`python stream.py client.conf`

or

`nohup python stream.py client.conf &`

## How to use the timeshifted feature?

1. Create a LiveTimeshift bucket, set the bucket type “LiveTimeshift”.
2. Enable the timeshift feature for the live channels in the Live bucket
3. Import the live channels to the LiveTimeshift bucket

## How to check the live fingerprinting status?

1. Login to your account from [Console](http://console.acrcloud.com/)
2. Make sure you are in the region where you send the live fingerprinting
3. Click “Live channel” under the bucket
4. Click in the bucket you build for the channels and see each status of the channel

**Processing: The real-time fingerprint of the stream has not yet reached the platform.**

![](/files/-MQpzNMpbDq4jDKwJ-ZS)

**Ready: The fingerprint of the live stream is ready for detection**

![](/files/-MQpzS3W4Z0pkSfd0L3A)


# File Scan Tool

## Download

{% embed url="<https://github.com/acrcloud/acrcloud_scan_files_python3>" %}


# Definition of Terms

## 3rd Party ID Integration <a href="#id-3rdpartyid" id="id-3rdpartyid"></a>

We integrate popular 3rd party music related services to display their ID’s in our recognition results, this means our clients can easily link our recognition results with other services.

Supported 3rd party IDs:

* ISRC
* UPC
* [Spotify](https://www.spotify.com/)
* [Deezer](http://www.deezer.com/)
* [YouTube](https://www.youtube.com/)
* [MusicBrainz](https://musicbrainz.org/)

## Brand Exposure <a href="#brand-exposure" id="brand-exposure"></a>

If you choose the plan with “Brand Exposure Required” then please follow the rules to expose our brand appropriately within your project. Place the text, logo and link where you use or display the recognition results.

For more information of how to expose the brand please refer to [Branding & Attribution Guidelines](https://www.acrcloud.com/branding).

## Broadcast Monitoring Status <a href="#monitoringstatus" id="monitoringstatus"></a>

| Status      | Description                                                                                                                                                                 |
| ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Running     | The stream is working                                                                                                                                                       |
| Timeout     | The stream is currently not stable, no results will be shown at the moment, the system will try to rectify the stream, and in the meantime why not use another stream link. |
| Invalid URL | The stream URL has a problem, our system can not access the stream, please check the stream or change to another stream URL.                                                |
| Paused      | The stream was paused temporarily, you may need to restart the stream.                                                                                                      |

## Valid Request <a href="#validrequest" id="validrequest"></a>

Valid Requests = Requests with results + Requests with no results/2

## Monitoring Type <a href="#monitortype" id="monitortype"></a>

Monitor streams on ACRCloud: The streams will be captured on ACRCloud, you will need to collect the internet stream URLs and input them on ACRCloud system.

Monitor streams on your local server: The streams will be captured on your own server, this option requires you to prepare your own server to capture streams but the recognition part will be done on ACRCloud system.

## Terminology <a href="#terminology" id="terminology"></a>

To clarify our terminology in EDM and mixes:

**Speed Scaling**: If both scales of time and speed are changed proportionally, we call this a change in “speed”: the song is played faster and at the same time at a higher pitch. This can be achieved by simply changing the rotational speed of the turntable, or by modifying the sampling rate of a digital media player – while keeping the sampling rate of the audio encoding unchanged.

**Tempo Shifting/Time Scaling**: Changing the time scale only will be referred to as a “tempo” change: here, the audio is sped up or slowed down without observable changes in pitch.

**Pitch Shifting/Frequency Scaling**: If only the frequency scale is modified but time is not scaled, this will be called pitch shifting.


# Service Usage

## Difference Between Custom Files and Live Channel Bucket

#### **Custom Files Bucket**

Manage fingerprints of digital content which are in file format. The developer can upload the audio / video file of the content to ACRCloud bucket as the identification sample. For example advertisement audios.

Files can be uploaded to the bucket so it can be used as fingerprint samples for content monitoring and second screen triggering.

#### **Live Channel Bucket**

Manage real time fingerprints of the digitized **streaming** content like the broadcast of TV or radio channels. Live stream is from an encoder and in a format of url under common protocols (udp, http, rtsp,mms) such as ( udp\://192.168.1.2 or [http://192.168.1.1](http://192.168.1.1/))

## Difference Between Live Channel Detection and Broadcast Monitoring projects

#### Live Channel Detection

This kind of project is for making second screen apps, which **recognize** the **live channel signal itself** to know which channel the audiences are watching.

You need to manage **Live Channel Buckets** and deploy the [Live Channel Fingerprinting Tool](https://www.acrcloud.com/docs/fingerprinting-tools/live-channel-fingerprinting-tool/) on your local server to ingest real time fingerprints of live channels into your Live Channel bucket then the mobile SDK can detect the live channel ID.

#### Broadcast Monitoring

Broadcast Monitoring project is used to **recognize** **music** or **custom** **content** such as commercials played on broadcast ( radio or tv ).

You need to manage **Custom Files Buckets** to upload your own files you want to monitor.

## How to Check Usage Statistics?

The statistics can be found by the project under detail section of the project you built.

## How to Choose Client-End Audio Source?

### **Explanation**

#### Recorded Audio

This source of audio always introduces noise with the content you want to recognize.

Typically the **audio captured via microphone** and the **recording files with noise** should be using this type of source.

#### Line-in Audio

This source of audio should be the **original files or the audio without noise**.

{% hint style="info" %}
*Recorded Audio is more sensitive than Line-in Audio in recognition, but that doesn’t mean you can always use Recorded Audio in all of scenarios, it would be more false positions if you use Recording Audio in the scenarios should be using Line-in Audio.*
{% endhint %}

### **Scenario**

#### Recorded Audio

* You want to make a Shazam alike app to recognize music or TV from the audio captured via microphone.
* You want to recognize background music over the TV drama, movies or TV shows.
  * Although in this scenario you want to recognize something in the recording files, but background music in this kind of content always with people talks and other kind of noise alone with the music.

#### Line-in Audio

* You want to recognize original files of music to get metadata.
* You want to recognize music or commercials from recording files of radio live streams.

## What is a valid Stream URL?

1. Make sure the stream URL can be played by player like VLC.
2. Make sure the stream can be played on the server which you install the fingerprint extract tools.
3. (Optional) If you do live channel detection on TV broadcast, make sure the stream play status is not slower than what is showing on the audience’s TV.

## Why there is “record error” from the SDK?

{“status”:{“code”:2000,”msg”:”record error”,”version”:”1.0″}}

It happens to appear with Android phones when the app has no authorization for recording. Please authorize the recording for the app from settings. In some circumstance, the tool category app will kill the recording authorization from other apps.

P.s. Android emulator does not support recording function, so it can’t work. Please use an android phone instead.

## Define metadata templates for custom buckets

You can add multiple custom metadata fields to the buckets by adding a metadata template to the bucket, it will let you add custom metadata fields efficiently.

You can add multiple metadata fields and separate them with commas:

![](/files/-MQuvjyo0F7HZQOdwv_B)

You will find the metadata fields you added in the User-defined Fields as below:

![](/files/-MQuvqx7ffqM1AZ_o3kW)

## Live Channel Bucket Types

There are 2 types of Live Channel buckets:

* Ingest from local server: You will need to setup the local server for ingesting the live channels;
* Import from existing channels: If you already have the existing live channels in your buckets or you want to use the public live channels shared by others, you can select this type of bucket and import the existing channels. You don’t need to have the local server to ingest the live channels;


# AI Music Detection

This FAQ explains how ACRCloud's AI Music Detection feature works for audio content, including prediction thresholds, output interpretation, supported source categories, and performance notes.

***

### What does AI Music Detection do?

ACRCloud's AI Music Detection feature helps customers assess whether submitted audio content is more likely to be AI-generated or human-created.

It is designed to support content inspection and risk assessment workflows. Detection results should be interpreted as model outputs based on statistical patterns in the audio, rather than as definitive proof of origin.

***

### How does AI Music Detection work?

ACRCloud uses advanced, state-of-the-art detection technology to train specialized models for identifying whether audio content is AI-generated or human-created.

For each inspected audio file, the system returns:

* a binary prediction result
* an `ai_probability` score
* `source_probabilities` for supported source categories

Both `ai_probability` and `source_probabilities` are generated directly by the model and are not manually adjusted or post-processed by human operators.

***

### What threshold determines `ai_generated` vs. `human`?

The current threshold is **50%**.

* If `ai_probability >= 50%`, the output is `ai_generated`
* If `ai_probability < 50%`, the output is `human`

***

### Is AI Detection generally available?

Yes. AI Detection is **generally available** and has been officially released.

***

### What performance data is available?

The following figures are based on ACRCloud's internal evaluation dataset for the current model version.

#### Binary Confusion Matrix (Human vs. AI)

* **Precision (AI): 99.98%**
* **Recall (AI): 99.94%**
* **False Positive Rate: 0.06% of Human**
* **False Negative Rate: 0.06% of AI**

#### Per-Source Accuracy

* **human**: 99.91%
* **suno**: 99.86%
* **udio**: 99.93%
* **sonauto**: 98.81%
* **mureka**: 99.99%
* **rdiffusion**: 98.00%

> These results reflect performance on internal test data and are provided for reference only. Actual performance may vary depending on audio quality, transformations, compression, mixing, editing, and real-world usage conditions.

***

### What source categories are currently supported?

The currently supported source categories exposed in the platform include:

* `human`
* `suno`
* `udio`
* `sonauto`
* `mureka`
* `rdiffusion`

We are actively expanding supported source coverage and are working to include additional model sources such as **ElevenLabs**, **MiniMax**, and **Seed-Music**.

Supported source coverage may continue to evolve over time as generative audio models and market usage change.

***

### How should `ai_probability` and `source_probabilities` be interpreted?

We recommend that customers interpret the output as follows:

* Use the **binary prediction** for straightforward workflow decisions
* Use **`ai_probability`** as a confidence reference
* Use **`source_probabilities`** as supporting signals for source attribution analysis
* Consider the result together with other contextual or operational signals where appropriate

Both `ai_probability` and `source_probabilities` are direct outputs from the model itself.

Detection results should not be treated as the sole basis for legal, enforcement, or other high-impact decisions without additional review.

***

### Notes

* Detection results are probabilistic model outputs, not definitive proof of origin.
* Performance may vary across different content types and real-world conditions.
* Supported source categories may be updated over time as the model evolves.
* Third-party model or product names are used only to describe detection coverage and do not imply partnership, endorsement, or affiliation.

***

### Suggested Disclaimer

The AI Detection feature provides probabilistic model outputs based on patterns identified in submitted audio content. Results are intended to assist review and inspection workflows and should not be interpreted as definitive proof of content origin. Performance metrics shown in this document are based on internal evaluation data and may vary in real-world use cases.


