Image

Image Sensitive Content Detection

0calls
4 credits / call

This is an image content moderation API that automatically detects prohibited content in uploaded images and returns handling recommendations.

POST
uapis.cn
/api/v1/image/nsfw
Body
file
file

Image file to be detected. Supports JPG, JPEG, PNG, GIF, WebP formats, up to 20MB.

Drag a file here, orclick to upload

Image file to be detected. Supports JPG, JPEG, PNG, GIF, WebP formats, up to 20MB.

url
string

Image URL address. If both file and url are provided, file will be prioritized.

Feature Overview

Upload an image file or provide an image URL, and the API will automatically analyze the image content, returning whether it violates rules, risk level, and handling suggestions. Suitable for integration into user upload workflows to achieve automated content moderation.

Response Field Descriptions

  • is_nsfw: Whether the content is flagged as prohibited, true means prohibited, false means normal
  • nsfw_score: Confidence score for prohibited content, between 0-1, higher values indicate higher likelihood of violation
  • normal_score: Confidence score for normal content, between 0-1, complementary to nsfw_score
  • suggestion: Handling recommendation
    • pass: Content is normal, can be allowed directly
    • review: Risk detected, recommend manual review
    • block: High-risk content, recommend direct blocking
  • risk_level: Risk level
    • low: Low risk
    • medium: Medium risk
    • high: High risk
  • label: Content label, nsfw or normal
  • confidence: Overall confidence of the model's judgment
  • inference_time_ms: Model inference time in milliseconds

Request body

Form data containing image source. Must provide either 'file' or 'url'.

file
fileoptional

Image file to be detected. Supports JPG, JPEG, PNG, GIF, WebP formats, up to 20MB.

url
stringoptional

Image URL address. If both file and url are provided, file will be prioritized.

Response

200 / OK

Detection successful! Returns the NSFW analysis results of the image.

JSON
{
  // NSFW content confidence score, range 0-1, higher values indicate higher likelihood of sensitivity.
  "nsfw_score": 0.05,
  // Confidence score for normal content, range 0-1, complementary to nsfw_score
  "normal_score": 0.95,
  // Whether the content is flagged as prohibited, true means prohibited, false means normal
  "is_nsfw": false,
  // Content label, 'nsfw' or 'normal'.
  "label": "normal",
  // Handling suggestion: 'pass' (allow), 'review' (manual review), 'block' (block).
  "suggestion": "pass",
  // Risk level: 'low', 'medium', 'high'.
  "risk_level": "low",
  // Model confidence in the current judgment.
  "confidence": 0.95,
  // Model inference time in milliseconds.
  "inference_time_ms": 156
}

400 / Bad Request

Request parameter error. This could be due to no image provided, unsupported file format, or file too large.

JSON
{
  "code": "INVALID_ARGUMENT",
  "message": "Image file or image URL must be provided"
}

413 /

File too large. The uploaded image exceeds the 20MB limit.

JSON
{
  "code": "FILE_TOO_LARGE",
  "message": "File size exceeds limit (max 20MB)"
}

500 / Internal Server Error

Internal server error. An error occurred while processing the image or performing NSFW detection.

JSON
{
  "code": "INTERNAL_SERVER_ERROR",
  "message": "NSFW detection service is temporarily unavailable"
}