GET /api/open-graph

Open Graph

Fetch page metadata for any URL. Returns title, description, canonical URL, Open Graph tags, and Twitter card tags as structured JSON. Redirects are followed with the same host safety checks used across TinyUtils URL endpoints. Successful results are cached for 60 seconds, and some deterministic errors may also be cached.

Query parameters

urlrequiredThe URL to fetch metadata from. Scheme may be http or https; if omitted, https is assumed.

Example request

curl

curl "https://tinyutils.dev/api/open-graph?url=https://example.com"

JavaScript (fetch)

const res = await fetch(
  "https://tinyutils.dev/api/open-graph?url=https://example.com"
);
const data = await res.json();

Example response

{
  "input_url": "https://example.com",
  "final_url": "https://www.example.com/",
  "status": 200,
  "title": "Example Domain",
  "description": "Example description",
  "canonical": "https://www.example.com/",
  "open_graph": {
    "title": "Example Domain",
    "description": "Example description",
    "type": "website"
  },
  "twitter": {
    "card": "summary_large_image",
    "title": "Example Domain"
  },
  "error": null,
  "meta": {
    "responseTimeMs": 96,
    "cached": false,
    "rateLimitedScope": "global"
  }
}

Non-HTML response

{
  "input_url": "https://example.com/file.pdf",
  "final_url": "https://example.com/file.pdf",
  "status": 200,
  "title": null,
  "description": null,
  "canonical": null,
  "open_graph": {},
  "twitter": {},
  "error": null,
  "meta": {
    "responseTimeMs": 84,
    "cached": false,
    "rateLimitedScope": "global"
  }
}

Error codes

INVALID_URLThe URL is missing, malformed, or uses an unsupported scheme.
BLOCKED_HOSTThe target resolves to a private, reserved, or internal address.
TIMEOUTThe upstream request timed out.
NETWORK_ERRORThe upstream request failed.
REDIRECT_LOOPA redirect cycle was detected while following the URL.
MISSING_LOCATIONA redirect response was missing or had an unparseable Location header.
TOO_MANY_REDIRECTSThe URL required more than 10 redirects to resolve.
RATE_LIMITEDYou have exceeded the daily request limit.
INTERNAL_ERRORAn unexpected server error occurred.

Rate limiting

Requests are rate-limited via a global pool shared with other public URL endpoints. Successful responses are cached for 60 seconds to reduce duplicate fetches, and some deterministic errors may also be cached. When the limit is exceeded, the endpoint returns HTTP 429 with RATE_LIMITED.

See also

Looking for implementation ideas? Open Graph API guide shows practical integration patterns.