---
title: "Auto Fill Endpoint"
method: POST
path: "/api/v1/template/auto-fill"
tags: ["template"]
---

# Auto Fill Endpoint

`POST /api/v1/template/auto-fill`

## Request

- Base URL: `https://api.slidemaster.tw` (the document declares no server; this is the origin it was published from)
- URL: `https://api.slidemaster.tw/api/v1/template/auto-fill`
- Auth: none declared

Auto-match outline to template layouts. No LLM required.

Credit policy when ``project_id`` is provided:
  - First fill of N slides: charge N × 45 credits, set
    projects.{id}.template_paid_slot_count = N.
  - Subsequent fills with slots_needed ≤ paid_slot_count: 0 credits
    (吃到飽 — switching layout / iterating bullets is free).
  - Expansion (slots_needed > paid_slot_count): charge only the
    delta × 45, then bump paid_slot_count.

When project_id is omitted: legacy behaviour — frontend deducts
per-page client-side. We keep this path so older callers don't break.

## Headers

- `Authorization` string, nullable

## Request body

- AutoFillRequest
  - `template_id` string, required
  - `outline` object[], required
  - `typography` object, nullable
  - `text_fit_policy` object, nullable
  - `project_id` string, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api.md) · [All operations](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/slidemaster/apis/slidemaster-ai-api/revisions/a964c005977e?raw)
