> ## 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

> Create a new document in a project. The document is attributed to the API key creator. Optionally provide initial document content following the Autype document JSON schema. If no content is provided, a default document with the title as heading is created.

**Image handling:** If the document content contains `/temp-image/{id}` references (from temporary image uploads), they are automatically converted to permanent `/image/{assetId}` assets attached to the new document. This allows you to upload images first via `POST /images/upload`, then reference them in the document content — the conversion happens transparently on creation.



## OpenAPI

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


    ## Authentication

    All endpoints require an API key. Include it in the `X-API-Key` header or as
    a Bearer token.


    ## Rate Limiting

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


    ## Token Billing

    Rendering operations consume tokens from your organization's balance.
  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, or ODT
  - 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:
    post:
      tags:
        - developer-api
      summary: Create document
      description: >-
        Create a new document in a project. The document is attributed to the
        API key creator. Optionally provide initial document content following
        the Autype document JSON schema. If no content is provided, a default
        document with the title as heading is created.


        **Image handling:** If the document content contains `/temp-image/{id}`
        references (from temporary image uploads), they are automatically
        converted to permanent `/image/{assetId}` assets attached to the new
        document. This allows you to upload images first via `POST
        /images/upload`, then reference them in the document content — the
        conversion happens transparently on creation.
      operationId: DocumentsController_createDocument_v1
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentDto'
      responses:
        '201':
          description: Document created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDocumentResponseDto'
        '400':
          description: Invalid 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:
        - api-key: []
components:
  schemas:
    CreateDocumentDto:
      type: object
      properties:
        projectId:
          type: string
          description: Project ID to create the document in
        title:
          type: string
          example: My Document
          description: Document title
        description:
          type: string
          example: Document description
        content:
          type: object
          description: >-
            Initial document content following the Autype document JSON schema.
            If omitted, a default document is created.
      required:
        - projectId
        - title
    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
        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
  securitySchemes:
    api-key:
      type: apiKey
      in: header
      name: X-API-Key
      description: API Key (starts with ak_...)

````