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

# Insert document blocks

> Insert blocks into a document.

**Operation ID:** `http.documents.insert`

```http theme={null}
POST /v1/orgs/{org}/projects/{project}/files/document-insertions
```


## OpenAPI

````yaml openapi.json POST /v1/orgs/{org}/projects/{project}/files/document-insertions
openapi: 3.1.0
info:
  title: Penumbra API
  version: v1
  description: >-
    HTTP reference for Files, search, extraction, reviews, Graph, Shapes and
    sharing.
servers:
  - url: https://api.pnbr.io
    description: Penumbra API
security: []
paths:
  /v1/orgs/{org}/projects/{project}/files/document-insertions:
    post:
      tags:
        - Documents
      summary: Insert document blocks
      description: |-
        Insert blocks into a document.

        Product guidance: [Document](/concepts/document).
      operationId: http.documents.insert
      parameters:
        - name: org
          in: path
          required: true
          schema:
            type: string
        - name: project
          in: path
          required: true
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          required: true
          description: >-
            1–200 printable ASCII characters, no surrounding spaces; '.' and
            '..' are reserved. Reuse this key with the same request when
            retrying an uncertain outcome.
          schema:
            type: string
            minLength: 1
            maxLength: 200
            pattern: ^(?!\.{1,2}$)[!-~](?:[ -~]*[!-~])?$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/http_documents_insert_request'
      responses:
        2XX:
          description: Success.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/http_documents_insert_response'
      security:
        - bearerAuth: []
components:
  schemas:
    http_documents_insert_request:
      anyOf:
        - type: object
          properties:
            path:
              type: string
            expected_version_id:
              type: string
              pattern: >-
                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
            markdown:
              type: string
              minLength: 1
            after_block_id:
              anyOf:
                - type: string
                  minLength: 1
                  maxLength: 255
                - type: 'null'
          required:
            - path
            - expected_version_id
            - markdown
            - after_block_id
          additionalProperties: false
        - type: object
          properties:
            path:
              type: string
            expected_version_id:
              type: string
              pattern: >-
                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
            markdown:
              type: string
              minLength: 1
            at:
              type: string
              enum:
                - start
                - end
          required:
            - path
            - expected_version_id
            - markdown
            - at
          additionalProperties: false
        - type: object
          properties:
            path:
              type: string
            expected_version_id:
              type: string
              pattern: >-
                ^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$
            markdown:
              type: string
              minLength: 1
            after:
              type: string
              minLength: 1
              maxLength: 255
          required:
            - path
            - expected_version_id
            - markdown
            - after
          additionalProperties: false
    http_documents_insert_response:
      type: object
      properties:
        request_id:
          type: string
        outcome:
          type: string
          const: applied
        replayed:
          type: boolean
        data:
          type: object
          properties:
            mode:
              type: string
              const: managed_atomic
            outcome:
              type: string
              const: applied
            replayed:
              type: boolean
            request_id:
              type: string
            delta_id:
              type: string
            save_id:
              type: string
            file_operation_id:
              type: string
            file_id:
              type: string
            node_id:
              type: string
            canonical_path:
              type: string
            base_version_id:
              type: string
            committed_version_id:
              type: string
            semantic_status:
              type: string
              enum:
                - pending
                - not_requested
                - not_applicable
            lineage:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - created
                      - edited
                      - moved
                      - split
                      - merged
                      - duplicated
                      - deleted
                      - restored
                  from:
                    type: array
                    items:
                      type: string
                  to:
                    type: array
                    items:
                      type: string
                required:
                  - type
                  - from
                  - to
                additionalProperties: {}
            changed_blocks:
              type: array
              items:
                type: object
                properties:
                  block_id:
                    type: string
                  content_fingerprint:
                    anyOf:
                      - type: string
                      - type: 'null'
                required:
                  - block_id
                  - content_fingerprint
                additionalProperties: {}
            timings_ms:
              type: object
              propertyNames:
                type: string
              additionalProperties:
                type: number
          required:
            - mode
            - outcome
            - replayed
            - request_id
            - delta_id
            - save_id
            - file_operation_id
            - file_id
            - node_id
            - canonical_path
            - base_version_id
            - committed_version_id
            - semantic_status
            - lineage
            - changed_blocks
            - timings_ms
          additionalProperties: {}
      required:
        - request_id
        - outcome
        - replayed
        - data
      additionalProperties: {}
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.