Ruby Metadata API
Extract title, description, image and logo from any URL with one HTTP request in Ruby — no HTML parsing, no tag soup, no browser to maintain.
Extract metadata in Ruby
No gem and no parser — the Microlink REST API turns any URL into normalized metadata with a single HTTP GET. Here it is with Net::HTTP and JSON from the Ruby standard library.
Step 01 · Extract any URL
A few lines with the standard library — no gem to add. Point it at a page and read the metadata from the JSON response.
extract.rb
require 'json'
require 'net/http'
require 'uri'
uri = URI('https://api.microlink.io')
uri.query = URI.encode_www_form(url: 'https://microlink.io')
data = JSON.parse(Net::HTTP.get(uri))['data']
puts data['title'] # 'Microlink | The web, transformed'
puts data['description'] # 'A single API for turning any URL into data…'
puts data.dig('image', 'url') # absolute, CDN-hosted
puts data.dig('logo', 'url') # absolute, CDN-hostedStep 02 · Pick the fields you need
Title, description, publisher, author, date, lang, image and logo all come back in one call — build exactly the object your product needs.
fields.rb
require 'json'
require 'net/http'
require 'uri'
uri = URI('https://api.microlink.io')
uri.query = URI.encode_www_form(url: 'https://microlink.io')
data = JSON.parse(Net::HTTP.get(uri))['data']
preview = {
title: data['title'],
description: data['description'],
publisher: data['publisher'],
author: data['author'],
date: data['date'],
lang: data['lang'],
image: data.dig('image', 'url'),
logo: data.dig('logo', 'url')
}Step 03 · Render JavaScript pages
Tags injected by client-side JavaScript only exist after the page renders — prerender with a real browser and wait for them, still one request.
spa.rb
require 'json'
require 'net/http'
require 'uri'
uri = URI('https://api.microlink.io')
uri.query = URI.encode_www_form(
url: 'https://app.example.com',
prerender: true, # render JS in a real browser first
waitForSelector: 'h1' # wait until the content exists
)
data = JSON.parse(Net::HTTP.get(uri))['data']
puts data['title']Step 04 · Build a link preview
Image and logo come back as absolute, CDN-hosted URLs — drop them straight into an img tag and you have a link preview.
link_preview.rb
require 'json'
require 'net/http'
require 'uri'
uri = URI('https://api.microlink.io')
uri.query = URI.encode_www_form(url: 'https://microlink.io')
data = JSON.parse(Net::HTTP.get(uri))['data']
image = data.dig('image', 'url') || data.dig('logo', 'url')
puts <<~HTML
<a href="#{data['url']}" class="card">
<img src="#{image}" alt="" />
<strong>#{data['title']}</strong>
<p>#{data['description']}</p>
</a>
HTMLDrop it into your framework
A Rails controller, a Sinatra route, or a Sidekiq job — the same request becomes your own metadata endpoint for link previews and enrichment.
- Rails
- Sinatra
- Sidekiq
- Plain Ruby
require 'sinatra'
require 'json'
require 'net/http'
require 'uri'
# GET /preview?url=https://microlink.io
get '/preview' do
uri = URI('https://api.microlink.io')
uri.query = URI.encode_www_form(url: params[:url])
data = JSON.parse(Net::HTTP.get(uri))['data']
content_type :json
{
title: data['title'],
description: data['description'],
image: data.dig('image', 'url')
}.to_json
endSkip the tag-parsing maintenance
Rolling your own means fetching HTML, parsing Open Graph and Twitter Cards with Nokogiri, merging JSON-LD and oEmbed, and wiring Selenium or Ferrum for JavaScript-injected tags. The API gives you normalized metadata from any page without any of the moving parts.
DIY tag parsing
- Fetch the HTML and parse og, twitter and meta tags yourself
- Merge JSON-LD, oEmbed and microdata by hand — every site differs
- Resolve relative image and logo URLs against redirects yourself
- JavaScript-injected tags need a headless browser — a 300 MB binary
- Each browser eats hundreds of MB of RAM per worker
- You build the caching, retries and autoscaling
Microlink for Ruby
- One HTTP request — Net::HTTP from the standard library, no gem to add
- Open Graph, Twitter Cards, JSON-LD and oEmbed merged for you
- Image and logo as absolute, CDN-hosted URLs
- JavaScript-injected tags captured with prerender=true
- Cached responses from a global edge network
- Autoscaled fleet with a 99.95% uptime SLA
Built for the way you write Ruby.
A REST API that feels native in Ruby — one call, JSON back, and at home in anything from a Rake task to a Rails app. Read the API overview to go deeper.
No HTML Parsing
No tag soup, no regex, no DOM library to install. One HTTP GET returns a normalized JSON object.
Standard Library Only
Net::HTTP and JSON ship with Ruby — the examples work with zero dependencies and nothing to compile.
Every Source Merged
Open Graph, Twitter Cards, JSON-LD, oEmbed, microdata and plain HTML tags are merged into a single normalized response.
CDN-Hosted Assets
Image and logo come back as absolute URLs on a global CDN — hot-link them directly, no downloading or proxying.
JavaScript Rendering
Tags injected by client-side JavaScript are captured too, with prerender=true and waitForSelector.
Link Preview Ready
Title, description, image, logo and publisher are exactly the fields a link preview card needs — one call, one card.
Framework Friendly
Drop it into Rails, Sinatra, or a Sidekiq job as a controller action, route, or worker in a few lines.
Zero Infrastructure
Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.
Generous Free Tier
Start with 25 requests per day — no account, no credit card. Add an API key when you are ready to scale.
No HTML Parsing
No tag soup, no regex, no DOM library to install. One HTTP GET returns a normalized JSON object.Standard Library Only
Net::HTTP and JSON ship with Ruby — the examples work with zero dependencies and nothing to compile.Every Source Merged
Open Graph, Twitter Cards, JSON-LD, oEmbed, microdata and plain HTML tags are merged into a single normalized response.
CDN-Hosted Assets
Image and logo come back as absolute URLs on a global CDN — hot-link them directly, no downloading or proxying.JavaScript Rendering
Tags injected by client-side JavaScript are captured too, with prerender=true and waitForSelector.Link Preview Ready
Title, description, image, logo and publisher are exactly the fields a link preview card needs — one call, one card.
Framework Friendly
Drop it into Rails, Sinatra, or a Sidekiq job as a controller action, route, or worker in a few lines.Zero Infrastructure
Managed Headless Chrome, autoscaled and load-balanced. No browser pool, no servers, no patching to maintain.Generous Free Tier
Start with 25 requests per day — no account, no credit card. Add an API key when you are ready to scale.
Try it live in the playground
Paste a URL and see the exact metadata response before you write a line of Ruby.
Ruby Metadata API FAQ
Everything Ruby developers ask before integrating the Microlink metadata API.
Which metadata sources are covered?
Open Graph, Twitter Cards, JSON-LD, oEmbed, microdata, RDFa and plain HTML tags — all merged and normalized into a single JSON response, so you never parse tag soup yourself.
Do I need to install a gem?
No. Net::HTTP and JSON are part of the Ruby standard library, so the examples work with zero dependencies. If you already use faraday or httparty, the same request translates directly.
What about tags rendered by JavaScript?
Pass
prerender=true and the page is rendered in a real browser before extraction, so tags injected by React, Vue or any client-side framework are captured too. Combine it with waitForSelector to wait for specific content.Are image and logo URLs ready to use?
Yes. They come back as absolute URLs hosted on a global CDN — resolve-relative-URL bugs included — so you can hot-link them directly in an
img tag or store them as-is.Is there a free tier or do I need an API key?
The free tier gives you 25 requests per day with no account, no credit card, and no API key. Just call the endpoint and start extracting.
When you need more throughput or caching control, add an
apiKey header and requests route to the Pro tier. See pricing for the limits.How fresh is the metadata?
Responses are cached at the edge with a sane default TTL, and you control freshness per request — see the API overview for cache parameters.
Start extracting in Ruby
Get 25 requests/day with zero commitment — no account and no credit card. Send your first request and ship metadata in minutes.
No login needed
25 reqs/day free
No credit card