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

# How it works

> End-to-end workflow from template upload to generated `.pptx`.

Using the API is two phases: a one-time template setup, then a request per deck. The workflow is the same whether you're calling it from a script, an internal pipeline, or an AI agent.

```mermaid theme={"dark"}
flowchart LR
    A["1. Upload template"]:::once --> B["2. Service analyzes<br/>the template"]:::once
    B --> C["3. Compose request<br/>from the analysis"]:::each
    C --> D["4. API generates<br/>the deck"]:::each
    D --> E["5. Download .pptx"]:::each

    classDef once fill:#e0f2f1,stroke:#0F766E
    classDef each fill:#ffffff,stroke:#0F766E
```

<Note>Steps 1–2 happen once per template (teal). Steps 3–5 happen on every generation (white).</Note>

### 1. Upload template

You upload your `.pptx` template — the file that defines your fonts, colours, table styles, chart presets, and master layouts. Each template gets a stable ID you reference in later requests.

### 2. Service analyzes the template

The service inspects your template and returns a description of each slide — how many columns each table has, what categories each chart expects, where each text block sits. You use that description to know what data to send for each slide.

### 3. Compose request from the analysis

Build a JSON payload that matches the analysis: pick which template slides to use, fill in the data for each one (rows, chart series, text, logos). The shape of the payload follows directly from what the analysis exposed.

### 4. API generates the deck

Submit the request. The API runs the deck against your template asynchronously and returns a generation ID. The client polls until it's ready — typical decks finish in seconds.

### 5. Download `.pptx`

Once the generation reports as ready, fetch the finished `.pptx`. The output looks exactly like your template, with the data you supplied populated into the right places.

## AI agent workflow

The same five steps map onto an AI agent's run. Setup is done once by a human; everything else is the agent's job per request.

| Step                                     | Who does it       | What the agent does                                                                                                                                                                 |
| ---------------------------------------- | ----------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **1. Upload template**                   | Developer / admin | — (handled at setup)                                                                                                                                                                |
| **2. Service analyzes the template**     | Developer / admin | — (handled at setup; agent receives the `template_id`)                                                                                                                              |
| **3. Compose request from the analysis** | Agent             | Pulls data from its sources (CRM, financial models, research notes, call transcripts), reads the template's analysis to see what each slide expects, and assembles the JSON request |
| **4. API generates the deck**            | Agent             | Calls the generate endpoint and polls for completion                                                                                                                                |
| **5. Download `.pptx`**                  | Agent             | Fetches the file and delivers it (drive upload, email, chat reply, etc.)                                                                                                            |

Most of the agent's work happens inside step 3 — gathering and structuring the data. Steps 4–5 are the same handful of HTTP calls every run.

Brand stays consistent across runs because the look comes from the template, not from the agent's prompt.

## From your AI agent's perspective

Steps 1–2 are setup — a developer or admin uploads the template once and shares the `template_id` with the agent. The agent only runs steps 3–5 on each request.

```mermaid theme={"dark"}
flowchart LR
    A["Gather inputs<br/>(CRM, financial models,<br/>research notes,<br/>call transcripts)"] --> B["Look up the<br/>template's analysis<br/>(what each slide<br/>expects)"]
    B --> C["Compose JSON<br/>matching each slide"]
    C --> D["Call generate ·<br/>poll until ready"]
    D --> E["Download .pptx ·<br/>deliver to user"]
```

The agent never has to know your brand. Fonts, colours, table styles, and chart presets all come from the template that was uploaded once — the agent only handles the data and the slide structure.
