User Agent Parser API
Parse any User-Agent string into browser, engine, OS, device type, vendor and model, and detect bots and crawlers. No UA given? It parses your own.
The User Agent API turns a raw User-Agent header into structured data: browser name, version and major version, rendering engine, operating system and version, device type, vendor and model, and CPU architecture when present. Simple booleans – is_mobile, is_tablet, is_desktop and is_bot – make it easy to branch in your code.
Pass the string in ua (or user_agent) via query or JSON. If you omit it, the API parses the User-Agent of the request itself, which is handy for a quick “what is my browser” check from a browser or a script.
Bot detection matches common crawlers, link-preview fetchers and HTTP clients (Googlebot, Bingbot, facebookexternalhit, Slack, Discord, Telegram and WhatsApp previews, curl, wget, python-requests, axios, headless browsers, Lighthouse, uptime monitors). Parsing is based on the open-source ua-parser-js library.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
ua | body|query | string | no | User-Agent string to parse (alias user_agent). Default: the request’s own User-Agent header. |
Example
curl "https://apibox.io.vn/v1/user-agent?ua=Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%2017_5%20like%20Mac%20OS%20X)%20AppleWebKit%2F605.1.15%20(KHTML%2C%20like%20Gecko)%20Version%2F17.5%20Mobile%2F15E148%20Safari%2F604.1" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/user-agent?ua=Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%2017_5%20like%20Mac%20OS%20X)%20AppleWebKit%2F605.1.15%20(KHTML%2C%20like%20Gecko)%20Version%2F17.5%20Mobile%2F15E148%20Safari%2F604.1', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/user-agent?ua=Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%2017_5%20like%20Mac%20OS%20X)%20AppleWebKit%2F605.1.15%20(KHTML%2C%20like%20Gecko)%20Version%2F17.5%20Mobile%2F15E148%20Safari%2F604.1",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/user-agent?ua=Mozilla%2F5.0%20(iPhone%3B%20CPU%20iPhone%20OS%2017_5%20like%20Mac%20OS%20X)%20AppleWebKit%2F605.1.15%20(KHTML%2C%20like%20Gecko)%20Version%2F17.5%20Mobile%2F15E148%20Safari%2F604.1');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1",
"browser": {
"name": "Mobile Safari",
"version": "17.5",
"major": "17"
},
"engine": {
"name": "WebKit",
"version": "605.1.15"
},
"os": {
"name": "iOS",
"version": "17.5"
},
"device": {
"type": "mobile",
"vendor": "Apple",
"model": "iPhone"
},
"cpu": null,
"is_bot": false,
"is_mobile": true,
"is_tablet": false,
"is_desktop": false
}
Use cases
- Enrich analytics events with browser, OS and device data
- Filter bots and link-preview crawlers out of visit statistics
- Debug customer issues from the User-Agent in support logs
- Serve device-specific content or download links
FAQ
How do I detect if a visitor is a bot?
Send their User-Agent in ua and check is_bot. Detection is pattern based (crawlers, preview fetchers, HTTP libraries, headless browsers); a bot that fakes a normal browser UA will not be detected.
Can I parse the User-Agent of my own request?
Yes, call /v1/user-agent without parameters and the API parses the User-Agent header it received.
Why is device type "desktop" when vendor and model are null?
Desktop browsers do not announce a device model, so the API falls back to desktop when the UA is not a bot and does not contain "Mobile".
Related APIs
UUID Generator
Generate up to 1,000 UUID v4, time-ordered UUID v7, ULID, Nano ID or random hex IDs per request. Secure randomness, optional uppercase.
⏱Cron Expression Parser
Validate a cron expression and get its next run times in any timezone, with a plain-English description. Supports 5, 6 and 7-field cron syntax.
🕒Time & Timezone Converter
Get the current time in any timezone, convert between timezones and Unix timestamps (seconds or ms), with UTC offset and weekday for up to 30 zones.