User-Agent API

Parse any User-Agent string into structured data

Extract device type, browser name and version, operating system, and bot classification from raw User-Agent headers. Supports single and bulk output formats with field filtering. Powered by our priopritary heuristics engine updated regularly.

Device, Browser & OS Detection

Identify smartphones, tablets, desktops, smart TVs, consoles, and more. Get detailed browser engine info and OS version data in a single call.

Bot & Crawler Classification

Detect search engine crawlers, monitoring bots, and headless browsers with producer, category, and URL metadata.

Bulk Parsing

Send up to 25 User-Agent strings in a single request for high-throughput log processing and analytics pipelines.

Field Filtering

Request only the fields you need with ?fields= to minimize payload size and reduce bandwidth for mobile and edge applications.

Client Hints Support

Supply optional Client Hints headers alongside the UA string for significantly improved accuracy. Browsers are reducing UA string entropy — Client Hints provide the canonical browser version, OS, device model, and architecture directly.

User-Agent Spoofing Detection

When Client Hints are provided, the response includes a ua_only field containing the parse result from the UA string alone. Compare it against the hints-enriched parse to detect tampering — spoofed UA strings will show version or OS mismatches that hints cannot fake.

Use Cases

Built for real-world scenarios

Quick Start

Start using this API in seconds

Basic Parsing

$ curl -X POST https://api.apicrate.io/api/v1/ua \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}'

# Response
{
  "status": "ok",
  "data": {
    "is_bot": false,
    "client": {"name": "Chrome", "version": "120.0", "engine": "Blink"},
    "os": {"name": "Windows", "version": "10"},
    "device": {"type": "desktop", "brand": "", "model": ""}
  }
}
import requests

response = requests.post(
    "https://api.apicrate.io/api/v1/ua",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={"ua": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)"},
)

data = response.json()
print(data["data"]["device"]["type"])  # "smartphone"
print(data["data"]["os"]["name"])      # "iOS"
const res = await fetch("https://api.apicrate.io/api/v1/ua", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    ua: "Mozilla/5.0 (Linux; Android 14) AppleWebKit/537.36",
  }),
});

const { data } = await res.json();
console.log(data.device.type);  // "smartphone"
console.log(data.os.name);      // "Android"

With Client Hints

# The same UA string, but with Client Hints for precise detection.
# Without hints the UA above reports Windows 10 — with hints the API
# correctly identifies Windows 11 (platform version 14.0.0).
$ curl -X POST https://api.apicrate.io/api/v1/ua \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    "headers": {
      "Sec-CH-UA": "\"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
      "Sec-CH-UA-Mobile": "?0",
      "Sec-CH-UA-Platform": "Windows",
      "Sec-CH-UA-Platform-Version": "14.0.0",
      "Sec-CH-UA-Arch": "x86",
      "Sec-CH-UA-Bitness": "64"
    }
  }'

# Response — note the improved OS version, platform, and ua_only comparison
{
  "status": "ok",
  "data": {
    "is_bot": false,
    "client": {"name": "Chrome", "version": "120.0.6099.115", "engine": "Blink"},
    "os": {"name": "Windows", "version": "11", "platform": "x64"},
    "device": {"type": "desktop"},
    "ua_only": {
      "client": {"name": "Chrome", "version": "120.0.0.0", "engine": "Blink"},
      "os": {"name": "Windows", "version": "10"},
      "device": {"type": "desktop"}
    }
  }
}
import requests

response = requests.post(
    "https://api.apicrate.io/api/v1/ua",
    headers={"X-API-Key": "YOUR_API_KEY"},
    json={
        "ua": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 ...",
        "headers": {
            "Sec-CH-UA": '"Chromium";v="120", "Google Chrome";v="120"',
            "Sec-CH-UA-Mobile": "?1",
            "Sec-CH-UA-Platform": "Android",
            "Sec-CH-UA-Platform-Version": "13.0.0",
            "Sec-CH-UA-Model": "Pixel 7",
        },
    },
)

data = response.json()["data"]
print(data["os"]["version"])     # "13.0.0" (precise, not "10")
print(data["device"]["model"])   # "Pixel 7"
const res = await fetch("https://api.apicrate.io/api/v1/ua", {
  method: "POST",
  headers: {
    "X-API-Key": "YOUR_API_KEY",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    ua: "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 ...",
    headers: {
      "Sec-CH-UA-Mobile": "?1",
      "Sec-CH-UA-Platform": "Android",
      "Sec-CH-UA-Platform-Version": "14.0.0",
      "Sec-CH-UA-Model": "SM-S918B",
      "X-Requested-With": "com.example.myapp",
    },
  }),
});

const { data } = await res.json();
console.log(data.os.version);     // "14.0.0"
console.log(data.device.model);   // detected from SM-S918B

Field Filtering

# Request only browser, OS, and device info — a lightweight alternative
# to the full response with all boolean flags.
$ curl -X POST "https://api.apicrate.io/api/v1/ua?fields=client,os,device" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"ua": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"}'

# Response — only the requested fields
{
  "status": "ok",
  "data": {
    "client": {"name": "Chrome", "version": "120.0", "engine": "Blink"},
    "os": {"name": "Windows", "version": "10"},
    "device": {"type": "desktop", "brand": "", "model": ""}
  }
}
Endpoints

Available endpoints

POST /api/v1/ua Parse a single User-Agent string
POST /api/v1/ua/bulk Parse multiple User-Agent strings
POST /api/v1/ua/compat/device-atlas Parse User-Agents (DeviceAtlas-compatible format)
FAQ

Frequently asked questions

How many User-Agent strings can I parse in one request?

The /api/v1/ua/bulk endpoint accepts up to 25 UA strings per request, making it ideal for batch processing of access logs.

Does the API detect bots and crawlers?

Yes. The response includes a boolean is_bot flag and, when a bot is detected, detailed classification with bot name, category, and producer.

How do I get a lightweight response?

Use the ?fields= query parameter to request only the data you need. For example, ?fields=client,os,device returns just the browser, OS, and device information — no boolean flags or bot metadata.

What are Client Hints and when should I use them?

Client Hints are HTTP headers that modern browsers send alongside the traditional User-Agent string. They provide canonical browser names and full version numbers, the exact OS and version, device model, CPU architecture, and a definitive mobile/desktop indicator. Pass them in the optional headers field for significantly better results — especially important as browsers reduce UA string entropy. All headers fields are optional; include whichever ones you have available.

What is the `ua_only` field?

When you provide Client Hints headers, the response includes a ua_only object — the parse result from the UA string alone, without any hints applied. Compare client.version (hints-enriched) against ua_only.client.version (UA-string-only) to detect User-Agent spoofing. A major version mismatch is a strong signal that the UA header was tampered with. When no hints are provided, ua_only is null.

How current is the device detection database?

The definitions database is updated regularly. Check the X-Definitions-Updated response header for the exact date of the last update.

Ready to start building?

Create a free account and start making requests in under a minute.

Sign Up Free → View Documentation