Working with Categorization API
Purpose of the Categorization API
The Categorization API is designed to provide developers and third-party systems with a quick and easy way to get data from the SafeDNS database of categorized sites. The API is designed for integration with other systems where site category verification is required (filtering systems, advertising systems, etc.). The categorization API uses the standard JSON specification to process requests. The API is not intended to be accessed by end users of the integrated system. The API must be requested from an intermediate server of the integrated system.
The database of categorized SafeDNS sites currently includes more than 106 million unique domains in more than 60 categories.
In order to increase the processing speed, the data provided by the Categorization API can be cached on the side of the integrated system for a period of no more than 12 hours.
Accessing API
ForTo access API you should use the following hosts:
• z.api.safedns.com – for testing and anonymous usage with query volume restriction (10 queries per minute)
• x.api.safedns.com – for registered users without restriction.
Authorization
Requesting x.api.safedns.com you need to use Basic Authorization. SpecialA special HTTP Authorization header should be passed in each request. The string <client_id>:<client_secret> passed in the Authorization header is encoded by the base64 method. Herewith, the Basic should be specified as the authorization method.
Header example:
Authorization: Basic Ndc2MDE4N2Q4MWJjNGI3Nzk5NDc2YjQycjUxMDM3MTM6ZjI1YmViZjk5MWZmNDE5ODkzZGIyNTU3MjhlNGUxZGU=
CURL request with authorization:
curl --user <client_id>:<client_secret> http://x.api.safedns.com/domain/www.website.com
Getting a list of site categories
Request:
GET http://z.api.safedns.com/domain/www.website.com
will return answer in JSON format:
{
"category": [49, 59],
"bad": false,
"category_name": ["Computers & Internet", "Business"]
}
Getting a list of URL categories
Request:
GET https://z.api.safedns.com/url/http://www.website.com/path/to?arg=val
will return answer in JSON format:
{
"category": [49, 59],
"bad": false,
"category_name": ["Computers & Internet", "Business"]
}
Getting a list of categories
Request:
GET https://z.api.safedns.com/catgroups
will return answer in JSON format:
[
{
"Illegal Activity": {"65": "Child Sexual Abuse (Arachnid)",
"66": "Crypto Mining", "6": "Drugs",
"7": "Tasteless", "8": "Academic Fraud",
"9": "Parked Domains", "10": "Hate & Discrimination",
"11": "Proxies & Anonymizers",
"19": "Child Sexual Abuse (IWF)",
"31": "German Youth Protection"}
},
{
"Adult Related": {"13": "Adult Sites",
"14": "Alcohol & Tobacco",
"15": "Dating",
"16": "Pornography & Sexuality",
"17": "Astrology",
"18": "Gambling"}
},
{
"Bandwidth Hogs": {"24": "Photo Sharing",
"20": "Torrents & P2P",
"21": "File Storage",
"22": "Movies & Video",
"23": "Music & Radio"}
},
{
"Time Wasters": {"5": "Online Ads",
"26": "Chats & Messengers",
"27": "Forums", "28": "Games",
"29": "Social Networks",
"30": "Entertainment"}
},
{
"General Sites": {"32": "Automotive",
"33": "Blogs",
"34": "Corporate Sites",
"35": "E-commerce",
"36": "Education",
"37": "Finances",
"38": "Government",
"39": "Health & Fitness",
"40": "Humor",
"41": "Jobs & Career",
"42": "Weapons",
"43": "Politics, Society and Law",
"44": "News & Media",
"45": "Non-profit",
"46": "Portals",
"47": "Religious",
"48": "Search Engines",
"49": "Computers & Internet",
"50": "Sports",
"51": "Science & Technology",
"52": "Travel",
"53": "Home & Family",
"54": "Shopping",
"55": "Arts",
"56": "Webmail",
"57": "Real Estate",
"58": "Classifieds",
"59": "Business",
"60": "Kids",
"63": "Trackers & Analytics",
"67": "Online Libraries"}
},
{
"Security": {"12": "Botnets",
"3": "Virus Propagation",
"4": "Phishing"}
}
]