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

# Create documents from sitemap

> Reads a sitemap and creates one URL document for each page it lists, applying the same `refreshRate`, metadata, and folder to every document. These documents do not re-read the sitemap afterward; create a managed sitemap for a site that should stay current.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json post /v1/stable/document/sitemap
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v1/stable/document/sitemap:
    post:
      tags:
        - Document
      summary: Create documents from sitemap
      description: Reads a sitemap and creates one URL document for each page it
        lists, applying the same `refreshRate`, metadata, and folder to every
        document. These documents do not re-read the sitemap afterward; create a
        managed sitemap for a site that should stay current.
      operationId: StableDocumentController_createSitemap
      parameters:
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
        - name: markdownConversion
          required: false
          in: query
          schema:
            description: When enabled, HTML is automatically converted to markdown to
              generate better chunks.
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
        - name: llmBasedChunks
          required: false
          in: query
          schema:
            description: When enabled, an LLM groups the content into logical sections by
              topic instead of splitting it on a fixed size. Best for complex
              documents covering varied topics.
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
        - name: llmGeneratedQ
          required: false
          in: query
          schema:
            description: When enabled, an LLM will be used to generate a question based on
              the document context and specific chunk, then prepend it to the
              chunk. This enhances retrieval by aligning chunks with potential
              user queries.
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
        - name: llmContentSummarization
          required: false
          in: query
          schema:
            description: When enabled, an LLM summarizes and rewrites the content, removing
              unnecessary information and focusing on important parts to
              optimize for retrieval. Limited to 15 rows per table upload.
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
        - name: llmPrependContext
          required: false
          in: query
          schema:
            description: "When enabled, an LLM generates a context summary based on the
              document and chunk context, and prepends it to each chunk. This
              improves retrieval by providing additional context to each chunk.
              Note: If both llmGeneratedQ and llmPrependContext are set to true,
              llmGeneratedQ takes precedence, and the context summarization will
              not be applied."
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
        - name: singleChunk
          required: false
          in: query
          schema:
            description: When enabled, the whole document is stored as a single chunk, so
              retrieval returns it in full. Documents above the embedding model
              input limit (about 30,000 characters) are split into chunks as
              usual. Takes precedence over llmBasedChunks.
            anyOf:
              - type: boolean
              - type: string
                enum:
                  - "true"
                  - "false"
                x-enumNames:
                  - "TRUE"
                  - "FALSE"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableDocumentCreateSitemapRequest"
      responses:
        "201":
          description: Returns the documents the import created or reused, a total count,
            and how many URLs were excluded by your patterns or dropped as
            unusable.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableDocumentSitemapCreateResponse"
          x-vf-doc:
            description: Returns the documents the import created or reused, a total count,
              and how many URLs were excluded by your patterns or dropped as
              unusable.
      security:
        - token: []
components:
  schemas:
    StableDocumentCreateSitemapRequest:
      type: object
      properties:
        sitemapURL:
          type: string
          format: uri
          description: The HTTPS URL of the sitemap to read. A bare site URL works too —
            when it does not end in `.xml`, `/sitemap.xml`, `/sitemap_index.xml`
            and `/sitemap/sitemap.xml` are probed in turn.
        exclude:
          description: "Patterns that drop a URL from the import when any one of them
            matches. Matching is case-insensitive and unanchored: a pattern with
            no `*` matches any URL containing it as a substring (`/blog/`),
            while `*` matches any run of characters (`*/tag/*`, `*.pdf`)."
          maxItems: 100
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 200
        metadata:
          default: []
          description: Metadata tags attached to the document, used to filter knowledge
            base retrieval at runtime.
          type: array
          items:
            type: object
            properties:
              key:
                type: string
                description: The name of the metadata field.
              values:
                type: array
                items:
                  type: string
                description: The values assigned to this metadata field.
            required:
              - key
              - values
        refreshRate:
          default: never
          description: How often the URL is automatically re-crawled to refresh the
            document content.
          type: string
          enum:
            - daily
            - weekly
            - monthly
            - never
          x-enumNames:
            - DAILY
            - WEEKLY
            - MONTHLY
            - NEVER
        folderID:
          description: The ID of the Knowledge Base folder to file every document the
            import creates or reuses under. Without it, new documents start at
            the top level and reused ones keep their folder.
          type: string
          minLength: 1
      required:
        - sitemapURL
      additionalProperties: false
    StableDocumentSitemapCreateResponse:
      type: object
      properties:
        documents:
          type: array
          items:
            $ref: "#/components/schemas/StableDocument"
        total:
          type: number
          description: How many documents the import produced, counting reused ones.
        excluded:
          type: number
          description: How many valid URLs the `exclude` patterns removed. Zero when no
            patterns were given.
        dropped:
          type: number
          description: How many entries the sitemap listed that are not usable URLs and
            were skipped.
      required:
        - documents
        - total
        - excluded
        - dropped
    StableDocument:
      type: object
      properties:
        id:
          type: string
        data:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/KBDocumentData"
        status:
          $ref: "#/components/schemas/KBDocumentStatus"
        smartChunking:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/SmartChunking"
        folderID:
          nullable: true
          description: The ID of the Knowledge Base folder the document is filed under, or
            null when it sits at the top level.
          type: string
          minLength: 1
      required:
        - id
        - data
        - status
        - smartChunking
        - folderID
    KBDocumentData:
      oneOf:
        - $ref: "#/components/schemas/KBDocumentUrlData"
        - $ref: "#/components/schemas/KBDocumentDocxData"
        - $ref: "#/components/schemas/KBDocumentPDFData"
        - $ref: "#/components/schemas/KBDocumentTextData"
        - $ref: "#/components/schemas/KBDocumentMarkdownData"
        - $ref: "#/components/schemas/KBDocumentCSVData"
        - $ref: "#/components/schemas/KBDocumentXLSXData"
        - $ref: "#/components/schemas/KBDocumentTableData"
        - $ref: "#/components/schemas/KBDocumentSitemapData"
    KBDocumentUrlData:
      type: object
      properties:
        type:
          type: string
          enum:
            - url
          x-enumNames:
            - URL
        name:
          type: string
        url:
          type: string
        title:
          type: string
        refreshRate:
          allOf:
            - $ref: "#/components/schemas/KnowledgeBaseDocumentRefreshRate"
        lastSuccessUpdate:
          type: string
        accessTokenID:
          type: number
        integrationExternalID:
          type: string
        source:
          allOf:
            - $ref: "#/components/schemas/KnowledgeBaseDocumentIntegrationType"
        sitemapDocumentID:
          nullable: true
          type: string
      required:
        - type
        - name
        - url
    KnowledgeBaseDocumentRefreshRate:
      type: string
      enum:
        - daily
        - weekly
        - monthly
        - never
      x-enumNames:
        - DAILY
        - WEEKLY
        - MONTHLY
        - NEVER
    KnowledgeBaseDocumentIntegrationType:
      type: string
      enum:
        - zendesk
        - shopify
      x-enumNames:
        - ZENDESK
        - SHOPIFY
    KBDocumentDocxData:
      type: object
      properties:
        type:
          type: string
          enum:
            - docx
          x-enumNames:
            - DOCX
        name:
          type: string
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentPDFData:
      type: object
      properties:
        type:
          type: string
          enum:
            - pdf
          x-enumNames:
            - PDF
        name:
          type: string
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentTextData:
      type: object
      properties:
        type:
          type: string
          enum:
            - text
          x-enumNames:
            - TEXT
        name:
          type: string
        canEdit:
          type: boolean
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentMarkdownData:
      type: object
      properties:
        type:
          type: string
          enum:
            - md
          x-enumNames:
            - MD
        name:
          type: string
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentCSVData:
      type: object
      properties:
        type:
          type: string
          enum:
            - csv
          x-enumNames:
            - CSV
        name:
          type: string
        rowsCount:
          type: number
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentXLSXData:
      type: object
      properties:
        type:
          type: string
          enum:
            - xlsx
          x-enumNames:
            - XLSX
        name:
          type: string
        rowsCount:
          type: number
        url:
          nullable: true
          type: string
      required:
        - type
        - name
    KBDocumentTableData:
      type: object
      properties:
        type:
          type: string
          enum:
            - table
          x-enumNames:
            - TABLE
        name:
          type: string
        rowsCount:
          type: number
        url:
          nullable: true
          type: string
      required:
        - type
        - name
        - rowsCount
    KBDocumentSitemapData:
      type: object
      properties:
        type:
          type: string
          enum:
            - sitemap
          x-enumNames:
            - SITEMAP
        name:
          type: string
        url:
          type: string
        refreshRate:
          allOf:
            - $ref: "#/components/schemas/KnowledgeBaseDocumentRefreshRate"
        lastSuccessUpdate:
          type: string
        patterns:
          allOf:
            - $ref: "#/components/schemas/KBDocumentSitemapPatterns"
        sync:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/KBDocumentSitemapSync"
      required:
        - type
        - name
        - url
    KBDocumentSitemapPatterns:
      type: object
      properties:
        include:
          type: array
          items:
            type: string
        exclude:
          type: array
          items:
            type: string
      required:
        - include
        - exclude
    KBDocumentSitemapSync:
      type: object
      properties:
        syncedAt:
          type: string
        startedAt:
          nullable: true
          type: string
          format: date-time
          pattern: ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        addedCount:
          type: number
        removedCount:
          type: number
        failure:
          nullable: true
          type: object
          properties:
            message:
              type: string
            at:
              type: string
            code:
              allOf:
                - $ref: "#/components/schemas/KBDocumentSitemapSyncFailureCode"
          required:
            - message
            - at
      required:
        - syncedAt
        - addedCount
        - removedCount
    KBDocumentSitemapSyncFailureCode:
      type: string
      enum:
        - documentLimit
      x-enumNames:
        - DOCUMENT_LIMIT
    KBDocumentStatus:
      type: object
      properties:
        type:
          $ref: "#/components/schemas/KnowledgeBaseDocumentStatus"
        data: {}
      required:
        - type
    KnowledgeBaseDocumentStatus:
      type: string
      enum:
        - ERROR
        - PENDING
        - SUCCESS
        - INITIALIZED
      x-enumNames:
        - ERROR
        - PENDING
        - SUCCESS
        - INITIALIZED
    SmartChunking:
      type: object
      properties:
        markdownConversion:
          description: When enabled, HTML is automatically converted to markdown to
            generate better chunks.
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
        llmBasedChunks:
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
        llmGeneratedQ:
          description: When enabled, an LLM will be used to generate a question based on
            the document context and specific chunk, then prepend it to the
            chunk. This enhances retrieval by aligning chunks with potential
            user queries.
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
        llmContentSummarization:
          description: When enabled, an LLM summarizes and rewrites the content, removing
            unnecessary information and focusing on important parts to optimize
            for retrieval. Limited to 15 rows per table upload.
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
        llmPrependContext:
          description: "When enabled, an LLM generates a context summary based on the
            document and chunk context, and prepends it to each chunk. This
            improves retrieval by providing additional context to each chunk.
            Note: If both llmGeneratedQ and llmPrependContext are set to true,
            llmGeneratedQ takes precedence, and the context summarization will
            not be applied."
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
        singleChunk:
          description: When enabled, the whole document is stored as a single chunk, so
            retrieval returns it in full. Documents above the embedding model
            input limit (about 30,000 characters) are split into chunks as
            usual. Takes precedence over llmBasedChunks.
          anyOf:
            - type: boolean
            - type: string
              enum:
                - "true"
                - "false"
              x-enumNames:
                - "TRUE"
                - "FALSE"
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
