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

# Create an export template

> Create a PDF/HTML export template. `name`, `type`, and `fields` are required.

The `fields` shape depends on `type` and `render_mode`. For HTML-mode paged types,
`fields.page.size` is required and `fields.page.orientation` is required whenever a
size is given. Discover the exact shape and valid placeholders via the meta endpoints
and dry-run with `POST /export-templates/validate` before saving.




## OpenAPI

````yaml /api-reference/build.yaml post /export-templates
openapi: 3.0.0
info:
  title: Luminous API
  version: 1.0.0
  description: API documentation for Luminous
servers:
  - url: https://{companyName}.api.joinluminous.com/external/api/v1
    variables:
      companyName:
        default: companyName
        description: Your company-specific subdomain
security: []
tags:
  - name: Products
    description: Get and manage products
  - name: Pricing
    description: Manage price schedules, levels, and customizations
  - name: BOMs
    description: Manage Bills of Materials (BOMs)
  - name: Labels
    description: Label rendering via Labelary ZPL service
  - name: Companies
    description: Manage business accounts and their associated data
  - name: Contacts
    description: Manage contact information for individuals
  - name: Suppliers
    description: Manage suppliers (factories) — vendors used on purchase orders
  - name: Supplier SKUs
    description: Manage per-supplier SKU and unit-cost overrides for products
  - name: Locations
    description: Manage warehouses and locations
  - name: Inventory
    description: Get and adjust product stock levels
  - name: Lots
    description: Create, update, and delete product lots (batches)
  - name: Transfer Orders
    description: Manage transfer orders
  - name: Fulfillment Orders
    description: Manage fulfillment orders and picklists
  - name: Freight
    description: >-
      Freightview LTL freight — quotes, booking and documents for fulfillment
      orders
  - name: Fulfillment Priority Lists
    description: Configure fulfillment routing priority lists
  - name: Purchase Orders
    description: Get and modify purchase orders
  - name: Supplier Portal
    description: >-
      Read a supplier's response to a purchase order and control the one-click
      portal link
  - name: Receiving Reports
    description: Manage receiving reports
  - name: Payment Obligations
    description: Manage payment obligations for purchase orders
  - name: Sales Orders
    description: Manage sales orders and sales order shipments
  - name: Purgatory
    description: >-
      Inspect and resolve non-posted sales orders in the purgatory staging
      workflow
  - name: PickFlow Warehouse
    description: >-
      Warehouse-floor lookups for PickFlow — barcode resolution, bin and product
      stock, bin search, and receivables
  - name: PickFlow Shipping
    description: >-
      Provider-agnostic shipping rates, services, packages, and label purchase
      for PickFlow
  - name: Cycle Counts
    description: >-
      Create, drive, and post PickFlow cycle counts — batches, per-warehouse
      sessions, and CSV import/export
  - name: Print Stations
    description: List paired print stations and enqueue print jobs to them
  - name: Invoices
    description: Get and manage invoices
  - name: Work Orders
    description: >-
      Manage work orders — production lifecycle, steps, materials, links,
      shipments, and comments
  - name: Production Batches
    description: Group and manage work orders as production batches
  - name: Bills
    description: >-
      Accounts payable bill management, payments, attachments, allocations, and
      variance
  - name: Prepayments
    description: Manage vendor prepayments and applications
  - name: Vendor Credits
    description: Manage vendor credits and applications
  - name: Vendor Returns
    description: Manage vendor returns and credit generation
  - name: Customer Returns
    description: Manage customer returns (sales returns), receiving, and restock behavior
  - name: Stock Snapshot
    description: Point-in-time stock snapshots with export support
  - name: Consumption
    description: Consumption reports and exports
  - name: Inventory Aging
    description: Cost-layer-based inventory aging reports
  - name: Bills Reports
    description: Accounts payable bills aging reports
  - name: Forecast
    description: Materialized forecast data
  - name: Reports
    description: Close the books, inventory discrepancy, transaction COGS, and EDI reports
  - name: Tags
    description: Add/remove tags across various resources
  - name: Custom Fields
    description: Get and set custom fields across various resources
  - name: Currency
    description: Currency configuration, exchange rates, and conversion
  - name: Drive
    description: >
      Browse, upload, tag and manage files in your Luminous Drive. An API token
      sees the shared

      drive only, never My Files or restricted folders and files. Every write
      and download made

      through the API is recorded in the file's activity log (`GET
      /file-cabinet/files/{id}/activity`)

      with `actor_kind: api_token`.
  - name: Integration Mappings
    description: Manage integration mappings for external systems
  - name: Integration Field Mappings
    description: Manage field-level mappings between Luminous and external systems
  - name: Automations
    description: Create, test, and inspect automation rules and their runs
paths:
  /export-templates:
    post:
      tags:
        - Export Templates
      summary: Create an export template
      description: >
        Create a PDF/HTML export template. `name`, `type`, and `fields` are
        required.


        The `fields` shape depends on `type` and `render_mode`. For HTML-mode
        paged types,

        `fields.page.size` is required and `fields.page.orientation` is required
        whenever a

        size is given. Discover the exact shape and valid placeholders via the
        meta endpoints

        and dry-run with `POST /export-templates/validate` before saving.
      operationId: createExportTemplate
      requestBody:
        required: true
        content:
          application/json:
            schema:
              allOf:
                - type: object
                  description: >
                    Create/update payload for an export template. On create,
                    `name`, `type`, and

                    `fields` are required. On update, send only the fields you
                    intend to change.


                    `fields` keys must match the stored Manage shape for the
                    chosen `type` — use the

                    meta endpoints (`/export-templates/types`,
                    `/export-templates/authoring-guide`,

                    `/export-templates/placeholders`) to discover the shape and
                    valid placeholders,

                    and `POST /export-templates/validate` to dry-run before
                    saving.
                  properties:
                    name:
                      type: string
                      maxLength: 255
                      example: AI Packing Slip
                    type:
                      type: string
                      description: >-
                        Template type (immutable in practice — determines the
                        `fields` shape).
                      enum:
                        - packing_slip
                        - supplier_purchase_order
                        - supplier_purchase_order_data
                        - assembly_order
                        - rfq
                        - invoice_pdf
                        - cost_layer
                        - receiving_report
                        - receiving_report_data
                        - work_order
                        - production_run
                        - production_run_data
                        - sales_order
                        - label_product
                        - label_lot
                        - label_location
                        - label_box
                        - label_pallet
                      example: packing_slip
                    fields:
                      type: object
                      additionalProperties: true
                      description: >
                        Raw template body — see the `fields` description on the
                        export template schema.


                        For HTML-mode paged types set `render_mode: "html"` and
                        supply `page` plus the

                        body keys for the type's shape (four fragments vs.
                        single `html`/`css`). For

                        options mode set `render_mode: "options"` and supply
                        `contents.sections`.
                    custom_fields:
                      type: array
                      nullable: true
                      description: >-
                        Tenant custom-field selections. Also accepted as
                        `customFields`.
                      items:
                        type: object
                        additionalProperties: true
                    invoice_fields:
                      type: array
                      nullable: true
                      description: >-
                        Invoice-specific field selections. Also accepted as
                        `invoiceFields`.
                      items:
                        type: object
                        additionalProperties: true
                    is_default_template:
                      type: boolean
                      nullable: true
                      description: >-
                        Set `true` to make this the default template for its
                        `type`. Also accepted as `isDefaultTemplate`.
                      example: false
                - required:
                    - name
                    - type
                    - fields
            examples:
              packingSlipFourFragment:
                summary: Four-fragment packing slip (HTML mode)
                value:
                  name: AI Packing Slip
                  type: packing_slip
                  fields:
                    render_mode: html
                    page:
                      size: A4
                      orientation: Portrait
                      highDpi: false
                    headerHtml: '<h1>Packing Slip #{{orderNumber}}</h1>'
                    itemsHeaderHtml: <tr><th>SKU</th><th>Qty</th></tr>
                    itemRowHtml: >-
                      {{#orderLines}}<tr><td>{{sku}}</td><td>{{quantity}}</td></tr>{{/orderLines}}
                    footerHtml: <div>{{shippingMethod}}</div>
                  is_default_template: false
              workOrderSingleBody:
                summary: Single-body work order (HTML mode)
                value:
                  name: Shop Floor WO
                  type: work_order
                  fields:
                    render_mode: html
                    page:
                      size: Letter
                      orientation: Portrait
                      highDpi: false
                    html: >-
                      <h1>{{workOrderNumber}}</h1>{{#bomComponents}}<div>{{sku}}</div>{{/bomComponents}}
                    css: 'h1 { font-size: 18pt; }'
      responses:
        '201':
          description: Export template created.
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    description: >
                      A PDF/HTML **document export template**
                      (`export_templates` table). Metadata is

                      snake_case; `fields` keys mirror the stored Manage shape
                      so templates round-trip

                      with the admin UI (`render_mode`, `page`, `headerHtml`,
                      `html`, etc.).
                    properties:
                      id:
                        type: integer
                        example: 4821
                      name:
                        type: string
                        example: AI Packing Slip
                      type:
                        type: string
                        description: >-
                          Template type. Determines which document a template
                          renders and its `fields` shape.
                        enum:
                          - packing_slip
                          - supplier_purchase_order
                          - supplier_purchase_order_data
                          - assembly_order
                          - rfq
                          - invoice_pdf
                          - cost_layer
                          - receiving_report
                          - receiving_report_data
                          - work_order
                          - production_run
                          - production_run_data
                          - sales_order
                          - label_product
                          - label_lot
                          - label_location
                          - label_box
                          - label_pallet
                        example: packing_slip
                      fields:
                        type: object
                        additionalProperties: true
                        description: >
                          Raw template body. Keys match Manage storage and vary
                          by `type` and render mode:


                          - `render_mode` — `options` (form-driven) or `html`
                          (author-supplied markup).

                          - `page` — `{ size, orientation, highDpi }` for
                          HTML-mode paged types.
                            `size` ∈ `Letter`, `Legal`, `A4`, `A5` (plus `2x1` for `packing_slip`);
                            `orientation` ∈ `Portrait`, `Landscape`.
                          - **Four-fragment** HTML types (`packing_slip`,
                          `sales_order`):
                            `headerHtml`, `itemsHeaderHtml`, `itemRowHtml`, `footerHtml` (plus optional
                            `sortField` / `sortDirection`).
                          - **Single-body** HTML types (`work_order`,
                          `production_run`, `assembly_order`,
                            `supplier_purchase_order`, `invoice_pdf`): `html` plus optional `css`.
                          - **Options mode**: `contents.sections` (an array of
                          section descriptors).


                          Placeholders use Mustache syntax (`{{orderNumber}}`,
                          `{{#orderLines}}…{{/orderLines}}`).

                          Call `GET /export-templates/placeholders?type=` for
                          the exact catalogue.
                        example:
                          render_mode: html
                          page:
                            size: A4
                            orientation: Portrait
                            highDpi: false
                          headerHtml: '<h1>Packing Slip #{{orderNumber}}</h1>'
                          itemsHeaderHtml: <tr><th>SKU</th><th>Qty</th></tr>
                          itemRowHtml: >-
                            {{#orderLines}}<tr><td>{{sku}}</td><td>{{quantity}}</td></tr>{{/orderLines}}
                          footerHtml: <div>{{shippingMethod}}</div>
                      custom_fields:
                        type: array
                        nullable: true
                        description: >-
                          Tenant custom-field selections carried by the
                          template.
                        items:
                          type: object
                          additionalProperties: true
                      invoice_fields:
                        type: array
                        nullable: true
                        description: >-
                          Invoice-specific field selections (used by
                          invoice-type templates).
                        items:
                          type: object
                          additionalProperties: true
                      is_default_template:
                        type: boolean
                        description: Whether this is the default template for its `type`.
                        example: false
                      schema_fingerprint:
                        type: string
                        nullable: true
                        description: >-
                          Fingerprint of the placeholder schema the template was
                          authored against.
                        example: a1b2c3d4
                      has_schema_drift:
                        type: boolean
                        description: >-
                          `true` when the current placeholder schema for this
                          `type` no longer matches the template's stored
                          `schema_fingerprint` (the template may reference
                          placeholders that have changed).
                        example: false
                      created_by:
                        type: integer
                        nullable: true
                      updated_by:
                        type: integer
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                        nullable: true
                      updated_at:
                        type: string
                        format: date-time
                        nullable: true
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
        '422':
          description: >-
            Validation error — e.g. missing `name`/`type`/`fields`, invalid
            `type`, or an invalid `fields` shape for the type.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  errors:
                    type: object
                    additionalProperties:
                      type: array
                      items:
                        type: string
      security:
        - BearerAuth: []
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Authenticate using a bearer token. To create a token, navigate to
        /settings/api-tokens and click Create API Token.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.