User-Agent Parser

User-Agent Parser API

Development

Parse user-agent strings to identify browsers, devices, and operating systems instantly. Includes random user-agent generation for testing and development.

Authentication

All API requests require a valid API key passed in the Authorization header as a Bearer token.

Rate Limit

120 requests per minute

Endpoints

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

POST
https://opentools.ca/api/v1/tools/user-agent-parser
Parse a user-agent string or generate a random one

Request Body

Content-Type: application/json

ParameterTypeRequiredDescription
operation
string
Enum: parse, generate
Required
What to do.
userAgent
string
OptionalUser-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

400
Bad Request - Unknown operation, or a missing or too long userAgent for parse
401
Unauthorized - Invalid or missing API key
403
Forbidden - API key is inactive or expired, or the request IP is not allowed for this key
429
Too Many Requests - Rate limit exceeded
500
Internal Server Error

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"}'

Ready to get started?

Create an API key to start using the User-Agent Parser API.

Rather use it in your browser? Open the User-Agent Parser