Skip to main content

Random User Agent API

MOCK DATA

Realistic, coherent browser user agents — filter by browser, OS and device; impossible combos like Safari-on-Windows get a clear 400, never a fake string.

Generated test data for fixtures and development

Base URL
/api/user-agents
Capabilities
1 route Seedable
Last updated
July 30, 2026

GET /api/user-agents

Live requestRuns against the public API
No key required
GET/api/user-agents?count=5&seed=42

Request parameters

Browser family. Impossible pairs are rejected with an explanatory 400 (e.g. Safari only runs on macOS/iOS) — never faked.

Operating system. On iOS only Safari is modeled (Chrome/Firefox/Edge there are WebKit shells); windows/macos/linux imply desktop.

Form factor. windows/macos/linux are desktop-only; android and ios are mobile or tablet (an iOS tablet is an iPad).

Advanced response options7 options

How many records to generate (1–100).

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

Return all fields except these (comma-separated).

Response format: json envelope, ndjson (one record per line) or csv.

Pretty-print the JSON response.

Drop the envelope: return the raw array/object without data/meta wrapper.

Response

Example parameters are ready. Send the request to inspect the live response.

Route reference

Code samples Ready-to-copy requests in 4 languages
Choose a code sample language
curl "https://randomapi.dev/api/user-agents?count=5&seed=42"
const res = await fetch("https://randomapi.dev/api/user-agents?count=5&seed=42");
const { data, meta } = await res.json();
import requests

data = requests.get("https://randomapi.dev/api/user-agents?count=5&seed=42").json()["data"]
$json = json_decode(file_get_contents(
  "https://randomapi.dev/api/user-agents?count=5&seed=42"
), true);
$data = $json["data"];
Parameters Route-specific request inputs 3
browser enum

Browser family. Impossible pairs are rejected with an explanatory 400 (e.g. Safari only runs on macOS/iOS) — never faked.

allowed: chrome | firefox | safari | edge
example: browser=chrome
os enum

Operating system. On iOS only Safari is modeled (Chrome/Firefox/Edge there are WebKit shells); windows/macos/linux imply desktop.

allowed: windows | macos | linux | android | ios
example: os=android
device enum

Form factor. windows/macos/linux are desktop-only; android and ios are mobile or tablet (an iOS tablet is an iPad).

allowed: desktop | mobile | tablet
example: device=mobile
Universal parameters Shared response and formatting options 7
count int

How many records to generate (1–100).

default: 10
allowed: 1 – 100
example: count=3
seed int

Deterministic output: the same seed always returns the same records. Omit for random (the used seed is echoed in meta.seed).

example: seed=42
fields list

Return only these fields (comma-separated). Mutually exclusive with 'exclude'.

example: fields=userAgent,browser
exclude list

Return all fields except these (comma-separated).

example: exclude=device
format enum

Response format: json envelope, ndjson (one record per line) or csv.

default: json
allowed: json | ndjson | csv
example: format=csv
pretty boolean

Pretty-print the JSON response.

default: false
example: pretty=true
unwrap boolean

Drop the envelope: return the raw array/object without data/meta wrapper.

default: false
example: unwrap=true
Response schema Fields returned in each record 5
userAgent string

Full User-Agent header value. Its platform and browser tokens always match the browser, os and device fields.

example: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

browser string

chrome | firefox | safari | edge.

example: chrome

browserVersion string

Version exactly as it appears in the UA's browser token (Chrome/Edge are frozen to <major>.0.0.0, Firefox is <major>.0, Safari is <major>.<minor>).

example: 138.0.0.0

os string

windows | macos | linux | android | ios.

example: windows

device string

desktop | mobile | tablet.

example: desktop

Documented examples

Build-generated requests and complete responses
4
Five coherent random user agents
GET /api/user-agents?count=5&seed=42
{
  "data": [
    {
      "userAgent": "Mozilla/5.0 (Android 14; Mobile; rv:140.0) Gecko/140.0 Firefox/140.0",
      "browser": "firefox",
      "browserVersion": "140.0",
      "os": "android",
      "device": "mobile"
    },
    {
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
      "browser": "chrome",
      "browserVersion": "130.0.0.0",
      "os": "windows",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36 Edg/131.0.0.0",
      "browser": "edge",
      "browserVersion": "131.0.0.0",
      "os": "linux",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36",
      "browser": "chrome",
      "browserVersion": "138.0.0.0",
      "os": "linux",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36 Edg/140.0.0.0",
      "browser": "edge",
      "browserVersion": "140.0.0.0",
      "os": "linux",
      "device": "desktop"
    }
  ],
  "meta": {
    "endpoint": "user-agents",
    …
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Safari on iPhone
GET /api/user-agents?browser=safari&os=ios&device=mobile&count=3
{
  "data": [
    {
      "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 26_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.2 Mobile/15E148 Safari/604.1",
      "browser": "safari",
      "browserVersion": "26.2",
      "os": "ios",
      "device": "mobile"
    },
    {
      "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3 Mobile/15E148 Safari/604.1",
      "browser": "safari",
      "browserVersion": "17.3",
      "os": "ios",
      "device": "mobile"
    },
    {
      "userAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1",
      "browser": "safari",
      "browserVersion": "17.2",
      "os": "ios",
      "device": "mobile"
    }
  ],
  "meta": {
    "endpoint": "user-agents",
    "count": 3,
    "seed": 42,
    "params": {
      "browser": "safari",
      "os": "ios",
      "device": "mobile"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Desktop Firefox only
GET /api/user-agents?browser=firefox&device=desktop&count=5
{
  "data": [
    {
      "userAgent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:140.0) Gecko/20100101 Firefox/140.0",
      "browser": "firefox",
      "browserVersion": "140.0",
      "os": "macos",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:130.0) Gecko/20100101 Firefox/130.0",
      "browser": "firefox",
      "browserVersion": "130.0",
      "os": "windows",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:131.0) Gecko/20100101 Firefox/131.0",
      "browser": "firefox",
      "browserVersion": "131.0",
      "os": "linux",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0",
      "browser": "firefox",
      "browserVersion": "139.0",
      "os": "windows",
      "device": "desktop"
    },
    {
      "userAgent": "Mozilla/5.0 (X11; Linux x86_64; rv:141.0) Gecko/20100101 Firefox/141.0",
      "browser": "firefox",
      "browserVersion": "141.0",
      "os": "linux",
      "device": "desktop"
    }
  ],
  "meta": {
    "endpoint": "user-agents",
    …
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}
Chrome on Android tablets
GET /api/user-agents?browser=chrome&os=android&device=tablet&count=3
{
  "data": [
    {
      "userAgent": "Mozilla/5.0 (Linux; Android 13; SM-X510) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36",
      "browser": "chrome",
      "browserVersion": "139.0.0.0",
      "os": "android",
      "device": "tablet"
    },
    {
      "userAgent": "Mozilla/5.0 (Linux; Android 14; SM-X910) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/130.0.0.0 Safari/537.36",
      "browser": "chrome",
      "browserVersion": "130.0.0.0",
      "os": "android",
      "device": "tablet"
    },
    {
      "userAgent": "Mozilla/5.0 (Linux; Android 14; SM-X910) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
      "browser": "chrome",
      "browserVersion": "131.0.0.0",
      "os": "android",
      "device": "tablet"
    }
  ],
  "meta": {
    "endpoint": "user-agents",
    "count": 3,
    "seed": 42,
    "params": {
      "browser": "chrome",
      "os": "android",
      "device": "tablet"
    },
    "generatedAt": "2026-07-30T15:14:08.000Z"
  }
}

About this API

Coverage & behavior

Generates realistic, internally coherent User-Agent strings: the platform token, browser token and version inside the string always match the structured browser, browserVersion, os and device fields, so every record survives real UA parsers.

The compatibility matrix is enforced, never faked. ?browser=safari&os=windows returns a 400 explaining the rule (Safari only runs on macOS/iOS) instead of inventing a string no real device sends:

browser windows macos linux android ios
chrome
firefox
safari
edge

windows, macos and linux imply device=desktop; android and ios are mobile or tablet (an iOS tablet is an iPad). On iOS only Safari is modeled — Chrome, Firefox and Edge there are WebKit shells with their own CriOS/FxiOS/EdgiOS tokens, not their real engines. Omitted parameters are filled with a coherent random pick per record.

Versions and tokens mirror current reality: Chrome and Edge 130–143 with UA-reduction-frozen <major>.0.0.0 versions (Edge mirrors the matching Chrome UA and appends Edg/<version>), Firefox 130–145 with a matching rv: token, and Safari majors 17, 18 and 26 — the versions that actually shipped (Apple skipped 19–25). Platform tokens are the frozen strings real browsers send: Windows NT 10.0; Win64; x64 even on Windows 11, Macintosh; Intel Mac OS X 10_15_7 (Firefox: 10.15), X11; Linux x86_64, Linux; Android 13-15; <model> with real Pixel/Galaxy model tokens (Chrome/Edge only — Firefox on Android omits the model, exactly like the real browser, and Chrome drops the Mobile token on Android tablets), and iPhone; CPU iPhone OS x_y / iPad; CPU OS x_y with the OS version matching Safari's.

Do not confuse this with /api/crawlers. This endpoint generates plausible fake browser strings for fixtures — the values are mock and no real device ever sent that exact string. /api/crawlers is the opposite: a pinned list of the real User-Agent tokens and patterns that Googlebot, Bingbot, GPTBot and friends actually send, for writing robots.txt rules and classifying live traffic. Never match production requests against a string generated here.

Use it for

  • Seed analytics dashboards or request logs with a believable browser/device mix
  • Test user-agent parsing and device-detection logic against coherent, current strings
  • Drive browser- or device-specific code paths in end-to-end and load tests

Frequently asked questions

Can I filter by browser, OS or device?

Yes — browser, os and device each genuinely constrain generation, and the response breaks out browserVersion, os and device so you don't have to parse the string.

Are these real UA strings?

They follow the real vendors' formats with plausible versions — realistic enough to exercise parsers, but generated, not scraped from live traffic.

What are they useful for?

Testing UA parsing, analytics pipelines, device-detection logic and log fixtures — without harvesting real visitor data.

Standards & references