Skip to content

ParrotApi/user-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Latest Chrome User-Agent API

Every web scraper eventually hits the same silent failure: the hardcoded User-Agent string in your code slowly goes stale. Chrome ships a new stable version roughly every four weeks, and a UA claiming to be Chrome/109 in a world where everyone else is on Chrome/138 is an easy flag for Cloudflare, Akamai, and even basic server-side filters. You either maintain your own list (and forget to update it), copy one from a gist last edited in 2023, or generate fake strings that get the platform token format subtly wrong.

This API removes that chore. One HTTP call to /latest returns a correctly-formatted, current Chrome User-Agent for the platform you ask for — Windows, macOS, Linux, Android, or iOS — updated with every Chrome stable release. Need variety across a request pool? /random gives you a realistic UA each call, /all returns the full current set, and /platforms lists what's available.

Typical uses:

  • Web scrapers and crawlers that need to blend in with real browser traffic instead of announcing python-requests/2.31
  • HTTP clients and SDKs that want a sane, current default UA without shipping updates for it
  • Automated browsers and bots (Puppeteer, Playwright, Selenium) that override the UA for consistency across a fleet
  • Testing and QA pipelines that verify how your own site responds to current Chrome on each platform

Get started

  1. Subscribe (free tier available) on RapidAPI and copy your X-RapidAPI-Key.
  2. Call the API — here's the primary endpoint in every major language.

Base URL: https://latest-chrome-user-agent-api.p.rapidapi.com

Code examples

cURL

curl --request GET \
  --url 'https://latest-chrome-user-agent-api.p.rapidapi.com/latest' \
  --header 'X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \
  --header 'X-RapidAPI-Host: latest-chrome-user-agent-api.p.rapidapi.com'

Python

import requests

url = "https://latest-chrome-user-agent-api.p.rapidapi.com/latest"
querystring = {}
headers = {
    "X-RapidAPI-Key": "YOUR_RAPIDAPI_KEY",
    "X-RapidAPI-Host": "latest-chrome-user-agent-api.p.rapidapi.com",
}

response = requests.get(url, headers=headers, params=querystring)
print(response.json())

JavaScript (fetch)

const url = 'https://latest-chrome-user-agent-api.p.rapidapi.com/latest';
const options = {
  method: 'GET',
  headers: {
    'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
    'X-RapidAPI-Host': 'latest-chrome-user-agent-api.p.rapidapi.com',
  },
};

const response = await fetch(url, options);
console.log(await response.json());

Node.js (axios)

import axios from 'axios';

const options = {
  method: 'GET',
  url: 'https://latest-chrome-user-agent-api.p.rapidapi.com/latest',
  params: {},
  headers: {
    'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
    'X-RapidAPI-Host': 'latest-chrome-user-agent-api.p.rapidapi.com',
  },
};

const { data } = await axios.request(options);
console.log(data);

TypeScript

const url = 'https://latest-chrome-user-agent-api.p.rapidapi.com/latest';

const response = await fetch(url, {
  method: 'GET',
  headers: {
    'X-RapidAPI-Key': 'YOUR_RAPIDAPI_KEY',
    'X-RapidAPI-Host': 'latest-chrome-user-agent-api.p.rapidapi.com',
  } as Record<string, string>,
});

const data: unknown = await response.json();
console.log(data);

PHP

<?php
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://latest-chrome-user-agent-api.p.rapidapi.com/latest",
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => [
        "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY",
        "X-RapidAPI-Host: latest-chrome-user-agent-api.p.rapidapi.com",
    ],
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;

Ruby

require 'uri'
require 'net/http'

url = URI("https://latest-chrome-user-agent-api.p.rapidapi.com/latest")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["X-RapidAPI-Key"] = 'YOUR_RAPIDAPI_KEY'
request["X-RapidAPI-Host"] = 'latest-chrome-user-agent-api.p.rapidapi.com'

response = http.request(request)
puts response.read_body

Java (OkHttp)

OkHttpClient client = new OkHttpClient();

Request request = new Request.Builder()
    .url("https://latest-chrome-user-agent-api.p.rapidapi.com/latest")
    .get()
    .addHeader("X-RapidAPI-Key", "YOUR_RAPIDAPI_KEY")
    .addHeader("X-RapidAPI-Host", "latest-chrome-user-agent-api.p.rapidapi.com")
    .build();

Response response = client.newCall(request).execute();
System.out.println(response.body().string());

C#

using var client = new HttpClient();
var request = new HttpRequestMessage
{
    Method = HttpMethod.Get,
    RequestUri = new Uri("https://latest-chrome-user-agent-api.p.rapidapi.com/latest"),
    Headers =
    {
        { "X-RapidAPI-Key", "YOUR_RAPIDAPI_KEY" },
        { "X-RapidAPI-Host", "latest-chrome-user-agent-api.p.rapidapi.com" },
    },
};

using var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());

Go

package main

import (
    "fmt"
    "io"
    "net/http"
)

func main() {
    req, _ := http.NewRequest("GET", "https://latest-chrome-user-agent-api.p.rapidapi.com/latest", nil)
    req.Header.Add("X-RapidAPI-Key", "YOUR_RAPIDAPI_KEY")
    req.Header.Add("X-RapidAPI-Host", "latest-chrome-user-agent-api.p.rapidapi.com")

    res, _ := http.DefaultClient.Do(req)
    defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)
    fmt.Println(string(body))
}

Rust

use reqwest::header::{HeaderMap, HeaderValue};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let mut headers = HeaderMap::new();
    headers.insert("X-RapidAPI-Key", HeaderValue::from_static("YOUR_RAPIDAPI_KEY"));
    headers.insert("X-RapidAPI-Host", HeaderValue::from_static("latest-chrome-user-agent-api.p.rapidapi.com"));

    let client = reqwest::Client::new();
    let res = client.get("https://latest-chrome-user-agent-api.p.rapidapi.com/latest").headers(headers).send().await?;
    println!("{}", res.text().await?);
    Ok(())
}

Swift

import Foundation

var request = URLRequest(url: URL(string: "https://latest-chrome-user-agent-api.p.rapidapi.com/latest")!)
request.httpMethod = "GET"
request.setValue("YOUR_RAPIDAPI_KEY", forHTTPHeaderField: "X-RapidAPI-Key")
request.setValue("latest-chrome-user-agent-api.p.rapidapi.com", forHTTPHeaderField: "X-RapidAPI-Host")

let (data, _) = try await URLSession.shared.data(for: request)
print(String(data: data, encoding: .utf8)!)

Kotlin

val client = OkHttpClient()

val request = Request.Builder()
    .url("https://latest-chrome-user-agent-api.p.rapidapi.com/latest")
    .get()
    .addHeader("X-RapidAPI-Key", "YOUR_RAPIDAPI_KEY")
    .addHeader("X-RapidAPI-Host", "latest-chrome-user-agent-api.p.rapidapi.com")
    .build()

val response = client.newCall(request).execute()
println(response.body?.string())

Shell (wget)

wget -qO- \
  --header='X-RapidAPI-Key: YOUR_RAPIDAPI_KEY' \
  --header='X-RapidAPI-Host: latest-chrome-user-agent-api.p.rapidapi.com' \
  'https://latest-chrome-user-agent-api.p.rapidapi.com/latest'

Endpoints

Method Path Description
GET /latest Latest Chrome user-agent
GET /random Random platform user-agent
GET /all All platform user-agents
GET /platforms List supported platforms

How to keep your web scraper's User-Agent up to date (without maintaining your own list)

Read the full guide: How to keep your web scraper's User-Agent up to date (without maintaining your own list)


⭐ Powered by the Latest Chrome User-Agent API API on RapidAPI.

About

Get the latest Chrome User-Agent string for Windows, macOS, Linux, Android & iOS via a simple REST API. Always current with each Chrome stable release.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors