Our User Agent API provides detailed client system information, allowing for the detection of bots, crawlers, and potential attackers on your website. It offers parsed data, including the operating system's name, type, and version, as well as the device name and CPU brand. Additionally, you can access the client's browser name, version, and type. You can also pass a user agent string to retrieve the parsed information directly.
User agent API provides the facility to parse the user agent string and extract key information about the client's system. It identifies the operating system (OS) name, its version, and brand, along with the CPU manufacturer. Additionally, the API offers insights into the browser data, including its name, version, and type. All relevant system and browser details are included in the response.
1{
2 "userAgentString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9",
3 "name": "Safari",
4 "type": "Browser",
5 "version": "9.0.2",
6 "versionMajor": "9",
7 "device": {
8 "name": "Apple Macintosh",
9 "type": "Desktop",
10 "brand": "Apple",
11 "cpu": "Intel"
12 },
13 "engine": {
14 "name": "AppleWebKit",
15 "type": "Browser",
16 "version": "601.3.9",
17 "versionMajor": "601"
18 },
19 "operatingSystem": {
20 "name": "Mac OS",
21 "type": "Desktop",
22 "version": "10.11.2",
23 "versionMajor": "10.11"
24 }
25}
User Agent API detects bots, crawlers, and potential attackers by analyzing user agent strings. It helps filter unwanted traffic, prevent scraping, and mitigate security threats by identifying automated systems, ensuring a safer, more secure, and reliable user experience.
1{
2 "userAgentString": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
3 "name": "Googlebot",
4 "type": "Robot Mobile",
5 "version": "2.1",
6 "versionMajor": "2",
7 "device": {
8 "name": "Google",
9 "type": "Robot Mobile",
10 "brand": "Google",
11 "cpu": "Unknown"
12 },
13 "engine": {
14 "name": "Googlebot",
15 "type": "Robot",
16 "version": "537.36",
17 "versionMajor": "537"
18 },
19 "operatingSystem": {
20 "name": "Google Cloud",
21 "type": "Cloud",
22 "version": "6.0.1",
23 "versionMajor": "6"
24 }
25}
Our User Agent API allows you to efficiently parse up to 50,000 user agent strings at once, streamlining the process of analyzing large volumes of user data, saving your time and effort by providing comprehensive insights into the system, device and browser details from your bulk user agent data.
curl -X POST 'https://api.ipgeolocation.io/user-agent-bulk?apiKey=API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"uaStrings": [
"Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36",
"Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+",
"Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)"
]
}'
Enhance your insights by combining the User Agent API with the IP Geolocation API. This allows you to retrieve detailed user agent information, such as browser and system specs, along with precise geolocation data of the client requesting your website. You can also customize the response by specifying or omitting certain fields as needed, giving you full control over the data you receive.
1{
2 "ip": "149.40.62.5",
3 "continent_code": "NA",
4 "continent_name": "North America",
5 "country_code2": "US",
6 "country_code3": "USA",
7 "country_name": "United States",
8 "country_name_official": "United States of America",
9 "is_eu": false,
10 "state_prov": "Washington",
11 "state_code": "US-WA",
12 "district": "King County",
13 "city": "Seattle",
14 "zipcode": "98164",
15 "latitude": "47.60621",
16 "longitude": "-122.33207",
17 "user_agent": {
18 "userAgentString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9",
19 "name": "Safari",
20 "type": "Browser",
21 "version": "9.0.2",
22 "versionMajor": "9",
23 "device": {
24 "name": "Apple Macintosh",
25 "type": "Desktop",
26 "brand": "Apple",
27 "cpu": "Intel"
28 },
29 "engine": {
30 "name": "AppleWebKit",
31 "type": "Browser",
32 "version": "601.3.9",
33 "versionMajor": "601"
34 },
35 "operatingSystem": {
36 "name": "Mac OS",
37 "type": "Desktop",
38 "version": "10.11.2",
39 "versionMajor": "10.11"
40 }
41 }
42}
You can retrieve the geolocation information for an IP address in the following languages:
Analyze the type of traffic coming to your website by examining which devices are more frequently used to access your content. This understanding enables you to make data-driven decisions to enhance the user experience on those platforms at scale, ensuring that your content is optimized for the preferences and behaviors of your audience.
Gain valuable insights by analyzing your website traffic to identify device types most likely to engage with your ads. Display targeted ads tailored to different platforms, and showcase premium ads on high-end devices for better engagement. By leveraging the User Agent API, you can optimize marketing campaigns, improve targeting precision, and reduce costs, ensuring more effective use of your ad budget.
Easily collect detailed bug reports from your customers across any platform, automatically gathering parsed information about their device, browser, and operating system. Pinpoint the root cause of issues on the user's end system for faster and more efficient problem resolution.
User Agent Parser API provides the accurate browser, device, and operating system details from a User Agent String. It also provides information about crawlers and attack sources. You can use these details to customize user experience, prevent crawlers and attackers from accessing your website.
We provide three endpoints in our User-Agent API to parse user-agent string into browser, device and operating system details.
Single User Agent String API can be used in two ways to lookup the browser, device and operating system details with JSON or XML response. The URL for this endpoint is https://api.ipgeolocation.io/user-agent and its full JSON response is below:
1{
2 "userAgentString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9",
3 "name": "Safari",
4 "type": "Browser",
5 "version": "9.0.2",
6 "versionMajor": "9",
7 "device": {
8 "name": "Apple Macintosh",
9 "type": "Desktop",
10 "brand": "Apple",
11 "cpu": "Intel"
12 },
13 "engine": {
14 "name": "AppleWebKit",
15 "type": "Browser",
16 "version": "601.3.9",
17 "versionMajor": "601"
18 },
19 "operatingSystem": {
20 "name": "Mac OS",
21 "type": "Desktop",
22 "version": "10.11.2",
23 "versionMajor": "10.11"
24 }
25}
In order to get the User-Agent details about a user-agent string, pass it in the User-Agent header like below. Note that the apiKey is also passed as a query parameter for authorization. This endpoint is meant to be called from the client-side. When executed in browser javascript, header is automatically appended and you just need to make a GET call to the endpoint. To simulate this behavior of browser, follow this request example:
Note: When this endpoint is being called from client-side using Request Origin, apiKey parameter can be ommitted.
You can also provide custom User-Agent string to parse in JSON payload. This endpoint is meant to be called from server-side and is available for paid subscriptions only.
This endpoint allows you to perform the parsing of multiple User-Angent strings (max. 50,000) at the same time. The requests count per round is equal to total User-Agent strings passed. This feature is only available for paid plans.
To perform bulk User-Agent strings parse, send a POST request and pass the uaStrings array as JSON data along with it. Here is an example
curl -X POST 'https://api.ipgeolocation.io/user-agent-bulk?apiKey=API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"uaStrings": [
"Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36",
"Mozilla/5.0 (X11; U; Linux armv7l like Android; en-us) AppleWebKit/531.2+ (KHTML, like Gecko) Version/5.0 Safari/533.2+ Kindle/3.0+",
"Mozilla/5.0 (Linux; U; en-US) AppleWebKit/528.5+ (KHTML, like Gecko, Safari/528.5+) Version/4.0 Kindle/3.0 (screen 600x800; rotate)"
]
}'
Crawlers and bots pass their User Agent Strings with header and our API can parse that as well and detects the type of crawler.
Here is User Agent String of Google Bot with Nexus mobile device.
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)
A http request with this header will yield:
1{
2 "userAgentString": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)",
3 "name": "Googlebot",
4 "type": "Robot Mobile",
5 "version": "2.1",
6 "versionMajor": "2",
7 "device": {
8 "name": "Google",
9 "type": "Robot Mobile",
10 "brand": "Google",
11 "cpu": "Unknown"
12 },
13 "engine": {
14 "name": "Googlebot",
15 "type": "Robot",
16 "version": "537.36",
17 "versionMajor": "537"
18 },
19 "operatingSystem": {
20 "name": "Google Cloud",
21 "type": "Cloud",
22 "version": "6.0.1",
23 "versionMajor": "6"
24 }
25}
The hackers usually malform the user agent strings and append their custom scripts with it. Whenever our API detects such anamolies, it reports back with appropriate message. Here is an example of malformed Google bot user agent.
Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) select name
Notice that a SQL query select name is appended to the string. Here is how our API reacts to it:
1{
2 "userAgentString": "Mozilla/5.0 (Linux; Android 6.0.1; Nexus 5X Build/MMB29P) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.96 Mobile Safari/537.36 (compatible; Googlebot/2.1; +http://www.google.com/bot.html) select name",
3 "name": "Hacker",
4 "type": "Hacker",
5 "version": "Hacker",
6 "versionMajor": "Hacker",
7 "device": {
8 "name": "Hacker",
9 "type": "Hacker",
10 "brand": "Hacker",
11 "cpu": "Unknown"
12 },
13 "engine": {
14 "name": "Hacker",
15 "type": "Hacker",
16 "version": "Hacker",
17 "versionMajor": "Hacker"
18 },
19 "operatingSystem": {
20 "name": "Hacker",
21 "type": "Hacker",
22 "version": "Hacker",
23 "versionMajor": "Hacker"
24 }
25}
User agent API can be combined with IP Geolocation API when executed on client side. The flage include=useragent will fetch the required User Agent String from the header and the response will be a user_agent object concatenated with the normal response. Here is an example:
1{
2 "ip": "149.40.62.5",
3 "continent_code": "NA",
4 "continent_name": "North America",
5 "country_code2": "US",
6 "country_code3": "USA",
7 "country_name": "United States",
8 "country_name_official": "United States of America",
9 "is_eu": false,
10 "state_prov": "Washington",
11 "state_code": "US-WA",
12 "district": "King County",
13 "city": "Seattle",
14 "zipcode": "98164",
15 "latitude": "47.60621",
16 "longitude": "-122.33207",
17 "user_agent": {
18 "userAgentString": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9",
19 "name": "Safari",
20 "type": "Browser",
21 "version": "9.0.2",
22 "versionMajor": "9",
23 "device": {
24 "name": "Apple Macintosh",
25 "type": "Desktop",
26 "brand": "Apple",
27 "cpu": "Intel"
28 },
29 "engine": {
30 "name": "AppleWebKit",
31 "type": "Browser",
32 "version": "601.3.9",
33 "versionMajor": "601"
34 },
35 "operatingSystem": {
36 "name": "Mac OS",
37 "type": "Desktop",
38 "version": "10.11.2",
39 "versionMajor": "10.11"
40 }
41 }
42}
User Agent API and Threat Intelligence API can be combined as well. Together they form a solid framework to fight against malicious actors. Here we are fetching parsed user agent details along with the geolocation and security information of the client.
Note: This feature is available on paid plans only.
Field | Type | Description | Can be empty? |
---|---|---|---|
userAgentString | string | User-agent string that is parsed for browser, device and operating system details. | No |
name | string | Agent name | No |
version | string | Agent version | No |
versionMajor | string | Agent version major | No |
device.name | string | Device name | No |
device.type | string | Device type | No |
device.brand | string | Device brand | No |
device.cpu | string | Device's CPU model | No |
engine.name | string | Layout engine name | No |
engine.type | string | Layout engine type | No |
engine.version | string | Layout engine version | No |
engine.versionMajor | string | Layout engine version major | No |
operatingSystem.name | string | Operating system name | No |
operatingSystem.type | string | Operating system type | No |
operatingSystem.version | string | Operating system version | No |
operatingSystem.versionMajor | string | Operating system version major | No |
Device Type | Description |
---|---|
Desktop | This device is a Desktop/Laptop |
Mobile | This device is a mobile device however we are not sure if its a tablet, watch, e-reader or phone |
Tablet | This device is a Tablet |
Phone | This device is a mobile Phone |
Watch | This device is a watch or device with tiny screen |
Virtual Reality | This is VR capable mobile device |
eReader | Device with e-ink screen |
Set-top box | A connected device that can interact with TV screen |
TV | Smart TV |
Game Console | Fixed game consoles like PS and XBox |
Handheld Game Console | 'Mobile' game systems like the 3DS |
Voice | A voice driven device that reads the page loud |
Robot | Robot crawler |
Robot Mobile | Mobile device Robot crawler |
Robot Imitator | Robots that pretend to be Google or Bing crawlers but they usually are not official crawlers. |
Hacker | Either the User Agent String is malformed or some kind of scripting is detected in it. |
Anonymized | The User Agent has been altered by anonymization software. |
Unknown | We can't extract the device information from the User Agent. |
Operating System Type | Description |
---|---|
Desktop | A Desktop OS (Desktop/Laptop) |
Mobile | A Mobile OS (Tablet/Mobile/Watch) |
Game Console | Game Console like PlayStation |
Embedded | An Embedded device (TV, RTOS etc) |
Cloud | Something running in the cloud environment |
Hacker | A Hacker |
Anonymized | Explicitly hidden with some software |
Unknown | We really don't know about this OS |
Layout Engine Type | Description |
---|---|
Browser | Regurlar Web Browser |
Mobile App | A mobile app with webview or an app that includes regular browser |
Hacker | Someone with malicious stuff in useragent string or malformed UA string |
Robot | A web crawler |
Unknown | We don't know anything about the identity of this device |
User Agent Type | Description |
---|---|
Browser | Regurlar Web Browser |
Browser Webview | Regular browser being used in a mobile app |
Mobile App | A mobile app accessing the website |
Robot Mobile | A web crawler who want to be detected as mobile |
Cloud Application | Something running in the cloud (can be web scrapper etc.) |
Email Client | An email client |
Voice | Voice enabled browser that reads out loud |
Special | Somethig special we can't classify |
Testclient | Website testing tool |
Hacker | Someone with malicious stuff in useragent string or malformed UA string |
Unknown | We don't know |
User-Agent API returns HTTP status code 200 for a successful API request along with the response.
While, in case of an illegal request, User-Agent API returns 4xx HTTP code alongs with a descriptive message as why the error occured.
Below is a detailed explanation of the specific HTTP status codes and their corresponding error conditions:
HTTP Status | Description |
---|---|
400 Bad Request | It is returned for one of the following reasons:
|
401 Unauthorized | It is returned for one of the following reasons:
|
405 Method Not Allowed |
|
429 Too Many Requests | It is returned for one of the following reasons:
|
499 Client Closed Request |
|
5XX Server Side Error |
|
To facilitate the developers, we have added some SDKs for various programming languages. The detailed documentation on how to use these SDKs is available in the respective SDK's documentation page linked below.
Our SDKs are also available on Github. Feel free to help us improve them. SDKs. Following are the available SDKs: