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


---

# 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/custom-streams-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.
