apyhub-logo
2000 atoms
AI tier

About

This Utility API uses AI to safeguard content by analyzing textual content against safety attributes like toxicity, violence, and other sensitive topics.
This API categorizes content into harmful categories such as derogatory language, violent scenarios, sexual references, insults, profanity, and more. Confidence scores, provide insights into the likelihood of content belonging to specific categories. This API is essential for maintaining a safe online environment, ensuring that user-generated text adheres to community guidelines and content standards. It provides a quick and reliable solution for text moderation, minimizing the exposure of undesirable content and fostering a positive user experience.
Note: In order to test the API on API Playground, just click on "Show optional inputs" and enter the Authentication token for the provider before clicking on Send request. The output response structure and the result of the AI utility APIs depend on the service provider and it may vary depending on which service provider is selected.

API Playground

This API endpoint does not have a playground yet. Please check back later.

Documentation

input json: output json
POST
https://api.apyhub.com/ai/text/moderation

Request example

1
curl --location --request POST 'https://api.apyhub.com/ai/text/moderation' \
2
--header 'apy-token: {{token}}' \
3
--header 'Content-Type: application/json' \
4
--data '{
5
"text": "Shut up!",
6
"requested_service": "google",
7
"google": {
8
"key": "your-google-key"
9
}
10
}'
Method: POST
Content Type: application/json
Request Body
AttributeTypeMandatoryDescription
textStringYesthe textual content for which you want to perform text moderation
requested_serviceStringyesthe name of service provider for example google
google.keyStringyes (if google is selected in requested_service)service key provided by google
Sample Response
A successful request returns the text moderation response in the output parameter specified. If the request fails, the response contains an error code and a message to help determine what went wrong.

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
400Invalid input - the file is corrupt or the supported inputs are not provided.
401Required authentication information is either missing or not valid for the resource.
500If any unexpected error occurs while processing the request.

Authentication

All requests to ApyHub services need to be authenticated, currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from workspace settings (on the left side of the navbar) and go to applications.
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.