API DOCUMENTATION

Overview

The best way to understand the power of PicPurify's API is to try it by using our online demo. You can upload images and see the result.

Satisfied with the result? To get started you will just need to to sign up for an API key. It's quick and easy.

For the detection of specific content, please contact us


Request

Use a POST request. Below are examples.

Parameters

Parameter Type Description
API_KEY String Personal client API key
task String A task name or a list of tasks separated by comma, to perform : porn_detection, suggestive_nudity_detection, gore_detection, writing_detection, qr_code_detection, money_detection, weapon_detection, drug_detection, nazis_swastika_detection, obscene_gesture_detection, face_gender_detection, face_detection
file_image String Path to the image in your local file system
url_image String URL of the image publicly accessible from internet. Only for tests, can increase latency
reference_id String Optional -A unique reference associated to the image in your information system
origin_id String Optional -A reference to retrieve the origin of the image, profile id, account id ...

Examples

Check an image from local file system
curl -X POST 'https://www.picpurify.com/analyse.php' -F 'API_KEY=XXX' -F 'task=porn_detection,drug_detection,gore_detection' -F 'origin_id=xxxxxxxxx' -F 'reference_id=yyyyyyyy' -F 'file_image=@/path/to/local/file.jpg'
Check an image from url publicly accessible from internet
curl -X POST 'https://www.picpurify.com/analyse.php' -F 'API_KEY=XXX' -F 'task=porn_detection,drug_detection,gore_detection' -F 'origin_id=xxxxxxxxx' -F 'reference_id=yyyyyyyy' -F 'url_image=http://url_image_to_analyse'
Check an image from local file system
picpurify_url = 'https://www.picpurify.com/analyse.php'
img_data = {'file_image': open('/path/to/local/file.jpg', 'rb')}
result_data = requests.post(picpurify_url,files = img_data, data = {"API_KEY":"XXX", "task":"porn_detection,drug_detection,gore_detection", "origin_id":"xxxxxxxxx", "reference_id":"yyyyyyyy" })
print result_data.content
Check an image from url publicly accessible from internet
picpurify_url = 'https://www.picpurify.com/analyse.php'
result_url = requests.post(picpurify_url,data = {"API_KEY":"XXX", "task":"porn_detection,drug_detection,gore_detection", "origin_id":"xxxxxxxxx", "reference_id":"yyyyyyyy"})
print result_url.content
Check an image from local file system
var request = require('request'),
    fs = require('fs');
var picpurifyUrl = 'https://www.picpurify.com/analyse.php';
var imagePath = '/path/to/local/file.jpg'

var data = {
    file_image: fs.createReadStream(imagePath),
    API_KEY: 'XXX',
    task:"porn_detection,drug_detection,gore_detection",
    origin_id:"xxxxxxxxx", 
    reference_id:"yyyyyyyy" 
   
};

request.post({ url: picpurifyUrl, formData: data }, function (err, httpResponse, body) {
    if (!err && httpResponse.statusCode == 200) {
        console.log(body)
    }
});
Check an image from url publicly accessible from internet
var request = require('request');
var picpurifyUrl = 'https://www.picpurify.com/analyse.php';

request.post(
    picpurifyUrl,
    { form: {url_image:'http://url_image_to_analyse',API_KEY: 'XXX',task:"porn_detection,drug_detection,gore_detection", origin_id:"xxxxxxxxx", reference_id:"yyyyyyyy" } },
    function (error, response, body) {
        if (!error && response.statusCode == 200) {
            console.log(body)
        }
    }
);

Response

Example response of success filtering:

{  
   "status":"success",
    "final_decision":"OK",
    "confidence_score_decision":0.99155,
   "porn_detection":{  
      "confidence_score":0.99921,
      "compute_time":0.109,
      "porn_content":false
   },
  
   "drug_detection":{  
      "drug_content":false,
      "compute_time":0.11,
      "confidence_score":0.99155
   },
   "gore_detection":{  
      "gore_content":false,
      "compute_time":0.059,
      "confidence_score":1
   },
   "task_call":"porn_detection,gore_detection,drug_detection",
   "reject_criteria":[  

   ],
   "performed":[  
      "porn_detection",
      "gore_detection",
      "drug_detection"
   ],
   "sub_calls":[  
      "porn_detection",
      "gore_detection",
      "drug_detection"
   ],
  
   "media":{  
      "url_image":"http://url_image_to_analyse",
      "file_image":"",
      "media_id":"c4c623de41a52be977233a5bb5c2e8f3",
      "origin_id":"xxxxxxxxx",
      "reference_id":"yyyyyyyy",
   },
   "total_compute_time":0.8219019412994
}
				
Example response of when errors happen:
{
"status":"failure",
"error":
  {
    "errorCode":30,
    "errorMsg":"File is not an image"
  }
}


Result fields Type Description
status String This field indicates if the image is sucessfully analysed. The value can be either 'success' or 'failure'.
final_decision String The result of the final d├ęcision "OK" or " KO"
confidence_score_decision Number This value indicates the confidence of the final decision. The value varies from 0.5 to 1.
1 for being very confident; 0.5 for being unsure. In case of "OK" gives the confidence of the classifier with the smallest score, in case of "KO" gives the confidence of the classifier the more responsible of the KO.
sub_calls Array Array of sub_tasks, called to perform the main task
task_call String The main task called
total_compute_time String Total server side compute time
media:file_image String File image name
media:url_image String URL of the image publicly accessible from internet.
media:media_id String Picpurify internal media_id generated
media:reference_id String A unique reference associated to the image in your information system
media:origin_id String A reference to retrieve the origin of the image, profile id, account id ...
money_detection:money_content Boolean Does the image contains what the classifier search
money_detection:compute_time Number Compute time of the sub_task
money_detection:confidence_score Number This value indicates the confidence of each classifier on its detection result. The value varies from 0.5 to 1.
1 for being very confident; 0.5 for being unsure.
face_detection:face_coordinate Array Array of the four coordinate of the face, for each face detected in top_left, bottom_right order (xmin,ymin,xmax,ymax). In pixel according to the dimension original_img_height and original_img_width given in parameters.
face_detection:thumbnail_coordinate Array Array of the four coordinate of the computed thumbnail, for each face detected in top, left, bottom, right order. In pixel according to the dimension original_img_height and original_img_width given in parameters.
errorCode Number Error codes.
errorCode:10 (API key error)
errorCode:20 (No url or data information found in the request")
errorCode:30 (Errors in the image to be analysed. E.g., the format is not supported, the size of image is too large, or the size of the file is too big.)
errorCode:50 (Errors of the API service)
errorMsg String Detailed error messages.