Skip to main content

Meta Tags Extractor API

Written by Kadri - RichAPI Support Team

POST /web_meta_tags • Credits: 1 credit per call

Meta Tags Extractor returns the Open Graph tags, the Twitter Card tags and the SEO meta tags of one public web page. The response holds the page title, the description, the canonical URL, the favicon and the hreflang links. Each call costs 1 credit.

What does Meta Tags Extractor do?

A link preview card, an SEO audit and a content index all need the same data: the meta tags in the page head. Meta Tags Extractor returns that data as structured JSON. The endpoint fetches the page over HTTP and parses the <head> element. It sorts every tag into four groups: Open Graph, Twitter Card, SEO and everything else. Meta Tags Extractor runs no browser. Meta Tags Extractor is one of the specialized endpoints in the RichAPI web scraper family.

Which endpoint does Meta Tags Extractor use?

  • Method:POST

  • URL:https://api.richapi.ai/api/v1/web_meta_tags

  • Authentication:x-api-key header

  • Response: Synchronous JSON

  • Credits: 1 credit per call

How to send a Meta Tags Extractor request

  1. Copy your API key from the RichAPI dashboard.

  2. Set the url parameter to the full page URL.

  3. Send a POST request to https://api.richapi.ai/api/v1/web_meta_tags.

  4. Send the API key in the x-api-key header.

  5. Read the data.og, data.twitter and data.seo objects from the response.

CAUTION: Each Meta Tags Extractor call costs 1 credit. A cached result also costs 1 credit.

cURL

curl -X POST https://api.richapi.ai/api/v1/web_meta_tags   
-H "x-api-key: YOUR_API_KEY"
-H "Content-Type: application/json"
-d '{
"url": "https://stripe.com",
"cache": true
}'

Python

import requests

response = requests.post(
"https://api.richapi.ai/api/v1/web_meta_tags",
headers={"x-api-key": "YOUR_API_KEY"},
json={
"url": "https://stripe.com",
"cache": True,
},
timeout=60,
)
response.raise_for_status()
print(response.json())

Node.js

const response = await fetch("https://api.richapi.ai/api/v1/web_meta_tags", {
method: "POST",
headers: {
"x-api-key": "YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
url: "https://stripe.com",
cache: true,
}),
});

const data = await response.json();
console.log(data);

Which parameters does Meta Tags Extractor accept?

Parameter

Type

Required

Default

Description

url

string

Yes

None

The full HTTP or HTTPS URL of the page to read. The maximum length is 2048 characters.

cache

boolean

No

false

Set to true to accept a cached result for the same URL.

cache_bust

boolean

No

false

Set to true to force a fresh fetch and to ignore the cache.

What does Meta Tags Extractor return?

The block below is an example response for https://stripe.com. The values are illustrative.

{
"data": {
"og": {
"title": "Stripe | Financial Infrastructure to Grow Your Revenue",
"description": "Stripe powers online and in-person payment processing for businesses of every size.",
"image": "https://images.stripeassets.com/fzn2n1nzq965/og-home.png",
"url": "https://stripe.com/",
"type": "website",
"site_name": "Stripe",
"locale": "en_US",
"extra": {
"video": "https://stripe.com/media/home-hero.mp4"
}
},
"twitter": {
"card": "summary_large_image",
"site": "@stripe",
"creator": "@stripe",
"title": "Stripe | Financial Infrastructure to Grow Your Revenue",
"description": "Stripe powers online and in-person payment processing for businesses of every size.",
"image": "https://images.stripeassets.com/fzn2n1nzq965/twitter-card.png",
"extra": {
"label1": "Read time"
}
},
"seo": {
"title": "Stripe | Financial Infrastructure to Grow Your Revenue",
"description": "Stripe powers online and in-person payment processing for businesses of every size.",
"canonical": "https://stripe.com/",
"robots": "index, follow",
"viewport": "width=device-width, initial-scale=1",
"charset": "utf-8",
"author": "Stripe",
"keywords": "payments, payment processing, online payments",
"language": "en"
},
"favicon": "https://stripe.com/favicon.ico",
"hreflang": [
{ "lang": "en-US", "url": "https://stripe.com/" },
{ "lang": "fr-FR", "url": "https://stripe.com/fr-fr" }
],
"other": {
"theme-color": "#635bff",
"generator": "Next.js"
}
},
"meta": {
"cache_hit": false,
"execution_time_ms": 412,
"quality_warning": null
}
}

Which fields does the Meta Tags Extractor response hold?

Field

Type

Description

data.og

object

The Open Graph tags of the page.

data.twitter

object

The Twitter Card tags of the page.

data.seo

object

The standard SEO meta tags of the page.

data.favicon

string

The favicon URL of the page. If the page declares no icon, the value is null.

data.hreflang

array of objects

The alternate language links. Each entry holds a lang string and a url string.

data.other

object

Every remaining meta tag, as a name to content map.

meta.cache_hit

boolean

The cache status of the result. The value true marks a cached result.

meta.execution_time_ms

integer

The time that the call took, in milliseconds.

meta.quality_warning

string

A warning about the extraction, or null.

Which Open Graph fields does Meta Tags Extractor return?

The data.og object holds the tags whose property starts with og:. Every named field is a string or null.

Field

Type

Source tag

title

string

og:title

description

string

og:description

image

string

og:image

url

string

og:url

type

string

og:type

site_name

string

og:site_name

locale

string

og:locale

extra

object

Every other og: tag, as a name to content map.

Which Twitter Card fields does Meta Tags Extractor return?

The data.twitter object holds the tags whose property starts with twitter:. Every named field is a string or null.

Field

Type

Source tag

card

string

twitter:card

site

string

twitter:site

creator

string

twitter:creator

title

string

twitter:title

description

string

twitter:description

image

string

twitter:image

extra

object

Every other twitter: tag, as a name to content map.

Which SEO fields does Meta Tags Extractor return?

The data.seo object holds the standard head tags of the page. Every field is a string or null.

Field

Type

Source

title

string

The <title> element.

description

string

The description meta tag.

canonical

string

The link element with rel="canonical".

robots

string

The robots meta tag.

viewport

string

The viewport meta tag.

charset

string

The charset attribute of the meta element.

author

string

The author meta tag.

keywords

string

The keywords meta tag.

language

string

The lang attribute of the html element.

How do you build a link preview with Meta Tags Extractor?

A link preview card needs a title, a description and an image. Meta Tags Extractor returns all three in one call.

  1. Send the page URL as the url parameter.

  2. Read data.og.title. If the value is null, fall back to data.seo.title.

  3. Read data.og.description. If the value is null, fall back to data.seo.description.

  4. Read data.og.image. If the value is null, fall back to data.twitter.image.

  5. Read data.favicon for the site icon.

This order matches the order that Slack, LinkedIn, X and iMessage use.

How do you audit SEO tags with Meta Tags Extractor?

An SEO audit checks that each page declares the correct head tags. Meta Tags Extractor returns those tags for one URL per call.

  1. Send one request for each page URL that you want to audit.

  2. Check that data.seo.title is not null and is shorter than 60 characters.

  3. Check that data.seo.description is not null and is shorter than 160 characters.

  4. Check that data.seo.canonical matches the URL that you sent.

  5. Check that data.seo.robots does not hold noindex.

  6. Check that data.og.image and data.twitter.card are not null.

What happens on a page with no meta tags?

Meta Tags Extractor returns status 200 for a page with no meta tags. The og, twitter and seo objects are present, but every field inside them is null. The favicon field is null, the hreflang array is empty and the other object is empty. The example below shows that response.

{
"data": {
"og": {
"title": null,
"description": null,
"image": null,
"url": null,
"type": null,
"site_name": null,
"locale": null,
"extra": {}
},
"twitter": {
"card": null,
"site": null,
"creator": null,
"title": null,
"description": null,
"image": null,
"extra": {}
},
"seo": {
"title": null,
"description": null,
"canonical": null,
"robots": null,
"viewport": null,
"charset": null,
"author": null,
"keywords": null,
"language": null
},
"favicon": null,
"hreflang": [],
"other": {}
},
"meta": {
"cache_hit": false,
"execution_time_ms": 188,
"quality_warning": null
}
}

CAUTION: An empty result still costs 1 credit. RichAPI charges the credit on every 200 response. Make sure that data.seo.title or data.og.title is not null before you store the result.

How long does Meta Tags Extractor cache a page?

Meta Tags Extractor caches each page for 6 hours. If you set cache to true, the API returns a cached result from inside that window. The API then sets meta.cache_hit to true. To force a fresh fetch, set cache_bust to true. A cached call and a fresh call both cost 1 credit.

When do you use Meta Tags Extractor instead of Web Scraper?

When you want the meta tags of a page, use Meta Tags Extractor. When you want the page content itself, use Web Scraper. Web Scraper returns the full HTML and markdown, and it runs the page JavaScript. Meta Tags Extractor returns parsed head tags only, and it runs no browser.

Endpoint

What the endpoint returns

JavaScript

Credits

web_meta_tags

The Open Graph, Twitter Card and SEO tags of one page.

No

1 per call

web_scrape

The full page as HTML, markdown and title.

Yes

1 per call

web_json_ld

The JSON-LD structured data blocks of one page.

No

1 per call

website_intelligence

One combined report for a domain, including the meta tags.

Mixed

5 per call

If you need five or more signals for one domain, send one website_intelligence call instead. That call covers the meta tags, the tech stack, the pixels and the social links.

How much does Meta Tags Extractor cost?

Meta Tags Extractor costs 1 credit per call. 1 credit costs $0.02 on the 1,000 and 5,000 credit packs. Larger packs cost less per credit. The credit count does not change with the page size or with the number of tags that the page declares.

Calls

Credits

Cost

1

1

$0.02

100

100

$2.00

1,000

1,000

$20.00

10,000

10,000

$200.00

Which errors can Meta Tags Extractor return?

Status

Meaning

What to do

400

The request body failed validation.

Correct the parameter that the message names. Send a full HTTP or HTTPS URL.

401

The API key is missing, wrong or revoked.

Send a valid key in the x-api-key header.

402

The organization has no credits left, or the team reached its monthly spend limit.

Buy credits in the RichAPI dashboard.

403

Endpoint not available on your plan: this API key has no access to this endpoint.

Call GET /api/v1/my-endpoints to list the endpoints this key can use. For access, write to [email protected].

404

The endpoint name is wrong.

Send the request to /web_meta_tags.

405

The request used a method other than POST.

Send the request again with the POST method.

422

The service could not process a value, for example a URL that does not start with http:// or https://, a URL longer than 2048 characters, or a private network address.

Send a full public HTTP or HTTPS URL.

429

Too many requests.

Read the Retry-After header. Wait that many seconds, then send the request again.

500

The API failed.

Send the request again. If the failure repeats, write to [email protected].

502

The target page returned a 4xx or a 5xx status.

Check that the URL opens in a browser. Then send the request again.

504

The target page took too long.

Send the request again.

RichAPI charges no credit for a 400, 401, 402, 403, 404, 405, 422, 429, 500, 502 or 504 response.

Frequently asked questions

Does Meta Tags Extractor run JavaScript?

No. Meta Tags Extractor fetches the raw HTML over HTTP and parses the <head> element. If a page writes its meta tags with JavaScript, use Web Scraper instead.

Does Meta Tags Extractor return the Open Graph image?

Yes. The data.og.image field holds the og:image URL. The data.twitter.image field holds the twitter:image URL, which many sites set to a different file.

What does Meta Tags Extractor return for a page with no meta tags?

Meta Tags Extractor returns status 200 with every tag field set to null. The hreflang array and the other object are empty, and the call still costs 1 credit.

Can Meta Tags Extractor read a page behind a login?

No. Meta Tags Extractor accepts no login credentials and no cookies. It reads only a page that a public visitor can open.

Can Meta Tags Extractor reach an internal or private address?

No. Meta Tags Extractor rejects a URL that points to a private network address or to an internal host. Send a public HTTP or HTTPS URL.

How do I get a meta tag that is not in the og, twitter or seo group?

Read the data.other object. It holds every remaining meta tag as a name to content map, for example theme-color and generator.

How many URLs can one Meta Tags Extractor call cover?

One. Each call reads one URL and costs 1 credit. To cover a whole website, send a Sitemap Extractor request first. Then send one Meta Tags Extractor call per URL.

Related articles

Did this answer your question?