Parse user-agent strings into browser, system, device and bot
A user agent parser reads the User-Agent header and returns the browser and version, rendering engine, operating system, device type and, for crawlers, the bot's name. Open-source libraries such as ua-parser-js and the uap-core rules do this free in your code. Our User-Agent Parser API returns the same fields for up to 100 strings per call for $0.002, and names more than 80 known bots including AI crawlers like GPTBot, ClaudeBot and PerplexityBot with their category and operator.
Try it free User-Agent Parser API — browser, OS, device, bots, $0.002 · $0.002 / call
Two examples
| User agent | Parsed |
|---|---|
| Mozilla/5.0 (iPhone; CPU iPhone OS 17_4 like Mac OS X) ... Version/17.4 Mobile/15E148 Safari/604.1 | Safari 17.4, WebKit, iOS 17.4, mobile, Apple iPhone |
| Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; GPTBot/1.2; +https://openai.com/gptbot) | bot: GPTBot, category ai, operator OpenAI |
Batch a log file
Bot categories include search, ai, ai_search, ai_assistant, preview, seo, monitoring, archive and http_client.
API = "https://iamai.markets/api/x402/services/5Ry3kYDV3sdt"
uas = [line.split('"')[5] for line in open("access.log")][:100] # combined log format
# pay_session: an x402-enabled requests session ($0.002 per call of up to 100)
res = pay_session.post(API, json={"uas": uas}, timeout=30).json()["result"]
print(res["by_device_type"], res["bots"])
ai = [r for r in res["results"] if r["is_bot"] and r["bot"]["category"].startswith("ai")]
What user agents can't tell you
The response adds a note when one of these applies, so you don't report a fake precision.
- Any client can send any user agent. To trust that a visitor is really Googlebot or GPTBot, check its IP with reverse DNS or the operator's published IP list.
- Windows 10 and 11 send the same string; the answer says "10 or 11".
- Browsers freeze macOS at 10.15.7 and Chrome on Android reduces the model to "K". The real values are only in client hints (Sec-CH-UA headers).
- iPads in desktop mode look like a Mac.
Library or API
If you parse in your own web server, a maintained library is cheaper and faster: ua-parser-js for JavaScript, the uap-python port of uap-core for Python. Keep it updated, because new bots and browsers appear often.
The API helps when the parsing happens somewhere without your code: a spreadsheet of logs, a no-code pipeline, or an AI agent asked "how much of my traffic is AI crawlers". The bot rules were updated December 2026.
The product
Questions
Can I block AI crawlers with this?
It identifies them. Blocking is done in robots.txt or your firewall, and robots.txt is a request crawlers may ignore.
Does it detect headless browsers?
HeadlessChrome and PhantomJS strings are flagged as automation. Well-disguised bots send normal browser strings.
Does it use IP addresses?
No, only the string you send.
Related
Updated 2026-12-02
