Home API Tools Posts Hire Me About
Sign In Create Account
Live Free tier included

Extract Meta Tags from Any URL

Fetch Open Graph, Twitter Card, and standard meta tags from any webpage. Build link previews, SEO audits, and social sharing tools in minutes.

Open Graph Twitter Cards Favicon & Canonical No API Key

Try it Free

Enter any URL and extract all meta tags instantly.

Try Free
Result

Enter a URL and click Extract

API Documentation

Extract Open Graph, Twitter Card, and standard meta tags from any URL. Perfect for building link previews, SEO audits, social sharing tools, and content aggregators.

Endpoint

POST https://www.mahmoudalhabash.com/api/v1/og-meta

Send a JSON body with a URL. The API fetches the page, parses the HTML DOM, and returns structured Open Graph tags, Twitter Card tags, canonical URL, title, description, and HTTP metadata.

Request Parameters

ParameterTypeRequiredDescription
url string required The full URL to extract meta tags from (must start with http:// or https://)

Response Fields

url The URL that was fetched
status_code HTTP status code returned by the target URL (e.g. 200)
content_type Content-Type header from the response
title The page <title> tag content
description The meta[name="description"] content
canonical The canonical URL if specified via link[rel="canonical"]
og Object containing all Open Graph tags (og:title, og:image, og:description, etc.)
twitter Object containing all Twitter Card tags (twitter:card, twitter:title, etc.)

Code Examples

cURL
curl -X POST https://www.mahmoudalhabash.com/api/v1/og-meta \ -H "Content-Type: application/json" \ -d '{"url": "https://github.com"}'
Response 200 JSON
{ "url": "https://github.com", "status_code": 200, "content_type": "text/html; charset=utf-8", "title": "GitHub: Let's build from here", "description": "GitHub is where people build software...", "canonical": "https://github.com", "og": { "title": "GitHub: Let's build from here", "description": "GitHub is where...", "image": "https://github.githubassets.com/images/..." }, "twitter": { "card": "summary_large_image", "site": "@github" } }
JavaScript (fetch)
const res = await fetch('https://www.mahmoudalhabash.com/api/v1/og-meta', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ url: 'https://github.com' }) }); const meta = await res.json(); // Build a link preview card const preview = { title: meta.og?.title || meta.title, desc: meta.og?.description || meta.description, image: meta.og?.image || null, site: meta.twitter?.site || new URL(meta.url).hostname };
Python (requests)
import requests resp = requests.post( 'https://www.mahmoudalhabash.com/api/v1/og-meta', json={'url': 'https://github.com'} ) meta = resp.json() print(f"Title: {meta['og'].get('title', meta['title'])}") print(f"Image: {meta['og'].get('image', 'N/A')}") print(f"Twitter: @{meta['twitter'].get('site', '')}") print(f"HTTP {meta['status_code']}")
PHP (Laravel)
$response = Http::post( 'https://www.mahmoudalhabash.com/api/v1/og-meta', ['url' => 'https://github.com'] ); $meta = $response->json(); $title = $meta['og']['title'] ?? $meta['title']; $image = $meta['og']['image'] ?? null; // Use for social sharing previews

Error Codes

422 Validation failed — URL is required and must be a valid HTTP/HTTPS URL
400 Bad request — malformed JSON body
429 Rate limit exceeded — too many requests
500 Failed to fetch URL — target unreachable, timeout, or non-HTML response

Rate Limits

Unlimited — Free during beta

No API key required. Fetched pages are not cached — each request makes a fresh HTTP call to the target URL. Timeout is 10 seconds.