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

# Generate a PDF document from Markdown input

> This endpoint allows you to generate a PDF document from Markdown input. It requires payment before processing the request. The request body should include the Markdown content and metadata.



## OpenAPI

````yaml post /markdown
openapi: 3.0.1
info:
  title: markdown2pdf
  version: '2025-06-10T15:55:31Z'
servers:
  - url: https://api.markdown2pdf.ai
security: []
paths:
  /markdown:
    post:
      summary: Generate a PDF document from Markdown input
      description: >-
        This endpoint allows you to generate a PDF document from Markdown input.
        It requires payment before processing the request. The request body
        should include the Markdown content and metadata.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/L402DocumentRequest'
        required: true
      responses:
        '200':
          description: >-
            Once paid, a 200 OK response will be returned with the job status,
            and details on how to poll for updates.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobStatus'
        '402':
          description: >-
            Payment required to generate the document. The response will include
            a request for payment, with details on how to fetch the invoice.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/JobPaymentRequiredStatus'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    L402DocumentRequest:
      title: L402DocumentRequest
      required:
        - data
        - options
      type: object
      properties:
        data:
          $ref: '#/components/schemas/GeneralDocumentRequestData'
        options:
          $ref: '#/components/schemas/L402DocumentRequestOptions'
    JobStatus:
      title: JobStatus
      required:
        - id
        - status
      type: object
      properties:
        id:
          title: Id
          type: string
          format: uuid
        description:
          title: Description
          type: string
          nullable: true
        status:
          $ref: '#/components/schemas/Status'
        status_meta:
          title: Status Meta
          type: string
          nullable: true
        progress:
          title: Progress
          maximum: 1
          minimum: 0
          type: number
        path:
          title: Path
          type: string
          nullable: true
    JobPaymentRequiredStatus:
      title: JobPaymentRequiredStatus
      required:
        - offers
        - payment_context_token
        - payment_request_url
        - version
      type: object
      properties:
        version:
          title: Version
          type: string
        payment_request_url:
          title: Payment Request Url
          type: string
        payment_context_token:
          title: Payment Context Token
          type: string
        offers:
          title: Offers
          type: array
          items:
            $ref: '#/components/schemas/Offer'
        terms_url:
          title: Terms Url
          type: string
          nullable: true
        metadata:
          title: Metadata
          type: object
          additionalProperties:
            type: string
          nullable: true
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    GeneralDocumentRequestData:
      title: GeneralDocumentRequestData
      required:
        - text_body
      type: object
      properties:
        text_body:
          title: Text Body
          type: string
        meta:
          $ref: '#/components/schemas/GeneralDocumentRequestDataMeta'
    L402DocumentRequestOptions:
      title: L402DocumentRequestOptions
      type: object
      properties:
        document_name:
          title: Document Name
          type: string
          nullable: true
    Status:
      title: Status
      type: string
      enum:
        - Not Started
        - Processing
        - Done
        - Error
    Offer:
      title: Offer
      required:
        - id
      type: object
      properties:
        id:
          title: Id
          type: string
        title:
          title: Title
          type: string
        description:
          title: Description
          type: string
        amount:
          title: Amount
          type: integer
          format: int32
        currency:
          title: Currency
          type: string
        payment_methods:
          title: Payment Methods
          type: array
          items:
            type: string
        type:
          title: Type
          type: string
          nullable: true
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
                format: int32
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
    GeneralDocumentRequestDataMeta:
      title: GeneralDocumentRequestDataMeta
      type: object
      properties:
        author:
          title: Author
          description: >-
            The author of the document which gets presented on the first page of
            the document. This may also be taken from the auth header if the
            authorization was issued by FWS.
          type: string
          nullable: true
        title:
          title: Title
          description: >-
            The title of the document which gets presented on the first page of
            the document and in the footer. If not provided, the first #h1
            header will be taken from the text_body field
          type: string
          nullable: true
        subtitle:
          title: Subtitle
          description: >-
            The subtitle of the document which gets presented on the first page
            of the document
          type: string
          nullable: true
        disclaimer:
          title: Disclaimer
          description: The disclaimer text of the document.
          type: string
          nullable: true
        date:
          title: Date
          description: The date of the document.
          type: string
          nullable: true

````