#What Device-Analyze solves
This endpoint parses a User-Agent (UA) string and returns browser, engine, OS, device and
bot signals, plus convenient booleans (is_mobile, is_desktop, …).
Use it to tailor UX (mobile vs desktop layouts), segment analytics, or flag suspicious UAs.
ua: the API falls back to the current request’s
User-Agent header.
#Endpoints & when to use them
#
POST /v1/device-analyze
- Best for: All UA parsing use-cases. Single, simple endpoint.
- How it works: Provide a
uastring (optional). If omitted, we read the request header. - Common uses: Feature flags (e.g., disable heavy effects on mobile), funnel analysis, anti-fraud heuristics.
#Quick start
curl -X POST "https://api.yeb.to/v1/device-analyze" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-API-Key: <YOUR_API_KEY>" \
-d '{
"api_key": "<YOUR_API_KEY>",
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/537.36"
}'
// JS Fetch example (Node/Browser)
await fetch("https://api.yeb.to/v1/device-analyze", {
method: "POST",
headers: {
"Accept": "application/json",
"Content-Type": "application/json",
"X-API-Key": "<YOUR_API_KEY>"
},
body: JSON.stringify({
api_key: "<YOUR_API_KEY>",
ua: navigator.userAgent // or a server-provided UA
})
}).then(r => r.json()).then(console.log);
#Parameters that actually matter
| Param | Required | Practical guidance | Why it matters |
|---|---|---|---|
ua |
No | Send the exact UA you want analyzed. If omitted, we’ll use the request header. | Gives you control (e.g., batch-analyze stored logs) and avoids proxy/header quirks. |
api_key or X-API-Key |
Yes | Either include in JSON payload or in header (preferred: header). | Authentication. Header keeps keys out of logs more safely. |
#Reading & acting on responses
You typically read data.browser, data.os, data.device, and boolean flags like is_mobile.
{
"data": {
"ua_string": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Chrome/141.0.0.0 Safari/537.36",
"browser": { "name": "Chrome", "version": "141.0.0.0", "vendor": null },
"engine": { "name": "Blink", "version": null },
"os": { "name": "Windows","version": "10.0" },
"device": { "type": "desktop","brand": null,"model": null },
"bot": null,
"is_mobile": false,
"is_tablet": false,
"is_bot": false,
"is_desktop": true
},
"response_code": 200,
"response_time_ms": 118
}
#Key signals & decisions
is_mobile / is_tablet / is_desktop— pick layout, image sizes, feature flags.botobject — treat as crawler: skip animations, block login, different rate limits.browser.version— gate advanced features (e.g., WebGPU) behind minimum versions.device.type— “mobile”, “tablet”, “desktop”, etc. for coarse segmentation.
#Errors you might see
| HTTP | When | What to do |
|---|---|---|
422 |
UA missing and no User-Agent header. | Send ua explicitly or ensure your proxy forwards the header. |
401/403 |
Invalid/missing API key. | Place the key in X-API-Key header. |
#Practical recipes
- Mobile-first UI: if
is_mobile→ reduce bundle, enable compact nav, lazy-load heavy widgets. - Fraud hardening: if
is_botor UA looks impossible (e.g., iOS + Edge legacy) → challenge or block. - Analytics buckets: group by
device.typeandos.namefor clean dashboards.
#Troubleshooting & field notes
- Empty vendor/version: some UA strings are intentionally reduced. Don’t fail hard; fall back to booleans.
- Proxy chains: ensure your edge forwards User-Agent unchanged if you rely on header fallback.
- Batch analysis: always pass
uaexplicitly to avoid environment/header differences.
#More response examples
{
"data": {
"ua_string": "Mozilla/5.0 (Linux; Android 10; K) ... Chrome/138.0.0.0 Mobile Safari/537.36",
"browser": { "name": "Chrome", "version": "138.0.0.0", "vendor": null },
"engine": { "name": "Blink", "version": null },
"os": { "name": "Android", "version": "10" },
"device": { "type": "mobile", "brand": null, "model": null },
"bot": null,
"is_mobile": true,
"is_tablet": false,
"is_bot": false,
"is_desktop": false
}
}
#API Changelog
bot details (name, category, url) and hardened UA fallback
to request header when no ua param is sent.