User Agent Parser API: Detect Browser, OS & Device Type

Every HTTP request carries a User-Agent string that identifies the client -- browser name, version, operating system, and device type. Parsing these strings reliably is notoriously difficult because there are thousands of variations and the format has no strict standard. The Apixies User Agent Inspector API parses any UA string into structured JSON, detecting the browser, OS, device, and whether the client is a bot.

What the API Returns

Send a User-Agent string and get back a structured breakdown:

Field Description
browser.family Browser name (Chrome, Firefox, Safari, Edge, etc.)
browser.major Major version number
browser.minor Minor version number
os.family Operating system (Windows, macOS, Linux, Android, iOS)
os.major OS major version
device.family Device type (desktop, mobile, tablet)
device.brand Device manufacturer (Apple, Samsung, etc.)
device.model Device model (iPhone, Galaxy S24, etc.)
is_bot Whether the UA belongs to a known bot/crawler

Authentication

Pass your API key in the X-API-Key header. Anonymous requests work at 20/day. A free account gives you 75 requests/day.

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://apixies.io/api/v1/inspect-user-agent?user_agent=Mozilla%2F5.0%20(Windows%20NT%2010.0%3B%20Win64%3B%20x64)%20AppleWebKit%2F537.36%20Chrome%2F120.0"

Get a free API key to raise your daily limit.

Step-by-Step: Parsing Your First User Agent

Step 1 -- Parse a Desktop Browser UA

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://apixies.io/api/v1/inspect-user-agent?user_agent=Mozilla/5.0+(Windows+NT+10.0;+Win64;+x64)+AppleWebKit/537.36+(KHTML,+like+Gecko)+Chrome/120.0.0.0+Safari/537.36"

Response:

{
  "status": "success",
  "data": {
    "is_bot": false,
    "browser": { "family": "Chrome", "major": "120", "minor": "0" },
    "os": { "family": "Windows", "major": "10" },
    "device": { "family": "Other", "brand": null, "model": null }
  }
}

Step 2 -- Detect a Mobile Device

Mobile UA strings contain device-specific information:

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://apixies.io/api/v1/inspect-user-agent?user_agent=Mozilla/5.0+(iPhone;+CPU+iPhone+OS+17_0+like+Mac+OS+X)+AppleWebKit/605.1.15+(KHTML,+like+Gecko)+Version/17.0+Mobile/15E148+Safari/604.1"

The API correctly identifies the device as an iPhone running iOS 17 with Safari.

Step 3 -- Identify a Bot

Bot detection is one of the most valuable features. Search engine crawlers, monitoring tools, and scrapers all have distinct UA strings:

curl -H "X-API-Key: YOUR_API_KEY" \
  "https://apixies.io/api/v1/inspect-user-agent?user_agent=Googlebot/2.1+(+http://www.google.com/bot.html)"

The is_bot field will be true, and browser.family will identify it as Googlebot.

Code Examples

JavaScript (Node.js)

async function parseUserAgent(uaString) {
  const url = new URL("https://apixies.io/api/v1/inspect-user-agent");
  url.searchParams.set("user_agent", uaString);

  const response = await fetch(url, {
    headers: { "X-API-Key": process.env.APIXIES_KEY },
  });

  if (!response.ok) {
    throw new Error(`Parse failed: ${response.status}`);
  }

  return (await response.json()).data;
}

const ua = req.headers["user-agent"];
const parsed = await parseUserAgent(ua);

console.log(`Browser: ${parsed.browser.family} ${parsed.browser.major}`);
console.log(`OS: ${parsed.os.family}`);
console.log(`Bot: ${parsed.is_bot}`);

Python

import requests
import os

api_key = os.environ["APIXIES_KEY"]

def parse_user_agent(ua_string):
    response = requests.get(
        "https://apixies.io/api/v1/inspect-user-agent",
        params={"user_agent": ua_string},
        headers={"X-API-Key": api_key},
    )
    response.raise_for_status()
    return response.json()["data"]

parsed = parse_user_agent(
    "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
    "AppleWebKit/537.36 Chrome/120.0.0.0 Safari/537.36"
)
print(f"Browser: {parsed['browser']['family']} {parsed['browser']['major']}")
print(f"OS: {parsed['os']['family']}")

PHP

$apiKey = getenv('APIXIES_KEY');

function parseUserAgent(string $uaString): array
{
    global $apiKey;

    $query = http_build_query(['user_agent' => $uaString]);
    $ch = curl_init("https://apixies.io/api/v1/inspect-user-agent?{$query}");
    curl_setopt($ch, CURLOPT_HTTPHEADER, ["X-API-Key: {$apiKey}"]);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

    $body   = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
    curl_close($ch);

    if ($status !== 200) {
        throw new RuntimeException("Parse failed: {$status}");
    }

    return json_decode($body, true)['data'];
}

$parsed = parseUserAgent($_SERVER['HTTP_USER_AGENT']);
echo "Browser: {$parsed['browser']['family']}\n";
echo "Bot: " . ($parsed['is_bot'] ? 'Yes' : 'No') . "\n";

Common Use Cases

  • Analytics dashboards -- Break down traffic by browser, OS, and device type without client-side tracking scripts.
  • Bot filtering -- Identify and block or allow crawlers before they consume resources.
  • Responsive content -- Serve optimized content or redirect mobile users based on their device.
  • Access logs analysis -- Parse stored UA strings from server logs to generate browser share reports.
  • A/B testing -- Segment experiments by browser or device to isolate rendering differences.
  • Security monitoring -- Flag unusual or outdated UA strings that may indicate scraping or attacks.

Next Steps

Get your free API key and start parsing user agents in minutes.

Try the User Agent Inspector API

Free tier is for development & small projects. 75 requests/day with a registered account.

Getting Started

Explore

Resources

Get Started Free

Free for development and small projects.

Get Free API Key