> ## Documentation Index
> Fetch the complete documentation index at: https://ayrshare.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# कंटेंट मॉडरेशन

> सुनिश्चित करने के लिए कंटेंट की जाँच करें कि यह हानिकारक या अनुचित नहीं है

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

<PlansAvailable plans={["premium"]} maxPackRequired={false} />

कंटेंट मॉडरेशन API डेवलपर्स को संभावित रूप से हानिकारक या अनुचित टेक्स्ट कंटेंट की पहचान करने में मदद करने के लिए डिज़ाइन किया गया है।
यह एंडपॉइंट टेक्स्ट इनपुट का विश्लेषण करता है और उसे विभिन्न प्रकार की चिंताजनक कंटेंट श्रेणियों में वर्गीकृत करता है।

## मुख्य विशेषताएँ

<ul className="custom-bullets">
  <li>हानिकारक कंटेंट का स्वचालित पता लगाना।</li>
  <li>समस्याजनक टेक्स्ट की कई श्रेणियाँ।</li>
  <li>कंटेंट फ़िल्टरिंग के लिए आसान एकीकरण।</li>
</ul>

## यह कैसे काम करता है

जब आप मॉडरेशन एंडपॉइंट पर टेक्स्ट सबमिट करते हैं, तो यह कंटेंट का विश्लेषण करने के लिए OpenAI मॉडल का उपयोग करता है। फिर API परिणाम लौटाता है जो दर्शाता है कि क्या टेक्स्ट किसी परिभाषित समस्याजनक श्रेणी में आता है।

## हानिकारक कंटेंट की श्रेणियाँ

API टेक्स्ट को निम्नलिखित श्रेणियों में वर्गीकृत करता है:

| श्रेणी                 | विवरण                                                                                                                                                                                                                              |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| hate                   | ऐसी कंटेंट जो नस्ल, लिंग, जातीयता, धर्म, राष्ट्रीयता, यौन अभिविन्यास, विकलांगता स्थिति, या जाति के आधार पर घृणा व्यक्त करती है, उकसाती है, या बढ़ावा देती है। गैर-संरक्षित समूहों (जैसे शतरंज खिलाड़ी) पर लक्षित घृणा उत्पीड़न है। |
| hate/threatening       | घृणा-जनित कंटेंट जिसमें नस्ल, लिंग, जातीयता, धर्म, राष्ट्रीयता, यौन अभिविन्यास, विकलांगता स्थिति, या जाति के आधार पर लक्षित समूह के प्रति हिंसा या गंभीर हानि भी शामिल है।                                                         |
| harassment             | ऐसी कंटेंट जो किसी भी लक्ष्य के प्रति उत्पीड़नकारी भाषा व्यक्त करती है, उकसाती है, या बढ़ावा देती है।                                                                                                                              |
| harassment/threatening | उत्पीड़न कंटेंट जिसमें किसी भी लक्ष्य के प्रति हिंसा या गंभीर हानि भी शामिल है।                                                                                                                                                    |
| self-harm              | ऐसी कंटेंट जो आत्म-हानि के कृत्यों को बढ़ावा देती है, प्रोत्साहित करती है, या दर्शाती है, जैसे आत्महत्या, कटिंग, और खाने के विकार।                                                                                                 |
| self-harm/intent       | ऐसी कंटेंट जहाँ वक्ता व्यक्त करता है कि वह आत्म-हानि के कृत्यों में संलग्न है या संलग्न होने का इरादा रखता है, जैसे आत्महत्या, कटिंग, और खाने के विकार।                                                                            |
| self-harm/instructions | ऐसी कंटेंट जो आत्म-हानि के कृत्यों को करने के लिए प्रोत्साहित करती है, जैसे आत्महत्या, कटिंग, और खाने के विकार, या जो ऐसे कृत्यों को करने के निर्देश या सलाह देती है।                                                              |
| sexual                 | यौन उत्तेजना जगाने के लिए बनाई गई कंटेंट, जैसे यौन गतिविधि का विवरण, या जो यौन सेवाओं को बढ़ावा देती है (यौन शिक्षा और स्वास्थ्य को छोड़कर)।                                                                                       |
| sexual/minors          | यौन कंटेंट जिसमें 18 वर्ष से कम उम्र का व्यक्ति शामिल हो।                                                                                                                                                                          |
| violence               | ऐसी कंटेंट जो मृत्यु, हिंसा, या शारीरिक चोट दर्शाती है।                                                                                                                                                                            |
| violence/graphic       | ऐसी कंटेंट जो मृत्यु, हिंसा, या शारीरिक चोट को स्पष्ट विवरण में दर्शाती है।                                                                                                                                                        |

## उपयोग और सर्वोत्तम अभ्यास

1. **इष्टतम टेक्स्ट लंबाई**: सर्वोत्तम परिणामों के लिए, हम लंबे टेक्स्ट को छोटे टुकड़ों में विभाजित करने की अनुशंसा करते हैं। प्रत्येक खंड 2,000 वर्णों से कम रखने का लक्ष्य रखें।
2. **एकीकरण**: अपने अनुप्रयोगों, फ़ोरम, या उपयोगकर्ता-जनित कंटेंट प्लेटफ़ॉर्म में संभावित रूप से समस्याजनक कंटेंट को स्वचालित रूप से चिह्नित करने के लिए इस API का उपयोग करें।
3. **परिणामों पर कार्रवाई**: API के आउटपुट के आधार पर, आप कंटेंट फ़िल्टरिंग, उपयोगकर्ता चेतावनियाँ, या आगे की समीक्षा प्रक्रियाओं जैसी उपयुक्त क्रियाएँ लागू कर सकते हैं।

## Header Parameters

<HeaderAPI noProfileKey={true} />

## Body Parameters

<ParamField body="text" type="string">
  मॉडरेशन के लिए विश्लेषण करने योग्य टेक्स्ट।
</ParamField>

<ParamField body="imageUrl" type="string">
  छवि का URL। `https://` से शुरू होना चाहिए।
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl --location 'https://api.ayrshare.com/api/validate/moderation' \
  --header 'Authorization: Bearer API_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
      "text": "Let'\''s kill '\''em all"
  }'
  ```

  ```javascript JavaScript theme={"system"}
  const url = "https://api.ayrshare.com/api/validate/moderation";
  const apiKey = "API_KEY"; // Replace with your actual API key

  const data = {
    text: "Let's kill 'em all",
  };

  fetch(url, {
    method: "POST",
    headers: {
      Authorization: `Bearer ${apiKey}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify(data),
  })
    .then((response) => response.json())
    .then((result) => console.log(result))
    .catch((error) => console.error("Error:", error));
  ```

  ```python Python theme={"system"}
  import requests

  url = 'https://api.ayrshare.com/api/validate/moderation'
  api_key = 'API_KEY'  # Replace with your actual API key

  headers = {
      'Authorization': f'Bearer {api_key}',
      'Content-Type': 'application/json'
  }

  data = {
      'text': "Let's kill 'em all"
  }

  response = requests.post(url, json=data, headers=headers)

  if response.status_code == 200:
      result = response.json()
      print(result)
  else:
      print(f"Error: {response.status_code}")
      print(response.text)
  ```

  ```php PHP theme={"system"}
  <?php

  $url = 'https://api.ayrshare.com/api/validate/moderation';
  $apiKey = 'API_KEY';  // Replace with your actual API key

  $data = [
      'text' => "Let's kill 'em all"
  ];

  $headers = [
      'Authorization: Bearer ' . $apiKey,
      'Content-Type: application/json'
  ];

  $ch = curl_init($url);

  curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($ch, CURLOPT_POST, true);
  curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data));
  curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);

  $response = curl_exec($ch);

  if (curl_errno($ch)) {
      echo 'Error: ' . curl_error($ch);
  } else {
      $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
      if ($httpCode == 200) {
          $result = json_decode($response, true);
          print_r($result);
      } else {
          echo "Error: HTTP Code " . $httpCode . "\n";
          echo $response;
      }
  }
  ```

  ```go Go theme={"system"}
  package main

  import (
  	"bytes"
  	"encoding/json"
  	"fmt"
  	"io/ioutil"
  	"net/http"
  )

  func main() {
  	url := "https://api.ayrshare.com/api/validate/moderation"
  	apiKey := "API_KEY" // Replace with your actual API key

  	// Create the request body
  	requestBody, err := json.Marshal(map[string]string{
  		"text": "Let's kill 'em all",
  	})
  	if err != nil {
  		fmt.Println("Error creating request body:", err)
  		return
  	}

  	// Create a new request
  	req, err := http.NewRequest("POST", url, bytes.NewBuffer(requestBody))
  	if err != nil {
  		fmt.Println("Error creating request:", err)
  		return
  	}

  	// Set headers
  	req.Header.Set("Authorization", "Bearer "+apiKey)
  	req.Header.Set("Content-Type", "application/json")

  	// Send the request
  	client := &http.Client{}
  	resp, err := client.Do(req)
  	if err != nil {
  		fmt.Println("Error sending request:", err)
  		return
  	}
  	defer resp.Body.Close()

  	// Read the response
  	body, err := ioutil.ReadAll(resp.Body)
  	if err != nil {
  		fmt.Println("Error reading response:", err)
  		return
  	}

  	// Check the status code
  	if resp.StatusCode == http.StatusOK {
  		fmt.Println("Response:")
  		fmt.Println(string(body))
  	} else {
  		fmt.Printf("Error: Status Code %d\n", resp.StatusCode)
  		fmt.Println(string(body))
  	}
  }
  ```

  ```csharp C# theme={"system"}
  using System;
  using System.Net.Http;
  using System.Text;
  using System.Threading.Tasks;
  using System.Text.Json;

  class Program
  {
      static async Task Main(string[] args)
      {
          string url = "https://api.ayrshare.com/api/validate/moderation";
          string apiKey = "API_KEY";  // Replace with your actual API key

          var data = new
          {
              text = "Let's kill 'em all"
          };

          using (var client = new HttpClient())
          {
              client.DefaultRequestHeaders.Add("Authorization", $"Bearer {apiKey}");

              var content = new StringContent(JsonSerializer.Serialize(data), Encoding.UTF8, "application/json");

              try
              {
                  HttpResponseMessage response = await client.PostAsync(url, content);

                  if (response.IsSuccessStatusCode)
                  {
                      string result = await response.Content.ReadAsStringAsync();
                      Console.WriteLine("Response:");
                      Console.WriteLine(result);
                  }
                  else
                  {
                      Console.WriteLine($"Error: {response.StatusCode}");
                      Console.WriteLine(await response.Content.ReadAsStringAsync());
                  }
              }
              catch (HttpRequestException e)
              {
                  Console.WriteLine($"Request error: {e.Message}");
                  Console.WriteLine($"InnerException: {e.InnerException?.Message}"); // Include inner exception details for more information
              }
          }
      }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Response theme={"system"}
  {
    "status": "success",
    "text": "Let's kill 'em all",
    "moderation": [
      {
        "flagged": true,
        "categories": {
          "sexual": false,
          "hate": false,
          "harassment": false,
          "self-harm": false,
          "sexual/minors": false,
          "hate/threatening": false,
          "violence/graphic": false,
          "self-harm/intent": false,
          "self-harm/instructions": false,
          "harassment/threatening": false,
          "violence": true
        },
        "categoryScores": {
          "sexual": 0.00002128273445123341,
          "hate": 0.027735227718949318,
          "harassment": 0.08523011207580566,
          "self-harm": 0.0000021838018255948555,
          "sexual/minors": 1.924875903114298e-7,
          "hate/threatening": 0.0063302298076450825,
          "violence/graphic": 0.00024857991957105696,
          "self-harm/intent": 7.833968993509188e-7,
          "self-harm/instructions": 8.686130570367823e-8,
          "harassment/threatening": 0.07459623366594315,
          "violence": 0.9833663702011108
        }
      }
    ]
  }
  ```

  ```json 400: Bad Request theme={"system"}
  {
    "action": "generate",
    "status": "error",
    "code": 331,
    "message": "There was an issue with the AI processing. Please try again and if the issue persists, contact us."
  }
  ```
</ResponseExample>
