User Agent API

User Agent API

Detect any browser, device & OS from user agent strings and generate new ones randomly.

Response example. If you want to see more check the documentation.

Free Plan $0.00 Monthly Subscribe
10,000 Requests / Monthly
Free for Lifetime
No Credit Card Required
MOST POPULAR
Starter Plan $7.99 Monthly Subscribe
60,000 Requests / Monthly
Standard Support
Pro Plan $29.99 Monthly Subscribe
300,000 Requests / Monthly
Standard Support
Custom Plan Volume Monthly Contact Us
Any requests volume you need

User Agent API is a simple but 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, or
  • 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:


{
    "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
5.00
  • Review rating
  • Review rating
  • Review rating
  • Review rating
  • Review rating
API rating
Joginder Singer
1 years ago

Joginder Singer

  • Review rating
  • Review rating
  • Review rating
  • Review rating
  • Review rating

Very good service sir ji