> ## Documentation Index
> Fetch the complete documentation index at: https://buttercms.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Sitemap

> Generate a comprehensive XML sitemap for blog posts optimized for search engine discovery.

Generate a comprehensive XML sitemap for your blog posts, optimized for search engine discovery and indexing. This endpoint creates a standards-compliant sitemap that helps search engines efficiently crawl and index your blog content.

**SEO Optimization**: Produces an XML sitemap following the sitemaps.org protocol that includes post URLs, last modification dates, and change frequency information. This helps search engines understand your content structure and prioritize crawling of updated content.

**Filtering for Focused Sitemaps**: Apply category or tag filters to create specialized sitemaps for specific content sections. This is useful for large blogs where you want to submit targeted sitemaps to search engines or create separate indexing strategies for different content types.


## OpenAPI

````yaml /api/openapi/read_api.yaml get /feeds/sitemap/
openapi: 3.1.0
info:
  title: ButterCMS Read API
  version: 2.0.0
  description: >
    Read endpoints for the ButterCMS API — Pages, Collections, Blog Posts, Blog
    Metadata, and Feeds.
  contact:
    email: support@buttercms.com
  license:
    name: ButterCMS Terms of Service
    url: https://buttercms.com/terms/
servers:
  - url: https://api.buttercms.com/v2
    description: ButterCMS API v2
security:
  - readTokenAuthHeader: []
  - readTokenAuthQuery: []
tags:
  - name: Pages
    description: >
      Retrieve pages from your ButterCMS account.


      **Single Pages**: Use `*` as the page_type to get Single Pages (those
      without a Page Type) which represent unique pages on your site like your
      Homepage. Useful for creating your sitemap.xml.


      **Page Type Pages**: Use the actual page type slug to get pages of that
      specific type. Page Types allow you to create many pages with the same
      structure.


      **Note:** The fields of a page are defined by you, they are customizable.
      Sample responses below contain a basic set of fields for illustrative
      purposes.
  - name: Collections
    description: >
      Retrieve collection items from your ButterCMS account. Collections are
      flexible, user-defined content structures with completely customizable
      field schemas.


      See also: Architecture & Performance for guidance on `levels`, pagination,
      and performance best practices.
  - name: Blog posts
    description: >
      Retrieve blog posts from your ButterCMS account. List blog posts with
      pagination and filtering options, or retrieve individual posts by slug.
  - name: Blog metadata
    description: >
      Retrieve blog-related metadata including authors, categories, and tags.
      These endpoints provide access to the organizational structure of your
      blog content.
  - name: Feeds and utilities
    description: >
      Generate XML feeds for content syndication and SEO.


      - **RSS Feed**: Fully generated RSS 2.0 feed for your blog

      - **Atom Feed**: Standards-compliant Atom 1.0 feed

      - **Sitemap**: XML sitemap for search engine discovery


      All feeds can be filtered by category or tag and include only published
      content from your organization.
  - name: Images - Info
    description: >
      ButterCMS has an integration with
      [Filestack](https://www.filestack.com/docs/api/processing/) for image
      transformations. You can leverage their robust set of image transformation
      capabilities.


      After you upload an image, to create a thumbnail, here's an example:


      - **Original URL**: `https://cdn.buttercms.com/3ccPHhYHTNK2zQ14gCOy`

      - **Thumbnail URL**:
      `https://cdn.buttercms.com/resize=width:100,height:100/3ccPHhYHTNK2zQ14gCOy`


      For complete transformation options and parameters, see the [full
      Filestack documentation](https://www.filestack.com/docs/api/processing/).
paths:
  /feeds/sitemap/:
    get:
      tags:
        - Feeds and utilities
      summary: Sitemap
      description: >
        Generate a comprehensive XML sitemap for your blog posts, optimized for
        search engine discovery and indexing. This endpoint creates a
        standards-compliant sitemap that helps search engines efficiently crawl
        and index your blog content.


        **SEO Optimization**: Produces an XML sitemap following the sitemaps.org
        protocol that includes post URLs, last modification dates, and change
        frequency information. This helps search engines understand your content
        structure and prioritize crawling of updated content.


        **Filtering for Focused Sitemaps**: Apply category or tag filters to
        create specialized sitemaps for specific content sections. This is
        useful for large blogs where you want to submit targeted sitemaps to
        search engines or create separate indexing strategies for different
        content types.
      operationId: getSitemap
      parameters:
        - $ref: '#/components/parameters/auth_token'
        - name: category_slug
          in: query
          required: false
          schema:
            type: string
          description: >
            Filter the sitemap to include only posts from a specific category.


            Provide the URL-friendly slug of the category. When specified, only
            blog posts assigned to this category will be included in the
            sitemap.
          example: announcements
        - name: tag_slug
          in: query
          required: false
          schema:
            type: string
          description: >
            Filter the sitemap to include only posts with a specific tag.


            Provide the URL-friendly slug of the tag. When specified, only blog
            posts tagged with this tag will be included in the sitemap.
          example: seo-tips
        - name: locale
          in: query
          description: >
            Filter the sitemap to include only posts in the given locale (e.g.
            `en`, `es`). When omitted, defaults to your organization's default
            locale.


            Returns `400` if the value is not a locale configured on your
            organization.
          required: false
          schema:
            type: string
            maxLength: 10
          example: en
      responses:
        '200':
          description: XML sitemap generated successfully
          content:
            application/xml:
              schema:
                type: string
                format: xml
                description: Complete XML sitemap with blog post URLs
              examples:
                standard_sitemap:
                  summary: Standard XML sitemap with blog posts
                  value: >
                    <?xml version="1.0" encoding="UTF-8"?>

                    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
                    http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
                      <url>
                        <loc>https://example.buttercms.com/blog/api-development-best-practices</loc>
                        <lastmod>2024-01-15</lastmod>
                      </url>
                      <url>
                        <loc>https://example.buttercms.com/blog/restful-api-design-principles</loc>
                        <lastmod>2024-01-12</lastmod>
                      </url>
                      <url>
                        <loc>https://example.buttercms.com/blog/microservices-architecture-guide</loc>
                        <lastmod>2024-01-10</lastmod>
                      </url>
                      <url>
                        <loc>https://example.buttercms.com/blog/database-optimization-techniques</loc>
                        <lastmod>2024-01-08</lastmod>
                      </url>
                    </urlset>
                filtered_by_category:
                  summary: Sitemap filtered by category
                  value: >
                    <?xml version="1.0" encoding="UTF-8"?>

                    <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
                    http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">
                      <url>
                        <loc>https://example.buttercms.com/blog/new-api-features-released</loc>
                        <lastmod>2024-01-10</lastmod>
                      </url>
                      <url>
                        <loc>https://example.buttercms.com/blog/product-roadmap-update</loc>
                        <lastmod>2024-01-05</lastmod>
                      </url>
                    </urlset>
        '401':
          $ref: ea82457e-0d4e-4c13-ae37-bf08d34161e8
        '404':
          description: Not Found - Invalid feed type or no posts found
          content:
            application/xml:
              schema:
                type: string
                format: xml
                description: Error response when feed type is invalid
              examples:
                feed_not_found:
                  summary: Invalid feed type
                  value: |
                    <?xml version="1.0" encoding="UTF-8"?>
                    <error>Feed type not found</error>
      security:
        - readTokenAuthHeader: []
        - readTokenAuthQuery: []
components:
  parameters:
    auth_token:
      name: auth_token
      in: query
      required: false
      schema:
        type: string
      description: |
        Your ButterCMS read API token
      example: your_api_token
  securitySchemes:
    readTokenAuthHeader:
      type: apiKey
      in: header
      name: Authorization
      description: |
        Set the `Authorization` header to `Token your_read_api_token`.

        Example: `Authorization: Token abc123def456`

        Note: The header value includes the `Token` prefix.

        You can access your API token from your settings page.
    readTokenAuthQuery:
      type: apiKey
      in: query
      name: auth_token
      description: >
        Pass your API token via the `auth_token` parameter on every request:
        `?auth_token=your_read_api_token`.


        You can access your API token from your settings page.


        Requests made with a missing or invalid token will get a 401
        Unauthorized response. All requests must be made over HTTPS.

````