$ cli-blog docs

Sitemap

Generate sitemap XML for published, indexable blog posts.

The sitemap endpoint generates XML from published posts that allow indexing. Proxy the response to /sitemap.xml on your public blog domain so crawlers see first-party canonical URLs.

Choose a surface

Public and private keys can generate a sitemap when they have post read permission. Compare all Cli Blog tools.

ActionHTTP APINode SDKCLIDescription
GenerateGET /v1/sitemapblog.sitemap.get()cli-blog sitemap getReturn sitemap XML for visible post URLs

Use the REST API

Call the resource from any technology that can send HTTP requests. Use a public key for allowed delivery reads and a private key for content changes.

GET https://api.cli-blog.com/v1/sitemap?locale=en-US
Choose an API key

Use the CLI

Use the CLI for local work, continuous integration, and JSON automation. Configure a narrowly scoped key before running content-changing commands.

cli-blog sitemap get --locale en-US
Read the CLI guide

Use the Node SDK

Use the Node SDK in Node.js 20+ servers, scripts, continuous integration, and trusted agent environments. Its methods map to the same resource actions.

await blog.sitemap.get({ locale: "en-US" })
Read the Node SDK guide

Use the agent skill

Give the agent the Cli Blog skill and a result-focused instruction. The skill helps it choose the API, CLI, or SDK and keeps publishing behind an approval gate.

Retrieve the sitemap and confirm that the published post URL is present and indexable.
Install the agent skill

Generate sitemap XML

Call the API with the public key used by your delivery application:

curl --get "https://api.cli-blog.com/v1/sitemap" \
  --header "x-api-key: $CLI_BLOG_PUBLIC_API_KEY" \
  --data-urlencode "limit=50000"

Omit locale to include every published localized URL. Set a supported BCP 47 tag when your site serves a locale-specific sitemap. The endpoint accepts up to 50,000 URLs.

A multilingual response includes alternate links for posts in the same translation group:

<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
  xmlns:xhtml="http://www.w3.org/1999/xhtml">
  <url>
    <loc>https://demo.cli-blog.example/blog/how-we-ship-release-notes</loc>
    <lastmod>2026-07-11T17:30:00.000Z</lastmod>
    <xhtml:link rel="alternate" hreflang="es-MX"
      href="https://demo.cli-blog.example/es/blog/como-publicamos-notas" />
  </url>
</urlset>

The Node SDK returns the XML string:

import { CliBlog } from "@cli-blog/node";

const blog = new CliBlog({
  apiKey: process.env.CLI_BLOG_PUBLIC_API_KEY!,
  apiUrl: "https://api.cli-blog.com",
});

const sitemapXml = await blog.sitemap.get({ limit: 50_000 });

The CLI writes the same response to standard output:

cli-blog sitemap get --limit 50000 > public/sitemap.xml

Serve first-party URLs

Configure the publication's canonical site URL in the dashboard. Cli Blog uses each post's canonical_url when present, then resolves the post slug against the publication URL.

Serve the generated XML from the domain where readers access the blog. Refresh it after publishing, unpublishing, deleting, translating, or changing a canonical URL.

Sitemap fields

XML fieldDescription
<loc>Absolute canonical post URL
<lastmod>ISO timestamp for the latest post update
<xhtml:link>Alternate localized URL from the same translation group

The sitemap excludes drafts, scheduled posts that are not due, deleted posts, and posts with robots_index: false.

Common errors

Status or symptomCauseResolution
400Requested locale is not enabledSelect a locale returned by Locales
401Missing or invalid API keySend the organization key in x-api-key
403Key lacks post read permissionUse a public or private key with post read access
Empty <urlset>No eligible post has a resolvable absolute URLPublish indexable posts and configure the canonical site URL
Missing postPost is unpublished, not due, deleted, or non-indexableCheck its status, publish time, deletion state, and robots setting
Wrong URLPublication URL or post canonical override is incorrectUpdate publication settings or canonical_url

Complete API operation

The operation reference lists the locale and limit parameters, XML response schema, authentication rules, and errors. Use Try it to open the request runner.

Key type: Public or private key

Generate a sitemap XML document for published, indexable posts. Customer sites should proxy this endpoint onto /sitemap.xml on their own domain so crawlers receive first-party URLs.

Authorization

ApiKeyAuth
x-api-key<token>

Organization API key. Each key selects exactly one organization; do not send an organization ID separately. Public keys use the cli_blog_pk_ prefix and are intended for published-content delivery reads. Private keys use the cli_blog_sk_ prefix, belong only in trusted environments, and are required for write, publish, delete, and editorial-state workflows when their scopes allow it.

In: header

Query Parameters

locale?string

Optional BCP 47 locale filter. Omit it to include every published, indexable localized post URL.

limit?|

Maximum URLs to include. Sitemaps are capped at 50,000 URLs by the sitemap protocol.

Response Body

text/plain

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/sitemap"
"string"
{  "error": {    "code": "invalid_request",    "message": "string",    "param": "string"  }}
{  "error": {    "code": "invalid_request",    "message": "string",    "param": "string"  }}
{  "error": {    "code": "invalid_request",    "message": "string",    "param": "string"  }}
{  "error": {    "code": "invalid_request",    "message": "string",    "param": "string"  }}

On this page