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

# Create document from Extended Markdown

> Create a persistent document from Extended Markdown. This is the recommended endpoint for AI agents and automation: send human-readable markdown plus compact JSON metadata (`document`, `variables`, `stylePresetId`, etc.). Autype stores the result as validated document JSON internally, so the full JSON API remains available for advanced clients.



## OpenAPI

````yaml /api-reference/openapi.json post /api/v1/dev/documents/markdown
openapi: 3.0.0
info:
  title: Autype Developer API
  description: >-
    Autype Developer API for programmatic document generation.


    ## Authentication

    Use an API key in `X-API-Key`. Autype's trusted MCP service may instead use
    a short-lived, Developer-API-audience OAuth token obtained through
    server-side token exchange. Raw MCP resource tokens, login JWTs, and
    third-party tokens are not accepted.


    ## Rate Limiting

    API requests are rate-limited to 100 requests per minute per API key.


    ## Automation Credits

    Developer API rendering and bulk operations consume automation credits from
    your organization. AI documents, assistant tasks, translations, and AI
    images use separate plan allowances.
  version: '1.0'
  contact: {}
servers:
  - url: https://api.autype.com
    description: Production
security: []
tags:
  - name: Temporary Images
    description: Upload and manage temporary images for document rendering
  - name: Render
    description: Render documents to PDF, DOCX, ODT, or page images
  - name: Bulk Render
    description: Bulk document generation with variable substitution
  - name: Documents
    description: Document variable inspection
  - name: Projects
    description: List organization projects
paths:
  /api/v1/dev/documents/markdown:
    post:
      tags:
        - developer-api
      summary: Create document from Extended Markdown
      description: >-
        Create a persistent document from Extended Markdown. This is the
        recommended endpoint for AI agents and automation: send human-readable
        markdown plus compact JSON metadata (`document`, `variables`,
        `stylePresetId`, etc.). Autype stores the result as validated document
        JSON internally, so the full JSON API remains available for advanced
        clients.
      operationId: DocumentsController_createDocumentFromMarkdown_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeveloperApiCreateMarkdownDocumentDto'
      responses:
        '201':
          description: Document created from Markdown
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDocumentResponseDto'
        '400':
          description: Invalid markdown or document schema
        '401':
          description: Invalid or missing API key
        '403':
          description: Project does not belong to organization or document limit reached
        '404':
          description: Project not found
      security:
        - mcp-oauth: []
        - api-key: []
components:
  schemas:
    DeveloperApiCreateMarkdownDocumentDto:
      type: object
      properties:
        projectId:
          type: string
          description: Project ID to create the document in
        title:
          type: string
          example: My Markdown Document
          description: Document title
        description:
          type: string
          example: Document description
        content:
          type: string
          description: >-
            Extended Markdown content. This is the preferred authoring format
            for API and MCP agents; Autype stores it as validated document JSON
            internally.
          example: |
            # Report

            Hello {{companyName}}.

            | Name | Amount |
            | --- | ---: |
            | Item | 42 |
        document:
          description: Document settings. Must include `type`.
          example:
            type: pdf
            size: A4
            orientation: portrait
          allOf:
            - $ref: '#/components/schemas/DeveloperApiMarkdownDocumentSettingsDto'
        stylePresetId:
          type: string
          nullable: true
          description: >-
            Optional workspace style UUID or immutable built-in system:<id>.
            Inline defaults override the referenced preset during rendering.
        variables:
          type: object
          description: Variables for template substitution
        abbreviations:
          type: object
          description: Abbreviation map
        defaults:
          type: object
          description: >-
            Inline defaults. Prefer `stylePresetId` for reusable workspace or
            built-in styles.
        citations:
          description: Citations array in CSL-JSON format
          type: array
          items:
            type: string
        style:
          type: object
          description: Additional style metadata
      required:
        - projectId
        - title
        - content
        - document
    CreateDocumentResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Document ID
        title:
          type: string
          description: Document title
        projectId:
          type: string
          description: Project ID the document belongs to
        stylePresetId:
          type: string
          nullable: true
          description: Referenced workspace or built-in system style preset, if any
        description:
          type: object
          description: Document description
          nullable: true
        createdAt:
          format: date-time
          type: string
        updatedAt:
          format: date-time
          type: string
      required:
        - id
        - title
        - projectId
        - createdAt
        - updatedAt
    DeveloperApiMarkdownDocumentSettingsDto:
      type: object
      properties:
        type:
          type: string
          description: Output format
          enum:
            - pdf
            - docx
            - odt
          example: pdf
        size:
          type: string
          description: Page size
          enum:
            - A4
            - A3
            - A5
            - Letter
            - Legal
          example: A4
        orientation:
          type: string
          description: Page orientation
          enum:
            - portrait
            - landscape
          example: portrait
        title:
          type: string
          description: Document title metadata
        author:
          type: string
          description: Document author metadata
        filename:
          type: string
          description: Output filename without extension
        marginTop:
          type: number
          description: Top margin in cm
        marginRight:
          type: number
          description: Right margin in cm
        marginBottom:
          type: number
          description: Bottom margin in cm
        marginLeft:
          type: number
          description: Left margin in cm
      required:
        - type
  securitySchemes:
    mcp-oauth:
      scheme: bearer
      bearerFormat: Autype Developer API OAuth token
      type: http
      description: >-
        Short-lived, Developer-API-audience token obtained by the trusted MCP
        service through token exchange (mcp_at_...). Raw MCP resource tokens are
        rejected.
    api-key:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key (starts with ak_...)

````