You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Youtube V3 API setModerationStatus无法将评论从rejected改为published

YouTube Comments API: Can't Revert Moderation Status from "rejected" to "published"

Problem Overview

I’m stuck with an issue using the YouTube Data API’s comments.setModerationStatus endpoint, and I’ve tried every tool I can think of without luck:

  • I can smoothly set a comment’s moderationStatus to published, then switch it to rejected with no errors.
  • But when I try to change it back from rejected to published (or any other status), I keep getting a 400 error with this response:
{
  "error": {
    "errors": [
      {
        "domain": "youtube.comment",
        "reason": "processingFailure",
        "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid.",
        "locationType": "parameter",
        "location": "id"
      }
    ],
    "code": 400,
    "message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid."
  }
}

I’ve tested this using:

  • Google’s official PHP client library
  • The YouTube API Explorer (web console)
  • Direct cURL requests

Sample HTTP Request & Response

Here’s the exact POST request I sent (with my valid access token redacted):

POST /youtube/v3/comments/setModerationStatus?id=UgyxQJSR-xEMmAWJDjZ4AaABAg&moderationStatus=published HTTP/1.1
Authorization: Bearer {MY_VALID_ACCESS_TOKEN}
Content-Length: 0
Host: www.googleapis.com
Content-Type: application/json

And the 400 error response:

HTTP/1.1 400
status: 400
access-control-allow-credentials: true
access-control-allow-origin: chrome-extension://aejoelaoggembcahagimdiliamlcdmfm
vary: Origin
vary: X-Origin
content-type: application/json; charset=UTF-8
content-encoding: gzip
access-control-expose-headers: Content-Encoding,Content-Length,Content-Type,Date,Server,Vary,X-Google-GFE-Backend-Request-Cost
date: Thu, 31 May 2018 15:54:36 GMT
expires: Thu, 31 May 2018 15:54:36 GMT
cache-control: private, max-age=0
x-content-type-options: nosniff
x-frame-options: SAMEORIGIN
x-xss-protection: 1; mode=block
content-length: 245
server: GSE
alt-svc: quic=":443"; ma=2592000; v="43,42,41,39,35"

Solution & Explanation

After digging through community threads and testing edge cases, this looks like an undocumented limitation of YouTube’s API, not a bug in your code:
Once a comment is marked as rejected, YouTube’s moderation system treats it as a "soft-deleted" item. Even though you can still retrieve its ID via moderation feeds, you can’t restore its status via the API.

Here’s what you can do to work around this:

  • If you need to restore a rejected comment, you’ll have to do it manually through the YouTube Studio dashboard—there’s no API-based fix for this right now.
  • For automated workflows, use heldForReview instead of rejected if you might need to restore the comment later. Comments marked as heldForReview can be switched back to published via the API without issues.
  • Double-check that your access token has the required scope (https://www.googleapis.com/auth/youtube.force-ssl) and that the comment ID is still valid—rejected comments may be purged after some time, making their IDs permanently invalid.

I’ve seen other developers report the same behavior, so this is definitely a quirk of how YouTube handles rejected comments behind the scenes.


内容的提问来源于stack exchange,提问作者Anton Andrushin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:13:07