---
title: "批量设置歌曲评级"
method: POST
path: "/songs/batch-rating"
tags: ["歌曲管理"]
---

# 批量设置歌曲评级

`POST /songs/batch-rating`

## Request

- Base URL: `https://localhost:58091/api/v1`
- URL: `https://localhost:58091/api/v1/songs/batch-rating`
- Auth: API key in header `Authorization`

按 ID 列表批量设置评级（0-100；0 表示清除评级）。列表中不存在的 ID 静默跳过，updated 返回实际更新数量。评级仅存数据库，不写入音频文件标签。

## Request body

- ModelsBatchUpdateRatingRequest
  - `ids` integer[]: 要设置评级的歌曲 ID 列表
  - `rating` integer: 评级值 0-100（0 表示清除评级；星级客户端按 20/颗映射）

## Response `200`

成功返回 {updated}

- ModelsBatchUpdateRatingResponse
  - `updated` integer: 实际更新的歌曲数量（不存在的 ID 静默跳过）

## Other responses

- `400`: 请求数据错误或评级值超出范围
- `500`: 服务器错误

## Changes

- **2026-11-17** `4b48b91de725`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/songloft-org/apis/songloft-api/changes/songs/batch-rating/post.md)

---

[API](https://skmtc.dev/songloft-org/apis/songloft-api.md) - [All operations](https://skmtc.dev/songloft-org/apis/songloft-api/llms.txt) - [OpenAPI document](https://skmtc.dev/songloft-org/apis/songloft-api/revisions/5bc05f13fffd?raw)
