Introduction to Website categorization API
Website categorization API is one of the most accurate website categorisation services based on widely trusted IAB Taxonomy. It also returns categories for Website Filtering Taxonomy.
You can use our API service with websites, but also on texts. URL classification accepts full-path URLs and returns real-time, live URL based website categorization.
Supported taxonomies are:
- IAB Taxonomy (v3), supporting 4 Tiers (with 703 categories, see list of categories here)
- IAB Taxonomy (v2), supporting 4 Tiers (with 698 categories, see list of categories here)
- Web Content Filtering Taxonomy
- Products Taxonomy (with 5474 categories, see list of categories here )
Our API service also returns a list of user personas that may be interested in the website, based on the website content. User personas are selected from a proprietary taxonomy of around 8200 personas that we developed for this purpose.
Authentication
API requests should be sent to the URL: https://www.websitecategorizationapi.com/api/
A valid API key is needed to obtain results from our API endpoints and is available by purchasing subscription to our plans.
After obtaining plan, please login to retrieve your API key.Our API service expects for the API key to be included in all API requests to the server, as parameter:
api_key: b4dade2ce5fb2d0b189b5eb6f0cd
HTTP responses that are successful will have the status code 200 and the response formatted according to specification, please see documentation for examples.
Our servers return API data in JSON format by default.
Rules and limits
The API returns both your total credits (under total_credits) as well as your remaining credits (under remaining_credits).
Pay attention to the number of API credits you still have remaining. If you exhaust your credits you can purchase them at our pricing page or upgrade your plan.
Website Categorization of URLs
Our categorization API classifies URLs according to 2 taxonomies:
- IAB
- Web Filtering
Classification according to IAB (version 2 of taxonomy) is returned under key iab_taxonomy_version2, example: "iab_taxonomy_version2":[["Category name: Television > Music TV","Confidence: 0.9032876491546631"]].
Classification according to Web Filtering is returned under key filtering_taxonomy, example: "filtering_taxonomy":[["Category name: News","Confidence: 0.8032876491546631"]].
Example of requests:
Curl POST Request
To run your API request with Curl, copy paste the following command and make sure to replace your_api_key with your own API key:curl -X POST -H 'Content-Type: application/x-www-form-urlencoded' -d 'query=www.alpha-quantum.com&api_key=euieruZi9hee7Sgx&data_type=url' 'https://www.websitecategorizationapi.com/api/iab/iab_web_content_filtering.php'
Query Parameters
Parameter | Type | Description |
---|---|---|
query | string | text to be categorized |
api_key | string | API key |
The above command returns response in JSON format, structured like this:
{"iab_taxonomy":[["Category name: Technology & Computing > Artificial Intelligence","Confidence: 0.6873087882995605"],["Category name: Technology & Computing > Computing > Internet","Confidence: 0.34942716360092163"],["Category name: Technology & Computing > Computing > Computer Software and Applications","Confidence: 0.1871434599161148"],["Category name: Personal Finance > Personal Investing","Confidence: 0.13019497692584991"],["Category name: Technology & Computing > Computing > Data Storage and Warehousing","Confidence: 0.1278107464313507"],["Category name: Business and Finance > Industries > Financial Industry","Confidence: 0.12296593189239502"],["Category name: Business and Finance > Business > Marketing and Advertising","Confidence: 0.1205512061715126"]],"iab_taxonomy_version2":[["Category name: Technology & Computing > Artificial Intelligence","Confidence: 0.6873087882995605"],["Category name: Technology & Computing > Computing > Internet","Confidence: 0.34942716360092163"],["Category name: Technology & Computing > Computing > Computer Software and Applications","Confidence: 0.1871434599161148"],["Category name: Personal Finance > Personal Investing","Confidence: 0.13019497692584991"],["Category name: Technology & Computing > Computing > Data Storage and Warehousing","Confidence: 0.1278107464313507"],["Category name: Business and Finance > Industries > Financial Industry","Confidence: 0.12296593189239502"],["Category name: Business and Finance > Business > Marketing and Advertising","Confidence: 0.1205512061715126"]],"filtering_taxonomy":[["Category name: Computers & Technology","Confidence: 0.6873087882995605"],["Category name: Web-based Applications","Confidence: 0.34942716360092163"],["Category name: Computers & Technology","Confidence: 0.1871434599161148"],["Category name: Financial Services","Confidence: 0.13019497692584991"],["Category name: Computers & Technology","Confidence: 0.1278107464313507"],["Category name: News/Media","Confidence: 0.12296593189239502"],["Category name: Advertising/Marketing","Confidence: 0.1205512061715126"]],"classification":[["Category name: Technology & Computing > Artificial Intelligence","Confidence: 0.6873087882995605"],["Category name: Technology & Computing > Computing > Internet","Confidence: 0.34942716360092163"],["Category name: Technology & Computing > Computing > Computer Software and Applications","Confidence: 0.1871434599161148"],["Category name: Personal Finance > Personal Investing","Confidence: 0.13019497692584991"],["Category name: Technology & Computing > Computing > Data Storage and Warehousing","Confidence: 0.1278107464313507"],["Category name: Business and Finance > Industries > Financial Industry","Confidence: 0.12296593189239502"],["Category name: Business and Finance > Business > Marketing and Advertising","Confidence: 0.1205512061715126"]],"category":[["Category name: Technology & Computing > Artificial Intelligence","Confidence: 0.6873087882995605"],["Category name: Technology & Computing > Computing > Internet","Confidence: 0.34942716360092163"],["Category name: Technology & Computing > Computing > Computer Software and Applications","Confidence: 0.1871434599161148"],["Category name: Personal Finance > Personal Investing","Confidence: 0.13019497692584991"],["Category name: Technology & Computing > Computing > Data Storage and Warehousing","Confidence: 0.1278107464313507"],["Category name: Business and Finance > Industries > Financial Industry","Confidence: 0.12296593189239502"],["Category name: Business and Finance > Business > Marketing and Advertising","Confidence: 0.1205512061715126"]],"status":200,"total_credits":770000,"remaining_credits":768556}
Example code
Below you can find minimal example code for using our API, for different programming languages.Example code in Python
import http.client
conn = http.client.HTTPSConnection("www.websitecategorizationapi.com")
payload = 'query=www.alpha-quantum.com&api_key=your_api_key&data_type=url'
headers = {
'Content-Type': 'application/x-www-form-urlencoded'
}
conn.request("POST", "/api/iab/iab_web_content_filtering.php", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
Example code in Javascript
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/x-www-form-urlencoded");
var urlencoded = new URLSearchParams();
urlencoded.append("query", "www.alpha-quantum.com");
urlencoded.append("api_key", "ereopreroep203939");
urlencoded.append("data_type", "url");
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: urlencoded,
redirect: 'follow'
};
fetch("https://www.websitecategorizationapi.com/api/iab/iab_web_content_filtering.php", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
Website Categorization of Texts
For categorization of texts, please set data_type=text and use iab_content_filtering.php in API endpoint.
Errors
The API returns a status value in each request. Example of status returned as 200:
{"classification": "status": 200, ....}
In case of error, the status error code can be interpreted using the following table:
Error Code | Meaning |
---|---|
200 | Request was successful. |
400 | Error in forming request. Please check documentation on how to form an API request. |
401 | Your API key is invalid. You need to purchase a subscription to use this service. If you have a paid plan, please check your API key for potential misspelling. If the problem persists please contact us via email. |
403 | You have used up your monthly quota for API requests. Please upgrade your plan to one that includes more API requests per month. Alternatively, add credits to your account. |
407 | Please send parameter data_type, set as url or text and resend the request |
410 | Website content has less than the minimum number of tokens / URL could not be loaded |
411 | URL content could not be fetched |
500 | Something went wrong. Please visit our API documentation page and check if your request was properly formatted. Check if sent domain, url exists. If the problem persists please contact us via email. |