Note: The YouTube Data API (v2) has been officially deprecated as of March 4, 2014. Please refer to our deprecation policy for more information.
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 send a 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 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:
- CHILDABUSE - The video contains acts of child abuse.
- DANGEROUS - The video contains harmful or dangerous acts.
- HATE - The video contains hateful or abusive content.
- PORN - The video contains sexual content.
- RIGHTS - The video infringes on the complainant's rights or copyright.
- VIOLENCE - The video contains violent or repulsive content.
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: Bearer ACCESS_TOKEN GData-Version: 2 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"> <summary> 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. </summary> <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.