Free User Agent Detection API Documentation
Parse any user agent string and detect Browser, Operating System, Device, and Bot information. New integrations should use the JSON API v2; the GET endpoint remains available for compatibility.
Get a free API key View PlansPOST https://whatmyuseragent.com/api/v2
API v2 requires Content-Type: application/json and a registered API key in the Bearer header. API keys and user agents are never accepted in the URL.
curl -X POST "https://whatmyuseragent.com/api/v2" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
--data '{"user_agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64)"}'
{
"schema_version": "2.0",
"data": {
"Device": {},
"OS": {},
"Browser": {},
"Bot": []
}
}
GET https://whatmyuseragent.com/api
| Parameter | Required | Description |
|---|---|---|
| ua | Yes | URL-encoded user agent string. Max 512 characters. |
| key | Conditional | API key query fallback. Prefer the Authorization: Bearer YOUR_KEY header. Use NOTREQUIRED for anonymous testing (rate limited). |
Send registered API keys in the Authorization header so they do not appear in browser history, referrers, or URL logs:
Authorization: Bearer YOUR_KEY
The legacy key=YOUR_KEY query parameter remains supported for compatibility.
User agent: Mozilla/5.0 (Linux; Android 12; SM-G998N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.92 Mobile Safari/537.36
curl -H "Authorization: Bearer YOUR_API_KEY" "https://whatmyuseragent.com/api?ua=Mozilla%2F5.0%20(Linux%3B%20Android%2012%3B%20SM-G998N)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F96.0.4664.92%20Mobile%20Safari%2F537.36"
All responses are JSON.
{
"Device": {
"deviceType": "smartphone",
"model": "Galaxy S21 Ultra 5G",
"brand": "Samsung"
},
"OS": {
"name": "Android",
"version": "12",
"platform": "",
"family": "Android"
},
"Browser": {
"type": "browser",
"name": "Chrome Mobile",
"version": "96",
"engine": "Blink",
"engine_version": "96",
"family": "Chrome"
},
"Bot": []
}
Bot example (Googlebot):
{
"Device": { "deviceType": "", "model": "", "brand": "" },
"OS": { "name": "", "version": "", "platform": "", "family": "" },
"Browser": { "type": "", "name": "", "version": "", "engine": "", "engine_version": "", "family": "" },
"Bot": {
"name": "Googlebot",
"category": "Search bot",
"url": "https://www.google.com/bot.html",
"producer": { "name": "Google Inc.", "url": "http://www.google.com" }
}
}
| Field | Type | Description |
|---|---|---|
| Device | ||
| Device.deviceType | string | Type of device: smartphone, tablet, desktop, tv, car browser, feature phone, phablet, portable media player, console, camera, or empty. |
| Device.model | string | Device model name, e.g. Galaxy S21 Ultra 5G. Empty if unknown. |
| Device.brand | string | Device brand name, e.g. Samsung. Empty if unknown. |
| OS | ||
| OS.name | string | Operating system name, e.g. Android, Windows, iOS. |
| OS.version | string | OS version string, e.g. 12, 10, 15.1. |
| OS.platform | string | CPU platform, e.g. x64, ARM. Often empty. |
| OS.family | string | OS family group, e.g. Android, Windows, GNU/Linux. |
| Browser | ||
| Browser.type | string | browser, mobile app, or empty. |
| Browser.name | string | Browser name, e.g. Chrome Mobile, Firefox, Safari. |
| Browser.version | string | Major version number, e.g. 96. |
| Browser.engine | string | Rendering engine, e.g. Blink, Gecko, WebKit. |
| Browser.engine_version | string | Engine version string. |
| Browser.family | string | Browser family, e.g. Chrome, Firefox. |
| Bot | ||
| Bot | object | array | Empty array [] if not a bot. Object with name, category, url, producer if detected as a bot. |
| Bot.name | string | Bot name, e.g. Googlebot. |
| Bot.category | string | Bot category, e.g. Search bot, Site Monitor. |
| Bot.url | string | Bot info URL. |
| Bot.producer.name | string | Producer company name. |
| Bot.producer.url | string | Producer company URL. |
| Response | Cause |
|---|---|
{"error":"Missing userAgent"} | ua parameter is empty or missing. |
{"error":"Invalid access key format"} | key is missing. |
{"error":"Rate limit exceeded"} | Too many requests for your plan or IP. |
<?php
$ua = urlencode($_SERVER['HTTP_USER_AGENT']);
$key = 'YOUR_API_KEY';
$url = "https://whatmyuseragent.com/api?ua={$ua}";
$context = stream_context_create(['http' => ['header' => "Authorization: Bearer {$key}\r\n"]]);
$response = file_get_contents($url, false, $context);
$data = json_decode($response, true);
echo $data['Browser']['name'];
echo $data['OS']['name'];
echo $data['Device']['brand'];
?>
const ua = encodeURIComponent(navigator.userAgent);
const key = 'YOUR_API_KEY';
const url = `https://whatmyuseragent.com/api?ua=${ua}`;
fetch(url, { headers: { Authorization: `Bearer ${key}` } })
.then(r => r.json())
.then(data => {
console.log(data.Browser.name);
console.log(data.OS.name);
console.log(data.Device.brand);
});
import requests
from urllib.parse import quote
ua = quote('Mozilla/5.0 (Windows NT 10.0; Win64; x64)')
key = 'YOUR_API_KEY'
url = f'https://whatmyuseragent.com/api?ua={ua}'
r = requests.get(url, headers={'Authorization': f'Bearer {key}'})
data = r.json()
print(data['Browser']['name']) # e.g. Chrome
print(data['OS']['name']) # e.g. Windows
print(data['Device']['brand']) # e.g. Samsung
curl -H "Authorization: Bearer YOUR_API_KEY" "https://whatmyuseragent.com/api?ua=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)"
Test the API with your own user agent string.
Click Test to see the result.