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

# Create a Document

> Creates a new document



## OpenAPI

````yaml POST /docs
openapi: 3.0.1
info:
  title: Lex API
  description: An API to manage your documents
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://lex.page/api/v1
security:
  - bearerAuth: []
paths:
  /docs:
    post:
      description: Creates a new document
      requestBody:
        description: Document to create
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/NewDoc'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocCreated'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    NewDoc:
      type: object
      required:
        - title
      properties:
        title:
          type: string
          description: The title of the document.
        html:
          type: string
          description: The HTML content the document can be pre-filled with.
        path:
          type: string
          description: >-
            The location of the document in the API key user's folder structure.
            The path is equal to the URL in Lex of the folder, for example the
            home folder is `https://lex.page/~` and a subfolder might be
            `https://lex.page/~/my-folder`.
          default: '~'
    DocCreated:
      type: object
      properties:
        uuid:
          type: string
          description: The unique identifier of the created document.
    Error:
      type: object
      properties:
        error:
          type: string
          description: The error message
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````