User Agent Parser

This API endpoint parses raw User-Agent strings to extract detailed information about the client's operating system, browser, and device type. This data is valuable for analytics, device targeting, and optimizing user experiences based on their environment.

Endpoint

POST https://api.zapifyapi.com/v1/{api_token}

Path Parameters

Parameter Type Description
api_token string Required. Your unique API access token for the User Agent Parser service.

Request Body

The request expects a JSON object. If the user_agent field is omitted, the API will attempt to parse the User-Agent header of the request itself.

Key Type Description
user_agent string Optional. The raw User-Agent string you want to parse. Defaults to the request header if not provided.

Example Request

cURL

curl -X POST "https://api.zapifyapi.com/v1/YOUR_API_TOKEN" 
     -H "Content-Type: application/json" 
     -d '{
           "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36"
         }'

Node.js

const axios = require("axios");

const payload = {
    user_agent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36"
};

axios.post("https://api.zapifyapi.com/v1/YOUR_API_TOKEN", payload)
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.error(error);
});

Response

Returns a JSON object with the parsed OS, browser, and device information.

{
    "user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36...",
    "browser": "Chrome",
    "os": "MacOS",
    "device": "Desktop",
    "is_bot": false
}