API Documentation

POST mediarating

https://api.masala.ai/v2/mediarating
Accepts an image as a public URL in a JSON request and returns a rating as result. The output returned by the API contains the rating of the image represented as below:
  • RatingCode: Unique image rating code
  • RatingDescription: Description of the rating code
  • Confidence: The confidence of the generated rating
With the following rating code definitions:
  • V01: Safe, OK – Implies that inappropriate content was not detected in the image.
  • V02: Provocative, Racy – Image may contain subjects with skimpy clothing, partial nudity, excessive skin exposure or provocative poses
  • V03: Adult, Nudity – Image may contain explicit nudity, pornography or obscene content

HEADERS


X-Masala-APIKey:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type:
application/json

PARAMS          N/A


BODY raw


{
  "payload": "https://tinyurl.com/y5kwt4gr"
}

SAMPLE RESPONSE raw

{
  "RatingCode": "V02",
  "RatingDescription": "Racy, Provocative",
  "Confidence": "High"
}
curl --request POST "https://api.masala.ai/v2/mediarating" \
--header "X-Masala-APIKey: xxxxxxxxxxxxxxxxxxxxxxxxxxx" \ 
--header "Content-Type: application/json" \
--data "{
  \"payload\": ​\"https://tinyurl.com/y5kwt4gr\"
}"

import requests

url = 'https://api.masala.ai/v2/mediarating'
payload = "{\r\n \"payload\": \"https://tinyurl.com/y5kwt4gr\"\r\n}\r\n"
headers = {
      'X-Masala-APIKey':'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'Content-Type':'application/json'
}
response = requests.request('POST', url, headers=headers, data=payload,allow_redirects=false,timeout=undefined,allow_redirects=false)

print(response.text)

var https = require('https');

var options = {
  'method': 'POST',
  'hostname': 'api.masala.ai',
  'path': '/v2/mediarating',
  'headers': {
    'X-Masala-APIKey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\r\n  \"payload\": \"https://tinyurl.com/y5kwt4gr\"\r\n}\r\n";

req.write(postData);

req.end();

POST mediaratingb

https://api.masala.ai/v2/mediaratingb
Accepts an image encoded as a string in Base64 format in a JSON request and returns a rating as result. The output returned by the API contains the rating of the image represented as below:
  • RatingCode: Unique image rating code
  • RatingDescription: Description of the rating code
  • Confidence: The confidence of the generated rating
With the following rating code definitions:
  • V01: Safe, OK – Implies that inappropriate content was not detected in the image.
  • V02: Provocative, Racy – Image may contain subjects with skimpy clothing, partial nudity, excessive skin exposure or provocative poses
  • V03: Adult, Nudity – Image may contain explicit nudity, pornography or obscene content

HEADERS


X-Masala-APIKey:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type:
application/json

PARAMS          N/A


BODY raw


{
  "payload": "b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'"
}

SAMPLE RESPONSE raw

{
  "RatingCode": "V02",
  "RatingDescription": "Racy, Provocative",
  "Confidence": "High"
}
curl --request POST "https://api.masala.ai/v2/mediaratingb" \
--header "X-Masala-APIKey: xxxxxxxxxxxxxxxxxxxxxxxxxxx" \ 
--header "Content-Type: application/json" \
--data "{
  \"payload\": ​\"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"
}"
import requests

url = 'https://api.masala.ai/v2/mediaratingb'
payload = "{\r\n \"payload\": \"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"\r\n}\r\n"
headers = {
      'X-Masala-APIKey':'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'Content-Type':'application/json'
}
response = requests.request('POST', url, headers=headers, data=payload,allow_redirects=false,timeout=undefined,allow_redirects=false)

print(response.text)
var https = require('https');

var options = {
  'method': 'POST',
  'hostname': 'api.masala.ai',
  'path': '/v2/mediaratingb',
  'headers': {
    'X-Masala-APIKey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\r\n  \"payload\": \"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"\r\n}\r\n";

req.write(postData);

req.end();

POST humandetectb

https://api.masala.ai/v2/humandetectb
Accepts an image encoded as a string in Base64 format in a JSON request and returns a rating along with a probability value for human presence as result. The output returned by the API contains the rating of the image represented as below:
  • RatingCode: Unique image rating code
  • RatingDescription: Description of the rating code
  • HumanPresenceProbability: The probability of human presence in the image.
With the following rating code definitions:
  • V01: Safe, OK – Implies that inappropriate content was not detected in the image.
  • V02: Provocative, Racy – Image may contain subjects with skimpy clothing, partial nudity, excessive skin exposure or provocative poses
  • V03: Adult, Nudity – Image may contain explicit nudity, pornography or obscene content

HEADERS


X-Masala-APIKey:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type:
application/json

PARAMS          N/A


BODY raw


{
  "payload": "b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'"
}

SAMPLE RESPONSE raw

{
  "HumanPresenceProbability": "1.0",
  "NudityRating": {
     "RatingCode": "V01",
     "RatingDescription": "2",
     "Confidence": "High"
   }
}
curl --request POST "https://api.masala.ai/v2/humandetectb" \
--header "X-Masala-APIKey: xxxxxxxxxxxxxxxxxxxxxxxxxxx" \ 
--header "Content-Type: application/json" \
--data "{
  \"payload\": ​\"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"
}"
import requests

url = 'https://api.masala.ai/v2/humandetectb'
payload = "{\r\n \"payload\": \"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"\r\n}\r\n"
headers = {
      'X-Masala-APIKey':'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'Content-Type':'application/json'
}
response = requests.request('POST', url, headers=headers, data=payload,allow_redirects=false,timeout=undefined,allow_redirects=false)

print(response.text)
var https = require('https');

var options = {
  'method': 'POST',
  'hostname': 'api.masala.ai',
  'path': '/v2/humandetectb',
  'headers': {
    'X-Masala-APIKey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\r\n  \"payload\": \"b'/9j/4AAQSkZJRgABAQEAYABgAAD/2wBD...'\"\r\n}\r\n";

req.write(postData);

req.end();

POST textrating

* Currently experimental in its lite weight – microservice based capabilities.

https://api.masala.ai/v2/textrating

Accepts text in segments in a JSON request and returns a toxicity score as result. The detected toxicity currently covers various aspects ranging from aggressive language, to profanity, and sexually explicit content. The output returned by the API contains the rating of the content toxicity represented as below:

  • RatingCode: Unique text rating code
  • RatingDescription: Description of the rating code
  • Score: The score of toxicity for the input text

With the following rating code definitions:

  • V01: High toxicity detected
  • V02: Non-toxic content

HEADERS


 
X-Masala-APIKey:
xxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type:
application/json
 

PARAMS         N/A


 

BODY raw


{
  "payload": "Sample text segment provided here"
}

 

SAMPLE RESPONSE raw

{
  "RatingCode": "V01",
  "RatingDescription": "Toxic",
  "Score": "0.93492202"
}
curl --request POST "https://api.masala.ai/v2/textrating" \
--header "X-Masala-APIKey: xxxxxxxxxxxxxxxxxxxxxxxxxxx" \ 
--header "Content-Type: application/json" \
--data "{
  \"payload\": ​\"Sample text segment provided here\"
}"
import requests

url = 'https://api.masala.ai/v2/textrating'
payload = "{\r\n \"payload\": \"Sample text segment provided here\"\r\n}\r\n"
headers = {
      'X-Masala-APIKey':'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
      'Content-Type':'application/json'
}
response = requests.request('POST', url, headers=headers, data=payload,allow_redirects=false,timeout=undefined,allow_redirects=false)

print(response.text)
var https = require('https');

var options = {
  'method': 'POST',
  'hostname': 'api.masala.ai',
  'path': '/v2/textrating',
  'headers': {
    'X-Masala-APIKey': 'xxxxxxxxxxxxxxxxxxxxxxxxxxx',
    'Content-Type': 'application/json'
  }
};

var req = https.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function (chunk) {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });

  res.on("error", function (error) {
    console.error(error);
  });
});

var postData =  "{\r\n  \"payload\": \"Sample text segment provided here\"\r\n}\r\n";

req.write(postData);

req.end();