---
search:
  tags:
    - projects
    - POST
seo:
  description: >-
    What are project documents? Project documents are structured… Reference for
    the POST /projects/{projectId}/documents endpoint in the Leadtime Public API
    API.
sidebar:
  badge: POST
  label: Create new document
title: Create new document
type: openapi-operation
---
**What are project documents?**
Project documents are structured documents automatically generated from project data. They can be estimates, specifications, or custom documents (contracts, NDAs, etc.) that pull in project, organization, and company data through variables.

**Document creation workflow:**
1. **Select project version**: Documents must be linked to a saved project version (snapshot) for traceability. Use GET /projects/:id/versions to get available versions.
2. **Choose document type**: Estimate (commercial proposal), Specification (requirements), or CustomEditor (free-form document)
3. **Set basic properties**: Title, description, status (usually starts as Draft)
4. **Assign contact person**: Select from available contacts (use GET /projects/:id/documents/contact-persons)
5. **Configure layout**: Enable table of contents, title page, indication mode (marks as non-binding estimate)
6. **Set heading style**: Controls automatic numbering of headings (important for legal documents)
7. **Add custom variables**: If using a template with custom variables, provide values for each variable

**Content format:**
- Description and customEditorContent accept HTML or Markdown
- Content is automatically converted to internal IDoc format for storage
- When retrieved, content is converted back to HTML for display
- Supports rich formatting: headings, lists, tables, links, etc.

**Custom variables:**
If your document template includes custom variables, provide them in the customVariables array:
- Each variable needs: name, type, and value (matching the type)
- Types: Text, LongText, Number, Boolean, Date, Select, MultiSelect
- For Select/MultiSelect: provide options array and select value(s)
- Required variables must have values provided

**Validation:**
- Project version must exist and belong to the project
- Contact person must be available for this project type
- All required custom variables must have values
- Document type and status must be valid enum values

**What is returned:**
The created document with all fields, including converted HTML content and custom variable values.

**Use cases:**
- Create new estimate for client approval
- Generate specification document from project requirements
- Create custom contract or agreement document
- Automate document generation from project data

<Operation source="api-reference" id="projectdocumentscontroller-createdocument" />
