
User-Agent Parser API
Parse user-agent strings to identify browsers, devices, and operating systems instantly. Includes random user-agent generation for testing and development.
All API requests require a valid API key passed in the Authorization header as a Bearer token.
120 requests per minute
1 endpoint available
Overview
Parses a user-agent string into browser, operating system, device and CPU, or generates a random realistic user-agent for testing. The generated string is parsed too, so both operations return the same shape.
How detection works
Detection uses a small set of pattern checks, the same as the web tool, not a full user-agent database. Anything it
does not recognize comes back as Unknown.
- browser - Chrome, Firefox, Safari, Edge or Internet Explorer, with major.minor version. Other Chromium browsers such as Opera and Brave are reported as Chrome.
- os - Windows 7, 8, 8.1 or 10 (Windows 11 also reports 10), macOS, Android, iOS or Linux. iPhone and iPad user agents contain the text "Mac OS X" and are currently reported as macOS.
- device.type - Mobile, Tablet or Desktop. device.vendor is Apple, Various or Unknown. device.model and cpu.architecture are always Unknown.
Limits
userAgent is up to 2,000 characters. Generated user agents are random, so repeated calls return different values.
Endpoints
https://opentools.ca/api/v1/tools/user-agent-parserRequest Body
Content-Type: application/json
| Parameter | Type | Required | Description |
|---|---|---|---|
| operation | string Enum: parse, generate | Required | What to do. |
| userAgent | string | Optional | User-agent string to parse, 1 to 2,000 characters. Required for parse, ignored for generate. |
Response Example
{
"success": true,
"operation": "parse",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
"browser": {
"name": "Chrome",
"version": "120.0"
},
"device": {
"type": "Desktop",
"vendor": "Various",
"model": "Unknown"
},
"os": {
"name": "Windows",
"version": "10"
},
"cpu": {
"architecture": "Unknown"
}
}Error Codes
Code Examples
# Parse a user-agent
curl -X POST https://opentools.ca/api/v1/tools/user-agent-parser \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"operation": "parse",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
}'
# Generate a random user-agent
curl -X POST https://opentools.ca/api/v1/tools/user-agent-parser \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"operation": "generate"}'Rather use it in your browser? Open the User-Agent Parser