Overview

Userstack is a specialized API that provides real-time user-agent string parsing and device detection. It enables developers to identify key characteristics of incoming web requests, including the operating system, browser, and device type. This capability is fundamental for applications requiring tailored user experiences, detailed analytics, or security assessments based on client-side information. The API processes a raw user-agent string and returns a structured JSON object containing data points such as OS name and version, browser name and version, device brand and model, and an indication of whether the device is mobile, tablet, desktop, or a crawler.

Userstack primarily targets developers and technical buyers who need to integrate device detection capabilities into their software. Typical use cases include web analytics platforms that require granular data on user demographics and device usage, e-commerce sites implementing responsive design or device-specific promotions, and advertising platforms for targeted ad delivery. Content management systems can also use Userstack to serve optimized content versions for different devices, enhancing user engagement and performance. The service is owned by APILayer, a provider of various API solutions.

The API's design focuses on ease of integration. It operates via standard HTTP GET requests, making it accessible from virtually any programming language or environment. Developers can pass a user-agent string as a query parameter, and the API responds with a JSON payload. This straightforward interaction model, combined with comprehensive documentation and code examples for popular languages like PHP, Python, and JavaScript, aims to reduce the development overhead associated with implementing device detection. The availability of a free tier allows for initial testing and integration without immediate financial commitment, providing 10,000 requests per month for non-commercial or low-volume applications.

Accuracy in user-agent parsing is critical, particularly as new devices, browsers, and operating system versions are released frequently. Userstack aims to maintain an up-to-date database to ensure that its detection capabilities remain relevant and precise. The API's output includes flags for detecting bots and crawlers, which can be useful for filtering analytics data or preventing fraudulent activities. For applications that require compliance with data protection regulations, Userstack notes that it supports GDPR compliance, which is a consideration for services operating within European markets or handling data from EU citizens.

Key features

  • User-Agent String Parsing: Decodes complex user-agent strings into structured, actionable data.
  • Operating System Detection: Identifies the operating system (e.g., Windows, macOS, Android, iOS) and its specific version.
  • Browser Detection: Recognizes the browser (e.g., Chrome, Firefox, Safari, Edge) and its version number.
  • Device Type Identification: Categorizes devices as mobile, tablet, desktop, smart TV, or bot/crawler.
  • Device Brand and Model: Provides details on the manufacturer and model of the client device where available.
  • Bot and Crawler Detection: Helps distinguish human users from automated agents, useful for analytics filtering and security.
  • Geolocation Data: Offers optional IP-based geolocation data alongside device information.
  • API Security: Requires API key authentication for all requests to ensure secure access.
  • GDPR Compliance: Designed to support General Data Protection Regulation (GDPR) requirements.
  • Multiple SDKs: Supports integration via official SDKs for PHP, Python, and jQuery.

Pricing

Userstack offers a tiered pricing model, including a free plan for low-volume usage and scaling up to custom enterprise solutions. Pricing is current as of May 2026 and subject to change; refer to the official pricing page for the most up-to-date information.

Plan Monthly Cost Requests/Month Features
Free $0 10,000 User-Agent Lookup, OS & Browser Detection, Device Type, Basic Support
Basic $9.99 25,000 All Free features + SSL Encryption, 256-bit HTTPS, Standard Support
Professional $49.99 150,000 All Basic features + Geolocation, Brand & Model Data, Priority Support
Business $99.99 500,000 All Professional features + Premium Support, SLA
Enterprise Custom Custom All Business features + Dedicated Infrastructure, Volume Discounts, Custom Features

Common integrations

Userstack's API can be integrated into various systems and applications that require device and browser detection capabilities. Common integration points include:

  • Web Analytics Platforms: To enrich visitor data with detailed device, OS, and browser information for deeper insights.
  • Content Management Systems (CMS): For serving device-optimized content or implementing responsive design strategies.
  • E-commerce Platforms: To personalize user experiences, offer device-specific promotions, or analyze purchase patterns across different device types.
  • Advertising Technology (AdTech): For targeted advertising campaigns based on user device characteristics.
  • Security Solutions: To identify potential bot traffic, detect unusual user-agent patterns, or enforce device-specific security policies.
  • Customer Relationship Management (CRM) Systems: To log client device details for support or marketing segmentation purposes.
  • A/B Testing Frameworks: To segment users by device type for targeted experimentation.

Alternatives

Several other services provide user-agent parsing and device detection capabilities. These alternatives offer varying features, pricing models, and levels of detail in their detection:

  • WhatIsMyBrowser.com API: Offers detailed browser and OS detection, often used for debugging and support tools.
  • 51Degrees: Provides high-performance device detection, geolocation, and web optimization solutions, primarily for enterprise use cases.
  • DeviceAtlas: Known for its extensive device intelligence database, offering detailed hardware and software specifications.

Getting started

To get started with Userstack, you typically make a simple HTTP GET request to their API endpoint, including your API key and the user-agent string you wish to parse. The following example demonstrates how to use the Userstack API with Python, a primary language supported:

import requests

API_KEY = 'YOUR_API_KEY'
USER_AGENT_STRING = 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36'

params = {
    'access_key': API_KEY,
    'ua': USER_AGENT_STRING
}

try:
    response = requests.get('http://api.userstack.com/detect', params=params)
    response.raise_for_status() # Raise an HTTPError for bad responses (4xx or 5xx)
    
    data = response.json()
    print("Detected OS: ", data['os']['name'], data['os']['version'])
    print("Detected Browser: ", data['browser']['name'], data['browser']['version'])
    print("Device Type: ", data['device']['type'])
    if data['device']['brand']:
        print("Device Brand: ", data['device']['brand'])
    if data['device']['model']:
        print("Device Model: ", data['device']['model'])

except requests.exceptions.RequestException as e:
    print(f"An error occurred: {e}")
except KeyError as e:
    print(f"Key error in API response: {e}. Full response: {data}")
except Exception as e:
    print(f"An unexpected error occurred: {e}")

Replace 'YOUR_API_KEY' with your actual API key obtained from your Userstack account dashboard. The USER_AGENT_STRING should be dynamically retrieved from the incoming HTTP request in a real-world application. The API will return a JSON object containing parsed details about the operating system, browser, and device. For more detailed instructions and examples, consult the Userstack API documentation.