# TikTok Music Trend API (`novi/tiktok-music-trend-api`) Actor

TikTok Trending Music Scraper. Get real-time insights into popular sounds, discover new artists, and fuel your music discovery applications.

- **URL**: https://apify.com/novi/tiktok-music-trend-api.md
- **Developed by:** [Novi](https://apify.com/novi) (community)
- **Categories:** Social media, Lead generation, AI
- **Features:** Full permissions
- **Stats:** 194 total users, 2 monthly users, 100.0% runs succeeded, 8 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-usage

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## TikTok Music Trend API

This is a **powerful TikTok scraper** that allows you to extract various types of data from TikTok, such as trending music in your country.

Since TikTok doesn't provide a good and free API, this actor should help you to retrieve data from it as an Unofficial
API.

**The TikTok Music Trend data API supports the following features:**

- **Trending Music In Your country.**

- **Music details** - Get any music information.

### Bugs, fixes, updates and changelog

This scraper is under active development. If you have any feature requests you can create an issue from here.

### Input Parameters

The input of this scraper should be JSON containing the list of pages on Tiktok Music Trend API that should be visited.
Required fields are:

| **FIELD**          | **Type**                   | **Description**                                           |     |     |
|--------------------|----------------------------|-----------------------------------------------------------|-----|-----|
| limit              | Integer                    | You can limit scraped results.                            |     |     |
| region             | String                     | 2 characters region code. Ex: US.                         |     |     |
|                    |                            |                                                           |     |     |

### Compute Unit Consumption

The actor optimized to run blazing fast and scrape many as listings as possible. Therefore, it forefronts all listing
detail requests. If actor doesn't block very often it'll scrape 100 listings in 1 minutes with ~0.001 compute units.

TikTok Music Trend API Scraper Input example

```
{
    "region": "US",
    "limit": 10
}
```

### During the Run

During the run, the actor will output messages letting you know what is going on. Each message always contains a short
label specifying which page from the provided list is currently specified. When items are loaded from the page, you
should see a message about this event with a loaded item count and total item count for each page.

If you provide incorrect input to the actor, it will immediately stop with failure state and output an explanation of
what is wrong.

### Tiktok  Music Trend API Export

During the run, the actor stores results into a dataset. Each item is a separate item in the dataset.

You can manage the results in any language (Python, PHP, Node JS/NPM). See the FAQ or our API references to learn more
about getting results from this TikTok Music Trend API actor.

#### Item Detail

```json
[
  {
    "artists": null,
    "author": "Happy New Year",
    "author_position": null,
    "cover_large": {
      "height": 720,
      "uri": "tos-alisg-v-2774/13d12608283d48109381420cd82f7403",
      "url_list": [
        "https://p16-sign-sg.tiktokcdn.com/tos-alisg-v-2774/13d12608283d48109381420cd82f7403~720x720.jpeg?lk3s=08d74b56\u0026x-expires=1732656955\u0026x-signature=N73ScRM46o6gGh31211nxFrZiTA%3D"
      ],
      "url_prefix": null,
      "width": 720
    },
    "cover_medium": {
      "height": 720,
      "uri": "tos-alisg-v-2774/13d12608283d48109381420cd82f7403",
      "url_list": [
        "https://p16-sign-sg.tiktokcdn.com/tos-alisg-v-2774/13d12608283d48109381420cd82f7403~200x200.jpeg?lk3s=08d74b56\u0026x-expires=1732656955\u0026x-signature=F5QyimvV8P7EYYBb7zGNOejmDUY%3D"
      ],
      "url_prefix": null,
      "width": 720
    },
    "cover_thumb": {
      "height": 720,
      "uri": "tos-alisg-v-2774/13d12608283d48109381420cd82f7403",
      "url_list": [
        "https://p16-sign-sg.tiktokcdn.com/tos-alisg-v-2774/13d12608283d48109381420cd82f7403~100x100.jpeg?lk3s=08d74b56\u0026x-expires=1732656955\u0026x-signature=qoRY31w40%2Fj%2BKT64gthAbDQuAfg%3D"
      ],
      "url_prefix": null,
      "width": 720
    },
    "duration": 60,
    "external_song_info": null,
    "extra": "{\"amplitude_peak\":0.97009987,\"beats\":{\"audio_effect_onset\":\"https://sf16-music-sign.tiktokcdn.com/obj/tos-alisg-v-2774/543f352ee8bd4038a9d82447b378b2f1?lk3s=08d74b56\\u0026x-expires=1732656955\\u0026x-signature=W155PXJs2W7xpX3f2e7U%2FkeV0rc%3D\",\"beats_tracker\":\"https://sf16-music-sign.tiktokcdn.com/obj/tos-alisg-v-2774/859a57e4064249f09f763d5179dc6e19?lk3s=08d74b56\\u0026x-expires=1732656955\\u0026x-signature=nBB5UcPWv%2FlbltfHqzLg6XPhER0%3D\",\"energy_trace\":\"https://sf16-music-sign.tiktokcdn.com/obj/tos-alisg-v-2774/4977a388c37d41998a8f704176a05719?lk3s=08d74b56\\u0026x-expires=1732656955\\u0026x-signature=5St8sbSjOBMSLaSTCMwLuIUJ0h4%3D\",\"merged_beats\":\"https://sf16-music-sign.tiktokcdn.com/obj/tos-alisg-v-2774/49d43db2d49c4a9ab198cb76eafb37ad?lk3s=08d74b56\\u0026x-expires=1732656955\\u0026x-signature=bqb7gBPmtFhEuQ7DZqc2Wmj8zNs%3D\"},\"can_read\":true,\"can_reuse\":true,\"erase_type\":0,\"erase_uid\":0,\"filter_reason\":\"not_commerce\",\"from_user_id\":0,\"full_song_beat_info\":{},\"full_song_beats\":{},\"has_edited\":0,\"is_batch_take_down_music\":false,\"is_ugc_mapping\":false,\"is_used\":0,\"loudness_lufs\":-9.540354,\"music_vid\":\"v10ad6g50000cecl1cjc77u6qcma2f90\",\"original_song_url\":\"https://sf16-music-sign.tiktokcdn.com/obj/tos-alisg-ve-2774/oYIWZfx0KA1PAyzKUNY2xoOwhnUySzGZhGhBsM?lk3s=08d74b56\\u0026x-expires=1732656955\\u0026x-signature=%2ByNpqILjfhy8UBhY9wPGtFhbELQ%3D\",\"owner_id\":0,\"resource_status\":0,\"review_unshelve_reason\":0,\"reviewed\":1,\"schedule_search_time\":0}",
    "id": 7090803692152031234,
    "id_str": "7090803692152031234",
    "is_original": false,
    "lyric_short_position": null,
    "mid": "7090803692152031234",
    "multi_bit_rate_play_info": null,
    "offline_desc": "This song can not play offline",
    "play_url": {
      "height": 720,
      "uri": "",
      "url_list": [],
      "url_prefix": null,
      "width": 720
    },
    "position": null,
    "search_highlight": null,
    "source_platform": 10033,
    "status": 1,
    "tag_list": null,
    "title": "Happy New Year (Remake)",
    "tt_to_dsp_song_infos": null,
    "uncert_artists": null,
    "user_count": 78426
  }
]
```

##### Related TikTok APIs

For other TikTok data needs, explore these related APIs:

| [🎹️ Fast TikTok API](https://apify.com/novi/fast-tiktok-api)            | [📹️ TikTok Trend API](https://apify.com/novi/tiktok-trend-api)         | [🔍️ TikTok Search API](https://apify.com/novi/tiktok-search-api)             |
|:-------------------------------------------------------------------------|:------------------------------------------------------------------------|:------------------------------------------------------------------------------|
| [🧛️ TikTok User API](https://apify.com/novi/tiktok-user-api)            | [🧛️ TikTok User Info API](https://apify.com/novi/tiktok-user-info-api) | [#️ TikTok Hashtag API](https://apify.com/novi/tiktok-hashtag-api)            |
| [🛍️ TikTok Shop API](https://apify.com/novi/tiktok-shop-scraper)        | [👤️ TikTok Followers API](https://apify.com/novi/tiktok-followers-api) | [⚡️ TikTok Scraper (pay-per-result)](https://apify.com/xtdata/tiktok-scraper) |
| [💬 TikTok Comment API](https://apify.com/novi/tiktok-comment-api)       | [🎶 TikTok Music API](https://apify.com/novi/tiktok-sound-api)          | [🎶 TikTok Music Trend API](https://apify.com/novi/tiktok-music-trend-api)    |
| [🐦 Twitter - X.com Scraper](https://apify.com/xtdata/twitter-x-scraper) |                                                                         |                                                                               |

# Changelog

This Actor's version history is a separate document: https://apify.com/novi/tiktok-music-trend-api/changelog.md

# Actor input Schema

## `region` (type: `string`):

Please fill 2 characters region code. Ex: US

## `limit` (type: `integer`):

Soft limit of result. If actual result size >= limit. The scraper will stop.

## Actor input object example

```json
{
  "region": "US",
  "limit": 1
}
```

# 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 = {
    "region": "US",
    "limit": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("novi/tiktok-music-trend-api").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 = {
    "region": "US",
    "limit": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("novi/tiktok-music-trend-api").call(run_input=run_input)

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

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

```

## CLI example

```bash
echo '{
  "region": "US",
  "limit": 1
}' |
apify call novi/tiktok-music-trend-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,novi/tiktok-music-trend-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/2u5FKFlzV6f4unbes/builds/xb8AiJTHCwRpomvW0/openapi.json
