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

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.acrcloud.com/reference/console-api/bm-projects/custom-streams-projects/streams-results.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
