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


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.acrcloud.com/reference/console-api/bm-projects/broadcast-database-projects.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
