Skip to content

User-Agent

Description

The User-Agent request header is an HTTP header that allows the client (such as a web browser, mobile app, or other user agent) to identify itself to the server. This header contains a string that provides information about the client’s software, version, operating system, and sometimes additional details.

Servers use the User-Agent header for content negotiation, analytics, and security measures such as blocking or adapting responses based on the client type.

Syntax

The User-Agent header follows this syntax:

User-Agent: <product>/<version> (<system-information>) [additional-details]

Components:

  • <product>:
    The name of the client software (e.g., Mozilla, Chrome, Postman).
  • <version>:
    The version of the client software.
  • <system-information>:
    Information about the operating system or platform (optional).
  • [additional-details]:
    Extra details such as rendering engines or compatibility details (optional).

Examples

Browser User-Agent

A request from Google Chrome on Windows:

GET / HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36

The server can use this information to serve optimized content for Chrome on Windows.

Mobile User-Agent

A request from an iPhone using Safari:

GET /mobile HTTP/1.1
Host: example.com
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_6 like Mac OS X) AppleWebKit/537.36 (KHTML, like Gecko) Version/14.0 Mobile/15E148 Safari/537.36

The server may respond with a mobile-friendly version of the website.

API Client User-Agent

A request from an API client such as Postman:

GET /api/data HTTP/1.1
Host: api.example.com
User-Agent: PostmanRuntime/7.28.2

The server can recognize that the request comes from Postman and adjust its response accordingly.