# Douyin Music Search API

> Returns music search results from Douyin based on keywords and filters such as sort type, content type, and duration.

Source: https://www.sandbase.ai/apis/douyin/search/music-search
API reference: https://www.sandbase.ai/apis/douyin/search/music-search/docs

## Facts

- Provider: Douyin
- Type: Data API
- Endpoint: `POST https://api.sandbase.ai/v1/api/douyin/search/music-search`
- Price: $0.01 per call
- Free allowance: 100 calls per organization per UTC day, shared across eligible APIs
- Capabilities: api, douyin
- Billing: pay per use from one SandBase balance; no provider account or subscription needed

## Call it

`POST https://api.sandbase.ai/v1/api/douyin/search/music-search` with `Authorization: Bearer $SANDBASE_API_KEY` and the parameters as a JSON body.

| Parameter | Type | Required | Allowed values |
| --- | --- | --- | --- |
| `backtrace` | string | no |  |
| `content_type` | string | no |  |
| `cursor` | integer | no |  |
| `filter_duration` | string | no |  |
| `keyword` | string | no |  |
| `publish_time` | string | no |  |
| `search_id` | string | no |  |
| `sort_type` | string | no |  |

## FAQ

### How do I use the Douyin Music Search API?

Send a POST request to https://api.sandbase.ai/v1/api/douyin/search/music-search with your SandBase API key in the Authorization header (Bearer) and the parameters as a JSON body. You can also try it in the Playground on this page without writing code.

### How much does the Douyin Music Search API cost?

$0.01 per call. Every organization gets 100 free calls per UTC day, shared across eligible SandBase APIs including this one; after that each call is billed at this price from your SandBase balance. There is no subscription.

### What parameters does the Douyin Music Search API accept?

No parameters are required. Optional: backtrace (string), content_type (string), cursor (integer), filter_duration (string), keyword (string) and publish_time (string) and 2 more. The Parameters table and the Playground on this page list every field.

### What does the Douyin Music Search API return?

A JSON response returned in the same HTTP request (synchronous). The README on this page includes a sample response.

### Do I need a Douyin developer account or API key?

No. Douyin Music Search runs through SandBase, so one SandBase API key covers this endpoint and every other API and model in the catalog. You do not need to apply for Douyin API access separately.

## README

### Douyin Music Search API

Look up music tracks on Douyin by passing a `keyword` along with optional filter and pagination parameters.

#### Use cases

- Discover trending songs and audio tracks on Douyin using keywords.
- Filter music results by sorting method, content type, or track duration.
- Retrieve music IDs, author details, and lyric URLs for identified tracks.

#### Request

```bash
curl -X POST "https://api.sandbase.ai/v1/api/douyin/search/music-search" \
  -H "Authorization: Bearer $SANDBASE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{}'
```

#### Parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `cursor` | integer | No | Pagination cursor (0 for first request) |
| `keyword` | string | No | Search keyword, e.g., "game background music" |
| `backtrace` | string | No | Backtrace for pagination, obtained from the last response |
| `search_id` | string | No | Search ID for pagination |
| `sort_type` | string | No | Sorting method |
| `content_type` | string | No | Content type filter |
| `publish_time` | string | No | Publish time filter |
| `filter_duration` | string | No | Video duration filter |

#### Example response

Real response for the request above, trimmed to the main fields. User names and long IDs are masked.

```json
{
  "music": [
    {
      "audition_duration": 38,
      "author": "华Fit",
      "author_deleted": false,
      "binded_challenge_id": 0,
      "dsp_status": 10,
      "duration": 38,
      "end_time": 0,
      "id": 7692065182327736355,
      "lyric_type": 10,
      "lyric_url": "https://sf3-cdn-tos.douyinstatic.com/obj/tos-cn-v-2774c002/oMAMAfPXDAFqFAPtYfEt7…",
      "search_impr": {
        "entity_id": "7692065182327736355"
      },
      "song": {
        "id": 7692065182327703587,
        "title": "我是快乐小猫咪"
      }
    }
  ]
}
```

#### Notes

- Set `cursor` to 0 for the initial query, then pass subsequent pagination tokens to continue.
- Use `backtrace` and `search_id` from the previous response to paginate through deeper results.

#### Related APIs

- [Douyin Challenge Search](/model/douyin/search/challenge-search-v1): Returns Douyin challenge and hashtag search results matching a query.
- [Douyin Hashtag Challenge Search (V2)](/model/douyin/search/challenge-search-v2): Returns Douyin hashtag and challenge search results matching a query keyword.
- [Douyin Hashtag Suggestions](/model/douyin/search/challenge-suggest): Returns a list of suggested Douyin hashtags and challenges matching a query keyword, including challenge IDs and view counts.
