Useragent API Documentation


The useragent api identifies the device, operating system and browser information from a useragent string.

 

API Request


HTTP
http or https
APIKEY
Sign Up or Sign In for API Keys
USERAGENT
urlencoded() Useragent string
HTTP://useragent.parseapi.com/api/APIKEY/USERAGENT

Example Request GET
https://useragent.parseapi.com/api/APIKEY/CCBot%2F2.0+%28https%3A%2F%2Fcommoncrawl.org%2Ffaq%2F%29

 

API Response


type string
String representing useragent's type: app, bot, browser, unknown


tag string
app: email, feed, web, unknown
bot: monitor, scanner, scraper, spider, unknown


name string
The useragent's name.


version string
The useragent's version.


description string
Short descriptive string. Often useful for displaying to users.


url string
URL to webpage describing bot, browser homepage, etc


is_app boolean
Is the useragent an app? true, false


is_bot boolean
Is the useragent a bot? true, false


is_browser boolean
Is the useragent a browser? true, false


is_unknown boolean
Is the useragent unknown? true, false


device.type string
String representing device's type: auto, console, desktop, mobile, tablet, tv, wearable, unknown


device.name string
The device's name. iPhone, Kindle, Unknown, etc.


device.version string
The device's version including major, minor and patch. Example: 10.13.2


device.description string
Short descriptive string. Often useful for displaying to users.


device.url string
URL to webpage of device.


device.img string
URL to device's 48px x 48px png icon.


device.is_auto boolean
Is the device an automobile? true, false


device.is_console boolean
Is the device a gaming console? true, false


device.is_desktop boolean
Is the device a desktop computer? true, false


device.is_mobile boolean
Is the device a mobile or portable device? true, false


device.is_tablet boolean
Is the device a tablet? true, false


device.is_tv boolean
Is the device a television? true, false


device.is_wearable boolean
Is the device a wearable device? true, false


device.is_unknown boolean
Is the device unknown? true, false


device.vendor.name string
Apple, Google, Microsoft, Samsung, etc.


device.vendor.url string
URL to vendor's website.


os.name string
Operating system name. Example: macOS, Windows, etc.


os.version string
Operating system version. Example: 10.7.5 for MacOS, 10 for Windows, 6.0 for Android.


os.description string
Short descriptive string. Often useful for displaying to users.


os.url string
URL to operating system's webpage.


os.img string
URL to operating system's 48px x 48px png icon.


os.active boolean
Is operating system active and maintained? true, false


os.vendor.name string
Apple, Google, Microsoft, Samsung, etc.


os.vendor.url string
URL to vendor's website.


browser.name string
Browser name. Example values returned: Safari, Chrome, Firefox, Opera, etc.


browser.version string
Browser version.


browser.description string
Short descriptive string. Often useful for displaying to users.


browser.url string
URL to browser's webpage.


browser.img string
URL to browser's 48px x 48px png icon.


browser.active boolean
Is browser active and maintained? true, false


browser.vendor.name string
Apple, Google, Microsoft, Samsung, etc.


browser.vendor.url string
URL to vendor's website.


browser.engine.name string
Browser engine name, many values returned: WebKit, Gecko, Blink, etc.


browser.engine.version string
Browser engine version.


browser.engine.description string
Short descriptive string. Often useful for displaying to users.


browser.engine.url string
URL to browser engine's webpage.


browser.engine.active boolean
Is browser engine active and maintained? true, false


browser.engine.vendor.name string
Apple, Google, Microsoft, Mozilla, etc.


browser.engine.vendor.url string
URL to vendor's website.

Response Object

{
    "type": "bot",
    "tag": "search",
    "name": "ccBot crawler",
    "version": null,
    "url": "http:\/\/commoncrawl.org\/faq\/",
    "description": null,
    "is_app": false,
    "is_bot": true,
    "is_browser": false,
    "is_unknown": false,
    "device": {
        "type": null,
        "name": null,
        "version": null,
        "description": null,
        "img": null,
        "is_auto": false,
        "is_console": false,
        "is_desktop": false,
        "is_mobile": false,
        "is_tablet": false,
        "is_tv": false,
        "is_wearable": false,
        "is_unknown": true
    },
    "os": {
        "type": null,
        "name": null,
        "version": null,
        "description": null,
        "img": null
    },
    "browser": {
        "type": null,
        "name": null,
        "version": null,
        "description": null,
        "img": null,
        "engine": {
            "name": null,
            "version": null,
            "active": false,
            "url": null,
            "description": null
        }
    }
}

 

Sample Code


curl

	curl -G "http://useragent.parseapi.com/api/APIKEY" --data-urlencode "ua=USERAGENT";
PHP

<?php
	$ua = urlencode($_SERVER['HTTP_USER_AGENT']);
	
	$request = file_get_contents("http://useragent.parseapi.com/api/APIKEY/$ua");
	$data = json_decode($request, true);
	print_r($data);
?>
PHP using curl

<?php
	$ua = urlencode($_SERVER['HTTP_USER_AGENT']);
	
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://useragent.parseapi.com/api/APIKEY/$ua");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
	
	$result = curl_exec($ch);
	$http = curl_getinfo($ch, CURLINFO_HTTP_CODE);
	curl_close($ch);
	
	print_r($result);
?>
Javascript

<script>
	var ua = encodeURIComponent(navigator.userAgent).replace(/%20/g,'+');
	var xhr = new XMLHttpRequest();
	xhr.open('GET', 'http://useragent.parseapi.com/api/APIKEY/'+ua, false);
	xhr.send();

	if (xhr.status == 200) {
		var result = JSON.parse(xhr.responseText);
		console.log(result);
	}
</script>
Javascript using jQuery

<script>
	$(document).ready(function() {
		var ua = encodeURIComponent(navigator.userAgent).replace(/%20/g,'+');
		$.get('http://useragent.parseapi.com/api/APIKEY/'+ua, function(data) {
			console.log(data);
		});
	});	
</script>
Python

	import requests
	
	url = 'http://useragent.parseapi.com/api/APIKEY'
	ua = request.META['HTTP_USER_AGENT']
	
	r = requests.get(url, params={'ua': ua})
	
	data = r.json()
Ruby

	require 'net/http'
	require 'json'
	
	ua = request.env['HTTP_USER_AGENT']
	 
	url = 'http://useragent.parseapi.com/api/APIKEY/ua'
	uri = URI(url)
	response = Net::HTTP.get(uri)
	JSON.parse(response)
Node.js

	var request = require('request');
	
	var ua = req.headers['user-agent'];
	var url = 'http://useragent.parseapi.com/api/APIKEY/ua';
	
	request(url, function (error, response, body) {
		if (!error && response.statusCode == 200) {
			var data = JSON.parse(body);
		}
	});