Moderate Image
To moderate image, you can use theimage.moderate method. This method takes in a image string and returns a Promise that resolves to a ImageModerationResponse object.
Image from URL
index.ts
Webhook Callback
If you pass in a webhook callback url, the response will only be an object with theid property.
Image from Base64 encoded string
index.ts
Properties
string
required
Image to moderateExample:
https://example.com/image.jpgobject
An object of options for the moderation request
Response
TheImageModerationResponse object contains the following properties:
string
required
The ID of the moderation request.Example:
27fbdc0b-b295-46ce-93f5-81b2fc08a381boolean
required
Whether the image is considered safe.Example:
truenumber
required
Confidence of the safety of the image from 1-100.Example:
90string
required
Sentiment of the image, either negative, neutral or positive.available sentiment values are:
- negative
- neutral (default)
- positive
positivenumber
required
Sentiment score from 1-100 (negative, neutral, positive).Example:
90object
required
Overall risk score from 1-100.Example:
90array
required
General topics the image depicts, lowercase and no punctuation.Example:
["politics", "sports"]array
required
An array of the categories of the image.
The available categories are:
- adult_content
- suggestive_imagery
- strong_language
- violence_gore
- horror_disturbing
- alcohol
- tobacco
- substance_use
- gambling
- dating_relationship
- medical_procedures”
- crude_humor
- political_content
[{"category": "sexual", "severity": 90}]object
required
Summary of the image.Example:
{"profanity": true, "totalFlags": 1, "contentRating": "G", "language": "en"}object
required
Suggested actions for the image.Example:
{"reject": true, "review": true}object
required
The request object.Example:
{"requestId": "27fbdc0b-b295-46ce-93f5-81b2fc08a381", "timestamp": "2023-04-05T12:00:00.000Z"}object
required
The metadata of the request object that the user provided.Example:
{"userId": "12345"}string
required
The SHA-256 hash of the image.
Used for content comparison purposes.Example:
93a08bd10cd367bf83f12ba6590fcaef2f8deec8a47ce4ce88a15c7dda325ffa