Mobile-Friendly¶
Fetch a URL and report a static mobile-friendliness verdict based on three signals:
- Viewport meta — is
<meta name="viewport">present, and does it includewidth=device-width? - Font sizes — any
font-sizedeclarations in<style>blocks or inlinestyle=""attributes that fall below the readable threshold (12px / 9pt). - Media queries — count of
@mediarules in inline CSS and<link media="...">tags (excludingprint).
This is a fast, no-headless-browser check — perfect for crawl-time pre-screening, CI gates on preview deploys, or running across thousands of URLs cheaply. It does not render pages or run JavaScript, so SPAs that hydrate their viewport tag at runtime won't be detected.
For full on-page SEO signals see /v1/seo/audit.
Endpoint¶
GET /v1/seo/mobile-friendly
Base URL: https://seo.toolkitapi.io
Query Parameters¶
| Field | Type | Required | Description |
|---|---|---|---|
url |
string | Yes | Absolute URL to check. Must be http:// or https://. |
Response Fields¶
| Field | Type | Description |
|---|---|---|
url |
string | The URL that was analysed (echoed from the request). |
is_mobile_friendly |
boolean | Overall verdict: true iff has_responsive_meta is true and font_size_issues is empty. |
viewport_meta |
string | null | Raw content of the <meta name="viewport"> tag, or null if missing. |
has_viewport |
boolean | A non-empty viewport meta tag was found. |
has_responsive_meta |
boolean | The viewport string contains width=device-width. |
font_size_issues |
string[] | Up to 20 human-readable warnings about small font-size declarations. |
has_media_queries |
boolean | At least one @media rule (or non-print <link media="">) was detected. |
media_query_count |
integer | Total @media rules in <style> blocks plus non-print <link media=""> tags. |
Font-size detection¶
Font-size warnings are emitted for declarations that fall below the readable threshold:
pxunits smaller than 12pxptunits smaller than 9pt
Both <style> block CSS and inline style="font-size:..." attributes are scanned. Inline scanning is capped at the first 50 elements to keep the check fast on large pages. Up to 20 issues are returned.
Examples¶
curl¶
curl -G "https://seo.toolkitapi.io/v1/seo/mobile-friendly" \
-H "x-api-key: $TOOLKIT_API_KEY" \
--data-urlencode "url=https://example.com"
Python¶
import requests
resp = requests.get(
"https://seo.toolkitapi.io/v1/seo/mobile-friendly",
params={"url": "https://example.com"},
headers={"x-api-key": API_KEY},
timeout=30,
)
data = resp.json()
if not data["is_mobile_friendly"]:
print(f"❌ {data['url']} not mobile-friendly")
if not data["has_responsive_meta"]:
print(f" - viewport: {data['viewport_meta'] or '(missing)'}")
for issue in data["font_size_issues"]:
print(f" - {issue}")
if not data["has_media_queries"]:
print(" - no CSS media queries detected")
else:
print(f"✅ {data['url']} looks mobile-friendly "
f"({data['media_query_count']} media queries)")
JavaScript¶
const url = new URL("https://seo.toolkitapi.io/v1/seo/mobile-friendly");
url.searchParams.set("url", "https://example.com");
const resp = await fetch(url, {
headers: { "x-api-key": process.env.TOOLKIT_API_KEY },
});
const data = await resp.json();
if (!data.is_mobile_friendly) {
console.warn(`Not mobile-friendly: ${data.url}`, {
viewport: data.viewport_meta,
issues: data.font_size_issues,
mediaQueries: data.media_query_count,
});
}
Example Response¶
{
"url": "https://example.com",
"is_mobile_friendly": false,
"viewport_meta": "width=device-width, initial-scale=1",
"has_viewport": true,
"has_responsive_meta": true,
"font_size_issues": [
"Small font-size: 10px (minimum 12px recommended)",
"Inline small font-size: 11px on <span>"
],
"has_media_queries": true,
"media_query_count": 6
}
In the example above, the viewport is correct and CSS uses media queries — but two font-size declarations dip below 12px, so the overall verdict flips to false. Address the small fonts and the next call will return is_mobile_friendly: true.
Notes¶
- The check is HTML/CSS-only — no headless browser, no JS execution. Sites that hydrate their viewport meta from JavaScript will look like they're missing it.
font_size_issuesis capped at 20; on a page with hundreds of small fonts you'll see the first 20.media_query_countis a smoke test, not a coverage metric — having one media query rarely makes a page actually responsive, but having zero is a strong signal it isn't.- Each call goes through the same SSRF guard as
/v1/seo/audit; private/loopback targets are rejected with400.