Skip to main content

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 Plans
API v2 Recommended
POST  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": []
    }
}
Legacy v1 endpoint
GET  https://whatmyuseragent.com/api
Parameters
ParameterRequiredDescription
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).
Authentication

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.

Example Request

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"
Response Format

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" }
    }
}
Response Fields
FieldTypeDescription
Device
Device.deviceTypestringType of device: smartphone, tablet, desktop, tv, car browser, feature phone, phablet, portable media player, console, camera, or empty.
Device.modelstringDevice model name, e.g. Galaxy S21 Ultra 5G. Empty if unknown.
Device.brandstringDevice brand name, e.g. Samsung. Empty if unknown.
OS
OS.namestringOperating system name, e.g. Android, Windows, iOS.
OS.versionstringOS version string, e.g. 12, 10, 15.1.
OS.platformstringCPU platform, e.g. x64, ARM. Often empty.
OS.familystringOS family group, e.g. Android, Windows, GNU/Linux.
Browser
Browser.typestringbrowser, mobile app, or empty.
Browser.namestringBrowser name, e.g. Chrome Mobile, Firefox, Safari.
Browser.versionstringMajor version number, e.g. 96.
Browser.enginestringRendering engine, e.g. Blink, Gecko, WebKit.
Browser.engine_versionstringEngine version string.
Browser.familystringBrowser family, e.g. Chrome, Firefox.
Bot
Botobject | arrayEmpty array [] if not a bot. Object with name, category, url, producer if detected as a bot.
Bot.namestringBot name, e.g. Googlebot.
Bot.categorystringBot category, e.g. Search bot, Site Monitor.
Bot.urlstringBot info URL.
Bot.producer.namestringProducer company name.
Bot.producer.urlstringProducer company URL.
Error Codes
ResponseCause
{"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.
Code Examples
<?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)"
Live Test

Test the API with your own user agent string.

Click Test to see the result.