Useragent API Documentation



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


We return the Useragent Details, Device, Operating System and Browser data in the following response:

Useragent

type app, bot, browser, unknown

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

name Name

version Version if available.

title Name and Version.

url

text Short description

is_app true, false

is_bot true, false

is_browser true, false

is_unknown true, false

Device

device.type auto, console, desktop, mobile, tablet, tv, wearable, unknown

device.name iPhone, Kindle, Unknown, etc.

device.version Returns device version including major, minor and patch. Example: 10.13.2

device.title Device name and version. Example: iPhone 7, Kindle Fire, etc.

device.is_auto true, false

device.is_console true, false

device.is_desktop true, false

device.is_mobile true, false

device.is_tablet true, false

device.is_tv true, false

device.is_wearable true, false

device.is_unknown true, false

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

Operating System

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

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

os.title Operating system name and Version macOS High Sierra, Windows 10, etc.

Browser

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

browser.version Browser version.

browser.title Device name and version. Example: iPhone 7, Kindle Fire, etc.

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

browser.engine.version Browser engine version

Example Response JSON

{
    "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,
        "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
    },
    "browser": {
        "type": null,
        "name": null,
        "version": null,
        "engine": {
            "name": null,
            "version": null,
            "active": false,
            "url": null,
            "description": null
        }
    },
    "text": 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);
		}
	});