User Agent API
Detect any browser, device & OS from user agent strings and generate new ones randomly.
More Details
About this Cloud Hub Solution:
User Agent API is a simple yet essential tool that provides an easy way to detect devices like mobile phones, tablets, and their capabilities by parsing browser/HTTP user agent strings.
User Agent API lets you reliably identify if the user agent is:
- A mobile phone
- A tablet or a PC based device
- A device which has touch capabilities - meaning it has a touch screen on it.
How do I use the User Agent API?
Parsing the User Agent Strings
There are some pieces of key information that give you the hint of identifying the visitors access point such as their browser, device or operating systems on different platforms in the market. For example:
{
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36",
"type": {
"mobile": false,
"tablet": false,
"touch_capable": false,
"pc": true,
"bot": false
},
"browser": {
"name": "Chrome",
"version_major": 85,
"version": "85.0.4183"
},
"os": {
"name": "Windows",
"version_major": 10,
"version": "10"
},
"device": {
"name": "Other",
"brand": null,
"model": null
}
}
Generating Random User Agent Strings
We've all been there. We all needed to scrape some remote sites and needed to generate a valid random user-string for each and every request we make. This may be troublesome; with a limited user-agent string database a remote website would easily identify your fingerprint and block you.
This is an extensive database of (325.000+ user agent strings) user-agent strings which is quickly accessible with a simple endpoint. We offer filtering the random results with many parameters such as operating system, device type and browser.
See the following example calling the endpoint with a cURL command
curl --location --request \GET 'https://api.apilayer.com/user_agent/generate?desktop=true&linux=true' \--header 'apikey: YOUR API KEY'
This code will generate a response like the followings:
json
{
"ua": "Mozilla/5.0 (X11; Ubuntu; Linux i686 on x86_64; rv:47.0) Gecko/20100101 Firefox/47.0",
"type": {
"mobile": false,
"tablet": false,
"touch_capable": false,
"pc": true,
"bot": false
},
"browser": {
"name": "Firefox",
"version_major": 47,
"version": "47.0"
},
"os": {
"name": "Ubuntu",
"version_major": null,
"version": null
},
"device": {
"name": "Other",
"brand": null,
"model": null
}
}
Please note that the generated user-agent string is automatically parsed for convenience purposes and it will return a unique Linux-based browser user-agent string each time it is executed. All possible parameters for generating an endpoint is as follows:
linux: true/false
windows: true/false
mac: true/false
android: true/false
chrome: true/false
ie: true/false (Internet Explorer)
firefox: true/false
mobile: true/false
desktop: true/false
tablet: true/false
What is the benefit of using User Agent API?
Screen sizes and operating systems may vary, but your user experience shouldn’t. You are sitting on your desk, developing a product with a brilliant team that may reach thousands of users but you can’t afford losing them just because you didn’t optimize your service according to your audience.
Using the User Agent API will provide this opportunity to get to know your visitors as well as some other benefits, not limited to those;
- Targeting your audience by suggesting any additional services and experiences fitting the ecosystem they belong to. For example; an iPhone user may fall into one of the offerings you have.
- Guiding them to special promotions you prepare for the new version of their device.
- Planning and configuring your services for the majority of visitors for the next phase.
{
"browser": {
"name": "Chrome",
"version": "85.0.4183",
"version_major": 85
},
"device": {
"brand": null,
"model": null,
"name": "Other"
},
"os": {
"name": "Windows",
"version": "10",
"version_major": 10
},
"type": {
"bot": false,
"mobile": false,
"pc": true,
"tablet": false,
"touch_capable": false
},
"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.102 Safari/537.36"
}
Take a look at the diverse range of application types and industries that can leverage this solution. Understanding these potential uses can help identify how this can integrate into different business models and digital solutions across various sectors.
We've outlined the compatible tech stacks for this solution, encompassing various development areas like frontend, backend, and database, alongside specific stack environments. This provides you with the crucial information needed for seamless integration into your preferred frameworks and programming environments.
Pricing Tiers
Related Cloud Hub Solutions
Explore Related Blogs to Enhance Your Knowledge
Explore Scrums.com Products
Scrums.com Dedicated
Build a custom team that works exclusively on your project, fully integrated into your processes. You control the team composition, while we handle the logistics and infrastructure.
Scrums.com Product Development as a Service
Turnkey agile teams delivering production-ready features. Ideal for building new products with no tech stack preference. Cost-efficient, scalable, and results-driven.
Scrums.com On-Demand
Solve tech challenges fast with services like prototyping or code audits. Flexible, low-risk, and tailored to deliver results in weeks not months.
Scrums.com Augmented
Scale quickly with pre-vetted talent integrated into your team. Perfect for filling roles or building offshore development centers efficiently.
Scrums.com Developer Analytics
Track DevOps performance with real-time insights. Boost deployment speed, reduce downtime, and improve efficiency through actionable data and metrics.
Scrums.com Managed Services
Optimize platform performance with SLA-based support for Platform Maintenance, QA, cloud management, and more. Reliable, scalable, and designed to streamline your operations.