blogsforseo

Content API

The Content API is how your website reads its published posts. It's plain HTTPS and JSON, so it works with any language or framework.

Basics

  • Base URL: https://blogsforseo.com/api/v1
  • Authentication: every content endpoint needs your site's secret API key as Authorization: Bearer <key>. Find it, and rotate it, on your dashboard's "Connect your website" page. Keep it in an environment variable on your server.
  • One key, one website: the key alone says which website's posts you get; there's no site ID in the address.
  • Nothing public: every endpoint needs the key, the sitemap included. Your blog's sitemap lives on your own domain at /blog-sitemap.xml; your server serves it from /sitemap?format=xml.
  • Server to server: content endpoints don't allow browser (CORS) requests, so the key never reaches a visitor. Render your blog on your server; that's also what lets crawlers read it.
  • Methods: GET only.
  • Caching: content responses are Cache-Control: private, max-age=60, never kept in a shared cache; cache them on your server.
  • Indexing: responses carry X-Robots-Tag: noindex, so the API itself never shows up in search. Your pages do.

Endpoints

Endpoint Returns
GET /site Site details: { name, url, blogUrlPattern }
GET /posts?page=1&pageSize=12 { posts: PostSummary[], page, totalPages, total }, newest first. pageSize 1–50
GET /posts/{slug} One Post, or 404
GET /sitemap [{ url, lastmod }] for every live post. ?format=xml gives a finished sitemap to serve at /blog-sitemap.xml on your domain
GET /llms.txt Your posts as a plain-text llms.txt index
GET /html/posts?page=1 { body, page, totalPages, total }: a page of the blog index as finished HTML
GET /html/posts/{slug} { head, body, meta }: one post as finished HTML (see below), or 404
curl -H "Authorization: Bearer $BLOGSFORSEO_API_KEY" https://blogsforseo.com/api/v1/posts
curl -H "Authorization: Bearer $BLOGSFORSEO_API_KEY" https://blogsforseo.com/api/v1/posts/what-is-llms-txt

The same requests in JavaScript, Python, PHP and Ruby are in the framework guides.

HTML endpoints

The /html endpoints power the simple way. They return unstyled HTML with bfs- class names:

  • head: meta tags for <head>: title, description, canonical and Open Graph.
  • body: the whole article, ending with its application/ld+json structured data.
  • meta: the same values as head, as data, for frameworks that build <head> from values (Next.js, Nuxt):
Field Type
title, description string
canonical string or null
openGraph { type: "article", title, description, url (string or null), image ({ url, width, height, alt } or null), publishedTime, modifiedTime }
twitter { card ("summary_large_image" or "summary"), title, description, image (string or null) }

Every value is escaped, and links are http(s) only.

PostSummary

Field Type Notes
slug string Lowercase words joined by hyphens
title string
metaDescription string
shortAnswer string A direct answer of 320 characters or fewer, written to be quoted
canonicalUrl string or null Built from your post URL pattern; null until you set the pattern
heroImage { url, alt, width, height } or null
tags string[]
publishedAt ISO 8601
updatedAt ISO 8601 Changes only when what readers see changes
readingMinutes number

Post

Everything in PostSummary, plus:

Field Type Notes
metaTitle string For <title>
keyTakeaways string[]
bodyHtml string Sanitised HTML, with heading ids and up to 5 links to your other posts. It never includes the post's FAQ section; show faqs instead
bodyMarkdown string The same body, as Markdown, also without the FAQ section
toc { id, text, level }[] level is 2 or 3; link to #id
faqs { question, answer }[] The post's FAQs; the only place they appear
sources { label, url, asOf }[] Where each fact came from, and when it was true
related { slug, title, metaDescription, canonicalUrl }[] Up to 3
author { name, type, jobTitle?, bio?, avatarUrl?, url? } type is Person or Organization
jsonLd object A ready schema.org @graph: BlogPosting, FAQPage and BreadcrumbList
version number Goes up on every published change

When you put jsonLd in a <script type="application/ld+json">, replace every < with \u003c.

Errors

Every error looks like this:

{ "error": { "code": "not_found", "message": "No published post with that slug." } }
Status Code When
400 bad_request A bad query value, such as pageSize=500
401 unauthorized Missing or wrong API key, or the site has no key yet (open the Connect page once)
404 not_found Unknown post, or 30 days after the site's subscription ended
429 rate_limited Over 600 requests a minute for one site from one caller; wait for Retry-After
500 internal Our fault; retry shortly

Changelog

  • 2026-10-26: bodyHtml and bodyMarkdown no longer repeat the FAQ section. FAQs are only in faqs. If you showed FAQs from the body, show faqs instead.