IA ViS requires the calling application to supply authentication credentials as ‘AUTHORIZATION’ HTTP header to generate a token. If authentication is successful, the link returns a JSON string that contains a dynamically generated "token". The "token" is then used with the functions scan_image_data or scan_image_url.



JSON Payload

No payload required.


JSON Response


                "token": "Unique token id returned after successful authentication.",

                "remaining_scan_count": "Count of remaining scan tokens",




                                                 "id": "Id for the category",

                                                 "name": "Name of the Category",

                                                 "description": "Short description about the category."



                "error_code": "Error code in case the result is false",

                "result": "true or falsei.e. success or failure of authentication."



JSON Response Example


                "token": "6d4b6a83-debd-43dc-8c21-0e2fcea2a812",

                "remaining_scan_count": 2785,




                                                 "description": "Detects images containing terrorist militants, beheadings, executions, propaganda, acts of terrorism, flags and insignia.",

                                                 "id": 5580,

                                                 "name": "Terrorism Category"



                                                 "description": "Detects images containing handheld weapons such as rifles, machine guns, hand guns, knives, swords, grenade launchers and people holding firearms.",

                                                 "id": 6377,

                                                 "name": "Weapons Category"



                                                 "description": "Detects images that contain commercial pornography, amateur pornography, sexting selfies, nudity, sex acts, greyscale pornographic images, sexually explicit cartoons and manga.",

                                                 "id": 7174,

                                                 "name": "Pornography Category"



                                                 "description": "Detects images containing graphic violence, bloody wounds, accident victims, beatings, mutilation, decapitation and other images that contain blood and guts",

                                                 "id": 7971,

                                                 "name": "Gore Category"



                                                 "description": "Detects images containing illegal drugs, drug use, drug paraphernalia, plants and symbols relating to drugs.",

                                                 "id": 8768,

                                                 "name": "Drugs Category"



                "error_code": "",

                "result": "True"



Sample Code

Below is the sample code that can be used for authentication





$strUname = "<username>";

$strPassword = "<password>";

$strAccessToken = base64_encode($strUname.":".$strPassword);

$ch = curl_init("");

curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);

curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");

curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: json/auth', 'Authorization:'.$strAccessToken));

curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);







use strict;

use MIME::Base64;

use REST::Client;


my $strUname = "<username>";

my $strPassword = "<password>";

my $client = REST::Client->new();



$client->addHeader("Authorization", "Basic " .

                   encode_base64("$strUname:$strPassword", ""));


my $response = $client->POST("/token");

print $client->responseContent(), "\n";





import requests

import json


strUname = "<username>"

strPassword = "<password>"

client_auth = requests.auth.HTTPBasicAuth(strUname, strPassword)

response ="", auth=client_auth)

token_json = response.json()






using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Net;

using System.IO;


namespace Sample_Token


    class Program


        static void Main(string[] args)


            string strUserName = "<username>";

            string strPassword = "<password>";

            string strAuthorization = strUserName + ":" + strPassword;

            byte[] toEncodeAuthorization = System.Text.ASCIIEncoding.ASCII.GetBytes(strAuthorization);

            string strBase64Authorization = System.Convert.ToBase64String(toEncodeAuthorization);

            HttpWebRequest req = (HttpWebRequest)WebRequest.Create("");

            req.Timeout = 100000000;

            req.Method = "POST";

            req.Headers.Add("Authorization", strBase64Authorization);

            Stream dataStream = req.GetRequestStream();

             WebResponse response = req.GetResponse();

            dataStream = response.GetResponseStream();

            StreamReader reader = new StreamReader(dataStream);

            string Result = reader.ReadToEnd();






            if (string.Empty != Result)












Was this answer helpful?

 Print this Article

Also Read

Scan Image URL

This function is used when the image data is to be downloaded from an image URL. It returns a...

Error Codes

  -1 = Username Empty or Invalid -2 = Password Empty or Invalid -3 = Not Enough Scan tokens...

Scan Image Data

This function is used when the image data is to be uploaded. It returns a JSON protocol that...

Interpreting Results

Image Analyzer ViS supports the classification of images for multiple threat categories. The scan...