Skip to main content
POST
/
nsfw_image_check
NSFW image check
curl --request POST \
  --url https://modelslab.com/api/v3/nsfw_image_check \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "init_image": "<string>",
  "threshold": 0.5
}
'
import requests

url = "https://modelslab.com/api/v3/nsfw_image_check"

payload = {
    "key": "<string>",
    "init_image": "<string>",
    "threshold": 0.5
}
headers = {"Content-Type": "application/json"}

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

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({key: '<string>', init_image: '<string>', threshold: 0.5})
};

fetch('https://modelslab.com/api/v3/nsfw_image_check', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://modelslab.com/api/v3/nsfw_image_check",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'key' => '<string>',
    'init_image' => '<string>',
    'threshold' => 0.5
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://modelslab.com/api/v3/nsfw_image_check"

	payload := strings.NewReader("{\n  \"key\": \"<string>\",\n  \"init_image\": \"<string>\",\n  \"threshold\": 0.5\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://modelslab.com/api/v3/nsfw_image_check")
  .header("Content-Type", "application/json")
  .body("{\n  \"key\": \"<string>\",\n  \"init_image\": \"<string>\",\n  \"threshold\": 0.5\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://modelslab.com/api/v3/nsfw_image_check")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"key\": \"<string>\",\n  \"init_image\": \"<string>\",\n  \"threshold\": 0.5\n}"

response = http.request(request)
puts response.read_body
{
  "images": "<string>",
  "has_nsfw_concept": [
    true
  ]
}
{
  "status": "error",
  "message": "<string>"
}

Request

Send a POST request to below endpoint to check if an image is nsfw or not.
curl
--request POST 'https://modelslab.com/api/v3/nsfw_image_check' \

Body

json
{  
    "key": "your_api_key",  
    "init_image": "http://your-image-url.com",
    "threshold": 0.5
}
threshold is a float between 0 and 1 (default: 0.5).

Body

application/json
key
string
required

Your enterprise API Key used for request authorization

init_image
string<uri>
required

The image you want to check

threshold
number
default:0.5

Floating-point threshold score for NSFW detection (image or video)

Required range: 0 <= x <= 1

Response

NSFW image check response

images
string<uri>

The image URL that was checked

has_nsfw_concept
boolean[]

Array indicating if the image has NSFW content