# Tiktok Trending Songs Analytics (`codebyte/tiktok-trending-songs-analytics`) Actor

Unlock TikTok's trending songs and music with comprehensive analytics and audience insights. Gather data on music trends by country. Find trending commercial music to supercharge your TikTok content strategy.

- **URL**: https://apify.com/codebyte/tiktok-trending-songs-analytics.md
- **Developed by:** [Codebyte](https://apify.com/codebyte) (community)
- **Categories:** Social media, E-commerce
- **Stats:** 150 total users, 9 monthly users, 100.0% runs succeeded, 14 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00/month + usage

To use this Actor, you pay a monthly rental fee to the developer. The rent is subtracted from your prepaid usage every month after the free trial period.You also pay for the Apify platform usage, which gets cheaper the higher Apify subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#rental-actors

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## TikTok Trending Songs Analytics

Discover new trends on TikTok through songs.
Get comprehensive analytics and insights for music on TikTok. 

### Key Features
- Get the top 100 trending songs for each country in the last 7/30/120 days
- Get detailed analytics for trending music
- Analyze audience demographics and age distribution
- Discover related interests and regional popularity
- Find trending songs and related videos

Perfect for social media managers, content creators, and marketing professionals who want to leverage data-driven insights for their TikTok strategy.

## Input

#### Rank Type
Popular - A ranked list of the most popular songs within the region and timeframe you selected.
Will return up to 100 results depending on region and filters used.

Surging - A ranked list of songs that are growing at a significant rate, within the region and timeframe you selected.
Will usually return 15-30 results depending on region and filters used.

To start, select the type of result you want to retrieve.

#### Top 100 ranking only
Retrieve the top 100 trending songs for a given country and time frame.
```json
{
    "result_type": "top100",
    "country": "US",
    "period": "7",
    "top100_rank_type": "popular",
    "top100_commercial_music": false,
    "top100_new_on_board": false
}
````

#### Example output

```json
[
    {
        "author": "SlvixalBoy",
        "clip_id": "7373935903716935681",
        "cml_mid": "7375041366630957057",
        "country_code": "US",
        "cover": "https://p16-sg.tiktokcdn.com/aweme/720x720/tos-alisg-v-2774/ogmFaZiWZER7EBAEaApYr4UAAAllERbLiBBgv.jpeg",
        "duration": 106,
        "if_cml": true,
        "is_search": false,
        "link": "https://www.tiktok.com/music/x-7373935903716935681",
        "music_url": "https://sf19-ies-music-sg.tiktokcdn.com/obj/tos-alisg-ve-2774/oAXtWVgKWFa2CBQT5mqrZSgDuEQpfB0DYqe68i",
        "on_list_times": null,
        "promoted": false,
        "rank": 21,
        "rank_diff": null,
        "rank_diff_type": 4,
        "related_items": [
            {
                "item_id": 7457282630245993000,
                "cover_uri": "https://p16-sign-va.tiktokcdn.com/tos-maliva-p-0068c799-us/oQW9YPqiqzILBIJEHAizAlhBw3pWTB5xfsvCJx~tplv-noop.image?x-expires=1736808674&x-signature=9eaeo7zSrOqUvX4QTq8F2palgzo%3D"
            },
            ...
        ],
        "song_id": "7373935879872759825",
        "title": "Tropical Sunshine",
        "trend": [
            {
                "time": 1736121600,
                "value": 1
            },
            ...
        ],
        "url_title": "Tropical-Sunshine",
        "period": "7",
        "rank_change_readable": "New"
    },
    ...
]
```

#### Top 100 ranking including song analytics

Retrieve the top 100 trending songs for a given country and time frame, including song analytics.

```json
{
    "result_type": "top100_with_analytics",
    "country": "US",
    "period": "7",
    "top100_rank_type": "popular",
    "top100_commercial_music": false,
    "top100_new_on_board": false
}
```

#### Example output excerpt

```json
[
    ...
    "analytics": {
            "audience_ages": [
                {
                    "age_level": 3,
                    "score": 100
                }
            ],
            "audience_countries": [
                {
                    "country_info": {
                        "id": "2635167",
                        "label": "GB",
                        "value": "United Kingdom"
                    },
                    "score": 771
                },
                ...
            ],
            "audience_interests": [
                {
                    "interest_info": {
                        "id": "10057",
                        "label": "diversify_10057",
                        "value": "Non-Video Games"
                    },
                    "score": 304
                },
                ...
            ],
            "author": "SlvixalBoy",
            "clip_id": "7373935903716935681",
            "cml_mid": "7375041366630957057",
            "country_code": "US",
            "cover": "https://p16-sg.tiktokcdn.com/aweme/720x720/tos-alisg-v-2774/ogmFaZiWZER7EBAEaApYr4UAAAllERbLiBBgv.jpeg",
            "duration": 106,
            "if_cml": true,
            "is_search": false,
            "link": "https://www.tiktok.com/music/x-7373935903716935681",
            "longevity": {
                "popular_days": 0,
                "current_popularity": 0
            },
            "music_url": "https://sf19-ies-music-sg.tiktokcdn.com/obj/tos-alisg-ve-2774/oAXtWVgKWFa2CBQT5mqrZSgDuEQpfB0DYqe68i",
            "on_list_times": null,
            "promoted": false,
            "rank": null,
            "rank_diff": null,
            "related_items": [
                {
                    "item_id": 7457282630245993000,
                    "cover_uri": "https://p16-sign-va.tiktokcdn.com/tos-maliva-p-0068c799-us/oQW9YPqiqzILBIJEHAizAlhBw3pWTB5xfsvCJx~tplv-noop.image?x-expires=1736808675&x-signature=Ko9yK2IkHm6cGQgP3Glby2e1b4M%3D"
                },
                ...
            ],
            "song_id": "7373935879872759825",
            "title": "Tropical Sunshine",
            "trend": [
                {
                    "time": 1736121600,
                    "value": 1
                },
                ...
            ],
            "url_title": "Tropical-Sunshine",
            "audience_ages_readable": [
                {
                    "age_range": "18-24",
                    "score": 100
                }
            ]
        }
]
```

#### Song analytics only

Retrieve detailed analytics for a custom list of music/clip ids.
For this example url https://www.tiktok.com/music/x-7373935903716935681 use 7373935903716935681 as id

```json
{
    "result_type": "analytics",
    "song_list": ["7373935903716935681"],
    "country": "US",
    "period": "30"
}
```

If a song you provide is not popular enough (in this country and period), TikTok will not return any data for this song.

## Insights that song analytics can provide

### Interest over time

Each data point compares the relative volume against the peak volume of the trend. A value of 100 is the peak popularity for the trend.

### Audience insights

Information about viewers that watch videos associated with this trend.

#### Age range

The approximate percentage of viewers associated with different age ranges. Only available for age ranges above 18 years old.

#### Related interests

The top interests associated with viewers of this trend. The value represents an index score. Example: If the score is 200, the interest category is 2x as popular with viewers of this trend compared to its average popularity on TikTok worldwide.

#### Regional popularity

The top locations in the world where this term is most popular. The value represents an index score. Example: If the score is 200, the trend is 2x as popular in this market compared to its average popularity on TikTok worldwide.

#### Related videos

Trending videos that use this song in the selected region and time frame.

# Actor input Schema

## `result_type` (type: `string`):

Select the type of result you want the actor to retrieve. Top 100 ranking only, top 100 ranking including song analytics or song analytics for a custom list of music/clip ids.

## `country` (type: `string`):

Select the country for which you want to retrieve the top ranking songs / song analytics.

## `period` (type: `string`):

Select the period for which you want to retrieve the top ranking songs / song analytics.

## `top100_rank_type` (type: `string`):

Select the ranking type. Popular will return the most popular songs up to 100 results. Surging will usually return 15-30 songs that are growing in popularity at a significant rate.

## `top100_new_on_board` (type: `boolean`):

For top 100 ranking, only return entries that are new to the top 100 for this period.

## `top100_commercial_music` (type: `boolean`):

For top 100 ranking, only return entries that are commercial music.

## `song_list` (type: `array`):

List of music/clip ids for which you want to retrieve analytics. For the example url https://www.tiktok.com/music/x-7373935903716935681 use 7373935903716935681 as id

## Actor input object example

```json
{
  "result_type": "top100",
  "country": "US",
  "period": "7",
  "top100_rank_type": "popular",
  "top100_new_on_board": false,
  "top100_commercial_music": false
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "result_type": "top100"
};

// Run the Actor and wait for it to finish
const run = await client.actor("codebyte/tiktok-trending-songs-analytics").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "result_type": "top100" }

# Run the Actor and wait for it to finish
run = client.actor("codebyte/tiktok-trending-songs-analytics").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "result_type": "top100"
}' |
apify call codebyte/tiktok-trending-songs-analytics --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=codebyte/tiktok-trending-songs-analytics",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Tiktok Trending Songs Analytics",
        "description": "Unlock TikTok's trending songs and music with comprehensive analytics and audience insights. Gather data on music trends by country. Find trending commercial music to supercharge your TikTok content strategy.",
        "version": "0.0",
        "x-build-id": "x9S8LcjoSdbx1N2ND"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/codebyte~tiktok-trending-songs-analytics/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-codebyte-tiktok-trending-songs-analytics",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/codebyte~tiktok-trending-songs-analytics/runs": {
            "post": {
                "operationId": "runs-sync-codebyte-tiktok-trending-songs-analytics",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/codebyte~tiktok-trending-songs-analytics/run-sync": {
            "post": {
                "operationId": "run-sync-codebyte-tiktok-trending-songs-analytics",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "result_type"
                ],
                "properties": {
                    "result_type": {
                        "title": "Result type",
                        "enum": [
                            "top100",
                            "top100_with_analytics",
                            "analytics"
                        ],
                        "type": "string",
                        "description": "Select the type of result you want the actor to retrieve. Top 100 ranking only, top 100 ranking including song analytics or song analytics for a custom list of music/clip ids."
                    },
                    "country": {
                        "title": "Country",
                        "enum": [
                            "AR",
                            "AU",
                            "AT",
                            "BH",
                            "BD",
                            "BY",
                            "BE",
                            "BR",
                            "BG",
                            "KH",
                            "CA",
                            "CL",
                            "CO",
                            "HR",
                            "CZ",
                            "DK",
                            "EG",
                            "EE",
                            "FI",
                            "FR",
                            "DE",
                            "GR",
                            "HU",
                            "IS",
                            "ID",
                            "IQ",
                            "IE",
                            "IL",
                            "IT",
                            "JP",
                            "JO",
                            "KZ",
                            "KW",
                            "LV",
                            "LB",
                            "LT",
                            "LU",
                            "MO",
                            "MY",
                            "MX",
                            "MA",
                            "MM",
                            "NL",
                            "NZ",
                            "NG",
                            "NO",
                            "OM",
                            "PK",
                            "PE",
                            "PH",
                            "PL",
                            "PT",
                            "QA",
                            "RO",
                            "SA",
                            "SG",
                            "SK",
                            "ZA",
                            "KR",
                            "ES",
                            "SE",
                            "CH",
                            "TW",
                            "TH",
                            "TR",
                            "UA",
                            "AE",
                            "GB",
                            "US",
                            "UZ",
                            "VN"
                        ],
                        "type": "string",
                        "description": "Select the country for which you want to retrieve the top ranking songs / song analytics.",
                        "default": "US"
                    },
                    "period": {
                        "title": "Period in days",
                        "enum": [
                            "7",
                            "30",
                            "120"
                        ],
                        "type": "string",
                        "description": "Select the period for which you want to retrieve the top ranking songs / song analytics.",
                        "default": "7"
                    },
                    "top100_rank_type": {
                        "title": "Top 100 ranking type",
                        "enum": [
                            "popular",
                            "surging"
                        ],
                        "type": "string",
                        "description": "Select the ranking type. Popular will return the most popular songs up to 100 results. Surging will usually return 15-30 songs that are growing in popularity at a significant rate.",
                        "default": "popular"
                    },
                    "top100_new_on_board": {
                        "title": "New to top 100 only",
                        "type": "boolean",
                        "description": "For top 100 ranking, only return entries that are new to the top 100 for this period.",
                        "default": false
                    },
                    "top100_commercial_music": {
                        "title": "Commercial music only",
                        "type": "boolean",
                        "description": "For top 100 ranking, only return entries that are commercial music.",
                        "default": false
                    },
                    "song_list": {
                        "title": "List of music/clip ids (result_type = analytics)",
                        "type": "array",
                        "description": "List of music/clip ids for which you want to retrieve analytics. For the example url https://www.tiktok.com/music/x-7373935903716935681 use 7373935903716935681 as id",
                        "items": {
                            "type": "string"
                        }
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
