User Agent API
The User Agent API provides endpoints to parse and generate user agent strings.
Available endpoints:
- /v1/useragentparse - Parse a user agent string to extract device, operating system, and browser information
- /v1/useragentgenerate - Generate random user agent strings
From 6,328 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 403ms | 421ms | 485ms | 798ms | 1259ms |
Didn't find what you were looking for? Suggest an improvement
/v1/useragentparse GET
https://api.api-ninjas.com/v1/useragentparse
Parses a user agent string to extract device, operating system, and browser information.
Parameters
useragentrequiredUser agent string to parse.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
Returns a user agent parsing object containing:
browserObject with
familyandversionfields for the browser.osObject with
familyandversionfields for the operating system.deviceObject with
family,brand, andmodelfields for the device.is_mobile,is_tablet,is_pc,is_botBoolean flags indicating device type.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/useragentparse?useragent=Mozilla%2F5.0%20(Macintosh%3B%20Intel%20Mac%20OS%20X%2010_9_4)%20AppleWebKit%2F537.36%20(KHTML%2C%20like%20Gecko)%20Chrome%2F41.0.2272.104%20Safari%2F537.36Headers
X-Api-KeyLog in or sign up to get your API KeyResponse
Code Examples
1
2
3
4
5
6
7
# Parse user agent
curl -X GET "https://api.api-ninjas.com/v1/useragentparse?useragent=Mozilla%2F5.0%20%28Macintosh%3B%20Intel%20Mac%20OS%20X%2010_9_4%29%20AppleWebKit%2F537.36%20%28KHTML%2C%20like%20Gecko%29%20Chrome%2F41.0.2272.104%20Safari%2F537.36" \
-H "X-Api-Key: YOUR_API_KEY"
# Generate user agent
curl -X GET "https://api.api-ninjas.com/v1/useragentgenerate?os=windows&browser=chrome" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
/v1/useragentgenerate GET
https://api.api-ninjas.com/v1/useragentgenerate
Generates a realistic user agent string based on optional parameters.
Parameters
brandoptionalDevice brand (e.g.
Apple,Samsung)modeloptionalDevice model (e.g.
iPhone,Galaxy)osoptionalOperating system (e.g.
Windows,iOS,Android)browseroptionalBrowser name (e.g.
Chrome,Firefox,Safari)
Response
user_agentA randomly generated user agent string matching the specified criteria.
Generate User Agent Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/useragentgenerate?os=windows&browser=chromeHeaders
X-Api-KeyLog in or sign up to get your API Key