My favorites | English | Sign in

More personalization in Google Friend Connect New!

YouTube APIs and Tools

YouTube logo

Developer's Guide: Data API Protocol – Complaints

A user can add a complaint about a video to flag the video for containing inappropriate content. Complaints can be inserted but cannot be updated or deleted. Typically, a user would file a complaint about a video after watching that video.

In an API response, each entry includes a <link> tag that identifies the URL to which you would post an API request to add a complaint about the video. Since each entry includes several link tags, you must use the URL for the tag for which the rel attribute value is http://gdata.youtube.com/schemas/2007#video.complaints.

To add a complaint, you will send an HTTP POST request that identifies the target of the complaint, the user who is making the complaint, and the text of the complaint itself. (The user is identified by the authentication token in the HTTP request headers.) The request can also specify the reason for the complaint by using a <category> tag that has a scheme attribute value of http://gdata.youtube.com/schemas/2007/complaint-reasons.cat. The tag's term attribute value must be one of the following terms:

  • PORN - The video contains sexual content.
  • VIOLENCE - The video contains violent or repulsive content.
  • HATE - The video contains hateful or abusive content.
  • DANGEROUS - The video contains harmful or dangerous acts.
  • RIGHTS - The video infringes on the complainant's rights or copyright.
  • SPAM

The following XML demonstrates how to add a complaint about a video.

POST /feeds/api/videos/VIDEO_ID/complaints HTTP/1.1
Host: gdata.youtube.com
Content-Type: application/atom+xml
Content-Length: CONTENT_LENGTH
Authorization: AuthSub token="AUTHORIZATION_TOKEN"
GData-Version: 2
X-GData-Client: CLIENT_ID
X-GData-Key: key=DEVELOPER_KEY

<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom"
    xmlns:yt="http://gdata.youtube.com/schemas/2007">
  <yt:content type="text">
    Please ignore this complaint. I'm testing a YouTube API and 
    needed to issue a complaint to test the add complaint function.
    Per the value of the category tag, pretend I am complaining
    about a video that contains violent or repulsive acts.
  </yt:content>
  <category scheme="http://gdata.youtube.com/schemas/2007/complaint-reasons.cat"
    term="VIOLENCE"/>
</entry>

If YouTube successfully handles your request, the API will return a 201 HTTP response code.