API Documentation

Turn any URL into structured metadata and ready-to-use embed HTML with a single request. All endpoints are served under https://iframe.2yu.dev/api/v1.

Authentication

Every request needs an API key. Create one in your dashboard. Keys look like ifr_live_…. Pass it as a Bearer token:

curl "https://iframe.2yu.dev/api/v1/extract?url=https://youtu.be/dQw4w9WgXcQ" \
  -H "Authorization: Bearer ifr_live_xxxxxxxxxxxx"

Extract metadata & embed

GET/api/v1/extract

Fetches a URL and returns structured metadata plus responsive embed HTML.

url
stringrequired
The URL to extract.
maxwidth
integeroptional
Max embed width in px (passed to oEmbed providers that support it).
maxheight
integeroptional
Max embed height in px.
omit_script
booleanoptional
If true, strips <script> from widget embeds (Twitter/X, Instagram, TikTok).
omit_attribution
booleanoptional
Paid plans already leave the corner mark off card embeds. Free plans keep it.
theme
light | darkoptional
Theme for Amazon hosted cards.
card
smalloptional
Compact variant for Amazon hosted cards.
style
card | compact | cta | compact-ctaoptional
Amazon card template (Amazon URLs only).
button
stringoptional
CTA button label for cta/compact-cta Amazon cards.

oEmbed endpoint

GET/api/v1/oembed

A standard oEmbed 1.0 response — a drop-in for editors/CMSs that already speak oEmbed (CKEditor, TipTap, …). Accepts url (required), maxwidth, and maxheight.

Batch extraction

POST/api/v1/extract/batch

Extract up to 20 URLs in one call. Requires the Pro plan or higher. Each URL counts as one request against your rate limit. Partial failure is normal — the response is always 200 with per-URL status.

curl -X POST "https://iframe.2yu.dev/api/v1/extract/batch" \
  -H "Authorization: Bearer ifr_live_xxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{"urls":["https://youtu.be/abc","https://vimeo.com/123"]}'

# → { "results": [ { "url": "...", "status": "ok", "data": { ... } },
#                  { "url": "...", "status": "error", "error": "url_not_found" } ],
#     "meta": { "total": 2, "succeeded": 1, "failed": 1 } }

The response object

The type field tells you how to render: video/rich (use the responsive iframe html), widget (blockquote + provider script), photo, or card (generic — prefer rendering your own from meta + thumbnails).

{
  "url": "https://www.youtube.com/watch?v=...",
  "original_url": "https://youtu.be/...",
  "type": "video",
  "html": "<div style=...><iframe src=\"https://www.youtube.com/embed/...\"></iframe></div>",
  "meta": { "title": "...", "description": "...", "published": "...", "cache_age": 21600 },
  "provider": { "name": "YouTube", "url": "https://www.youtube.com", "display": "youtube.com", "favicon": "..." },
  "authors": [ { "name": "...", "url": "..." } ],
  "media": { "width": null, "height": null, "aspect_ratio": 1.7778, "type": "text/html" },
  "thumbnails": [ { "url": "...", "width": 1280, "height": 720 } ]
}

Rate limits & caching

Limits are per API key, per rolling hour, by plan (see pricing). Every response includes:

X-RateLimit-Limit
headeroptional
Requests allowed in the current rolling hour.
X-RateLimit-Remaining
headeroptional
Requests remaining in the window.
X-RateLimit-Reset
headeroptional
Unix timestamp when the window resets.
X-Cache
headeroptional
HIT or MISS — whether the result came from cache.

Error responses

Errors return a JSON body { "error": "code", "message": "..." } with an appropriate status.

url_required
400optional
The url parameter is missing.
invalid_url
400optional
The URL is malformed or uses an unsupported scheme.
invalid_api_key
401optional
Missing or invalid API key.
plan_required
403optional
The endpoint requires a higher plan (e.g. batch).
blocked_url
403optional
The URL resolves to a private/restricted address.
url_not_found
404optional
The URL returned a 404.
upstream_timeout
408optional
The URL did not respond in time.
rate_limit_exceeded
429optional
Rate limit exceeded — see the X-RateLimit-* headers.
extraction_failed
500optional
Metadata extraction failed.

Ready to build?

Grab a free API key and make your first request in seconds.

Get your API key