### Quickstart (V2) - Submit a task with a local file (sync) Source: https://docs.thehive.ai/docs/visual-content-moderation Example cURL request to submit a local file for visual moderation using the V2 sync API. ```curl curl --request POST \ --url https://api.thehive.ai/api/v2/task/sync \ --header 'Authorization: Token ' \ --form 'media=@""' ``` -------------------------------- ### Get Post Summary Source: https://docs.thehive.ai/docs/get-post-summary This example shows how to get a post summary. ```javascript const response = await fetch("/api/posts/summary", { method: "GET", headers: { "Content-Type": "application/json", }, }); const data = await response.json(); console.log(data); ``` -------------------------------- ### Quickstart (V2) - Submit a task with an image URL (sync) Source: https://docs.thehive.ai/docs/visual-content-moderation Example cURL request to submit an image URL for visual moderation using the V2 sync API. ```curl curl --request POST \ --url https://api.thehive.ai/api/v2/task/sync \ --header 'accept: application/json' \ --header 'authorization: Token ' \ --form 'url=http://hive-public.s3.amazonaws.com/demo_request/gun1.jpg' ``` -------------------------------- ### Webhook URL for testing Source: https://docs.thehive.ai/docs/moderation-dashboard-quickstart-tutorial This is the URL to be used for setting up and testing the example action. Users should copy their unique webhook link from the landing page. ```text webhook.site ``` -------------------------------- ### Example Submission to Get Post Summary Endpoint Source: https://docs.thehive.ai/docs/get-post-summary An example of how to submit a GET request to the Get Post Summary Endpoint using curl. ```curl curl --request GET \ --url https://api.hivemoderation.com/api/v1/task/posts/ \ --header 'authorization: token 123' \ --header 'content-type: application/json' ``` -------------------------------- ### Quickstart (V2) cURL Request Source: https://docs.thehive.ai/docs/classification-text Example cURL requests for submitting text moderation tasks using the V2 API, both for basic text and with specified language options. ```curl # Submit a task with text (sync) curl --request POST \ --url https://api.thehive.ai/api/v2/task/sync \ --header 'Authorization: Token ' \ --form 'text_data="Hi there, this is a test task"' # Submit a task with a specified language (see below for supported languages) curl --request POST \ --url https://api.thehive.ai/api/v2/task/sync \ --header 'Authorization: Token ' \ --form 'text_data="Hi there, this is a test task"' \ --form 'options="{\"input_language\":\"es\"}"' ``` -------------------------------- ### Example Metadata Config & JSON Source: https://docs.thehive.ai/docs/metadata-configuration This section provides an example of how metadata can be configured and the corresponding JSON structure. ```json { "environment": "prod", "user": { "lifetime_rev": "452", "location": "San Francisco, California" } } ``` -------------------------------- ### Text Prompt End Example Source: https://docs.thehive.ai/docs/prompt-builder Example of a JSON output structure for policy building blocks. ```Text Prompt End Your output should be a valid json object containing a field with the predicted label for each task above. Here is an example: { "bloody": "|||" # ...other domains, etc... } ``` -------------------------------- ### Example with parent_id Source: https://docs.thehive.ai/docs/types-of-submissions This example demonstrates how to use `parent_id` to establish a hierarchy between posts, such as for comments and replies. ```curl curl --location 'https://api.hivemoderation.com/api/v1/task/sync' \ --header 'authorization: token 123' \ --header 'Content-Type: application/json' \ --data '{ \ "user_id":"user-id-1", \ "post_id": "post-id-1", \ "parent_id": "parent-id-1", \ "text_data": "Missing out on all the fun with you guys! :weary: Make sure to bring back some of that aloha spirit with you. Can\'t wait to catch up", \ "user_metadata": { \ "user_age": 20 \ } \ }' ``` -------------------------------- ### Example with group_id Source: https://docs.thehive.ai/docs/types-of-submissions This example shows how to submit a task with a `group_id` to group related posts together. ```curl curl --location 'https://api.hivemoderation.com/api/v2/task/sync' \ --header 'authorization: token 123' \ --header 'Content-Type: application/json' \ --data '{ \ "user_id":"user-id-1", \ "post_id": "post-id_1", \ "group_id": "group-id-1", \ "text_data": "Example of post with group ID", \ "user_metadata": { \ "user_age": 20 \ }, \ "models": ["text"] \ }' ``` -------------------------------- ### Example Response Source: https://docs.thehive.ai/docs/get-post-summary This JSON object represents a typical response when retrieving a summary for a post, detailing its moderation status, triggered rules, and actions performed. ```json { "application_id": "0U0TVGlciG0X2elhbKOSb823", "application_name": "DEMO", "post_id": "sept-11-post-9", "project_status_map": { "32952": { "moderation_type": "visual", "task_id": "2261bb91-8f63-11f0-9083-35fafebf796b", "status": "success" } }, "task_ids": [ "2261bb91-8f63-11f0-9083-35fafebf796b" ], "user_id": "sept-11-post-9", "results": [ { "moderation_categories": [ { "id": "1mF907gZvohacC2By8xbFe", "moderation_type": "visual", "active": true, "display_name": "Pornographic" }, { "id": "drugs_visual", "moderation_type": "visual", "active": true, "display_name": "Drugs" }, { "id": "needs_review_visual", "moderation_type": "visual", "active": true, "display_name": "REVIEW - Visual" }, { "id": "suggestive_visual", "moderation_type": "visual", "active": true, "display_name": "Suggestive" } ], "triggered_rules": [ { "id": "1kCgf3SCW9LyQHut07Z9Ot", "display_name": "Test Rule 123", "action_params": [ { "action_name": "Flag For Review", "policies": [], "action_reason_names": [] }, { "action_name": "Update User Tags", "policies": [], "action_reason_names": [] } ] }, { "id": "1ldlbXcfBMiGFkYwWfcohH", "display_name": "Test Flag Post For Review", "action_params": [ { "action_name": "Flag For Review", "policies": [], "action_reason_names": [] } ] } ], "triggered_background_rules": [], "filters": [] } ], "last_actions": [ { "id": "076gCFv84lT6qNrcA5vAZs", "display_name": "Test Delete Post", "action_type": "post", "acted_on_at": "2025-09-11T23:03:34.744Z" } ], "review_status": { "current_state": "not_in_review", "reviewed": [ { "reviewed_by": { "id": "3121600", "name": "John Doe", "email": "john@thehive.ai" }, "actions": [ { "id": "076gCFv84lT6qNrcA5vAZs", "display_name": "Test Delete Post", "action_type": "post" } ], "action_reasons": [], "policies": [ { "parent_policy": { "api_value": "VIOLENCE", "display_name": "Violence (Sample Policy)" } } ] } ] } } ``` -------------------------------- ### Example Action Request with Policies Source: https://docs.thehive.ai/docs/policy-management This JSON object demonstrates an action request that includes user, post, and a list of applied policies, including parent policies and their sub-policies. ```json { "user": "user_id_123", "post": "post_id_123", "policies": [ { "parent_policy": { "api_value": "VIOLENCE", "display_name": "Violence (Sample Policy)", "description": "Our platform maintains a zero-tolerance policy towards violent content to ensure the safety and well-being of our users. We strictly forbid violent speech deemed highly severe and likely to cause harm. Such content will be removed, and repeated offenses may lead to account restrictions or suspension. This includes explicit statements that:\n\nThreaten Violence: Direct threats to inflict physical harm, including threats of killing, torture, sexual assault, or other bodily injury. This extends to threats against civilian homes, shelters, or essential infrastructure.\nExpress Desires for Harm: Wishing, hoping, or expressing a desire for others to suffer harm, such as death, illness, tragedy, or physical injury.\n\nIncite Violence: Encouraging or promoting acts of violence or harm, including self-harm or participation in atrocities like crimes against humanity, war crimes, or genocide.\n\nGlorify Violence: Praising or celebrating violent acts where harm occurred, including expressing gratitude for someone's suffering or lauding animal abuse or cruelty.\n\nViolent speech is also prohibited in highly visible areas on this platform, such as live video, profile information, header images, or community cover photos.We tailor our response to the severity and likelihood of harm. In some cases, we may limit the visibility of violent content on this platform if we assess that:" }, "sub_policies": [ { "api_value": "GUN_VIOLENCE", "display_name": "Gun Violence", "description": "Gun Violence" }, { "api_value": "BOMBS", "display_name": "Bombs", "description": "Bombs" } ] }, { "parent_policy": { "api_value": "hate_speech", "display_name": "Hate Speech", "description": "This is the description for Hate Speech" }, "sub_policies": [ { "api_value": "bullying", "display_name": "Bullying", "description": "This is Bullying" } ] } ] } ``` -------------------------------- ### Python Client Setup and Usage Source: https://docs.thehive.ai/docs/hive-vision-language-model-vlm Example of setting up the OpenAI client for The Hive and making a chat completion request for subject classification using a JSON schema response format. ```python client = OpenAI( base_url="https://api.thehive.ai/api/v3/", # Hive's endpoint api_key="" # Replace with your API key ) const jsonSchema = { name: "subject_classification", schema: { type: "object", properties: { subject: { type: "string", enum: ["person", "animal", "vehicle", "food", "scenery"] } }, required: ["subject"], additionalProperties: false } }; const completion = await openai.chat.completions.create({ model: "hive/vision-language-model", messages: [{ role: "user", content: [ { type: "text", text: "Classify the main subject (person, animal, vehicle, food, scenery). Return JSON only." }, { type: "image_url", image_url: { url: "https://d24edro6ichpbm.thehive.ai/example-images/vlm-example-image.jpeg" } } ] }], response_format: { type: "json_schema", json_schema: jsonSchema }, max_tokens: 50, }); console.log(JSON.parse(completion.choices[0].message.content).subject); ``` -------------------------------- ### GET Request URL Source: https://docs.thehive.ai/docs/get-post-summary The base URL for the Get Post Summary Endpoint. ```text https://api.hivemoderation.com/api/v1/task/posts/ ``` -------------------------------- ### Python SDK Example for Video Source: https://docs.thehive.ai/docs/hive-vision-language-model-vlm Example of how to use the OpenAI SDK with the Hive VLM to process a video. ```Python from openai import OpenAI client = OpenAI(base_url="https://api.thehive.ai/api/v3/", api_key="") video_response = client.chat.completions.create( model="hive/vision-language-model", messages=[{ "role":"user", "content":[ { "type":"media_url", "media_url":{ "url":"https://example-videos/video.mp4", "sampling": { "strategy": "fps", "fps": 1 }, # Sample 1 frame per second, and run the model on each sampled frame. Default 1 fps. "prompt_scope":"per_frame" # vs. "once" } }, { "type":"text", "text":"Detect objects and summarize key events." } ] }]) for i, choice in enumerate(video_response.choices): print(f"Frame {i}: {choice.message.content}") ``` -------------------------------- ### Example Error Response Source: https://docs.thehive.ai/docs/removing-user-tags An example of an error response when the patron does not exist. ```json { "error": true, "status": 400, "error_code": "INVALID_PATRON", "message": "This Patron(patron-dne-222) does not exist", "show_alert": false } ``` -------------------------------- ### Python SDK Example Source: https://docs.thehive.ai/docs/hive-vision-language-model-vlm Example of how to use the OpenAI SDK with the Hive VLM to process an image. ```Python from openai import OpenAI client = OpenAI(base_url="https://api.thehive.ai/api/v3/", api_key="") image_response = client.chat.completions.create( model="hive/vision-language-model", messages=[{ "role": "user", "content": [ {"type": "text", "text": "Describe the scene in one sentence."}, {"type": "image_url", "image_url": {"url": "https://d24edro6ichpbm.thehive.ai/example-images/vlm-example-image.jpeg"}} ], }], max_tokens=50, ) print(image_response.choices[0].message.content) ``` -------------------------------- ### Example Request Source: https://docs.thehive.ai/docs/removing-user-tags An example of how to remove user tags using the API. ```curl curl -X POST https://api.hivemoderation.com/api/v1/user_tags/remove -H "Authorization: token " -H "Content-Type: application/json" -d '{ "patron_id": "user_abc123", "user_tags_api_fields": ["vip", "newsletter"] }' ``` -------------------------------- ### NSFW Classification Example Source: https://docs.thehive.ai/docs/prompt-builder Defines classes for NSFW content, including general_nsfw and general_suggestive. ```NSFW Task: Is the image NSFW? The NSFW classes – general_nsfw and general_suggestive – can be used broadly to flag images as sexually explicit/suggestive without a more detailed understanding of their contents. ### general_nsfw Depicts nudity, sex acts, sexual objects, and/or sexually explicit imagery. Captures: * Genitals, buttocks and/or anus, female nipples * Full nudity even if genitals and nipples are covered or not visible (e.g., side view) * Vaginal fluids and semen * Sex acts with clear nudity (see sexual_activity description for more detail) * Clear or strongly implied sex acts without full nudity or visible genitals * Sex toys (see sex_toys description for more detail) * Textbook or other illustrations of genitalia * Genitals or female nipples plainly visible through transparent, sheer, or mesh clothing ### general_suggestive Does not depict full nudity or other explicit sexual content but subject matter can be considered sexually suggestive or inappropriate. Captures: * Chest area, breasts without visible nipples, pubic region or areas around genitals with no genitals visible, butt cheeks * Partial nudity where with nipples and/or genitals covered by hands or objects (note: similar images where the buttocks are completely visible would be classified as general_nsfw) * Shirtless men * Person wearing only underwear or swimwear * Clear masturbation without nudity or genitalia visible (e.g., hands in pants) * Kissing with visible tongue * Touching or grabbing breasts, genitals, or butts over clothing * Nipple or genital outline visible through non-transparent clothing ### general_not_nsfw_not_suggestive Does not contain sexually explicit or suggestive imagery (clean). For clarity, this also includes: * Kissing without tongue * Unclothed mannequins, Barbie dolls, etc. * Unclothed babies or toddlers * Leggings and yoga pants * Images or frames from porn films where no nudity or sexual content is shown * Animals mating with no humans present ``` -------------------------------- ### Associated Accounts Example Source: https://docs.thehive.ai/docs/report-to-ncmec Example JSON object representing an associated account. ```json { "user_enrichment_data": { "associatedAccount": [ { "type": "social", "platform": "ExampleSocial", "thirdPartyUser": "1234567890", "screenName": "alex_on_example", "profileUrl": "https://examplesocial.com/u/alex_on_example", "email": "alex+social@example.com", "espIdentifier": "example-social-12345" } ] } } ```