---
title: "Run python-pptx code and return a preview image (public, no auth)"
method: POST
path: "/v1/tools/preview-code"
tags: ["tools-free-tier"]
---

# Run python-pptx code and return a preview image (public, no auth)

`POST /v1/tools/preview-code`

## Request

- Base URL: `https://api.slideforge.dev`
- URL: `https://api.slideforge.dev/v1/tools/preview-code`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-Key`

Executes python-pptx code in the sandbox and returns slide 1 as an inline PNG (768px) plus static lint findings (overlaps, off-canvas shapes, tiny fonts, chart semantics) in `lint[]`. Send a python-pptx script as it is (the presentation it saves is the one shown), or a `build(prs)` function. No .pptx is produced and nothing is downloadable — the file, PDF export, and full-resolution renders live in the playground and /v1/render/code. 16KB code cap, 10s timeout, 1 slide.

## Request body

- CodePreviewRequest: python-pptx source to preview. Code only — no chrome, no job refs, no uploads.
  - `code` string, required
  - `theme_id` string, nullable

## Response `200`

Preview rendered, or code diagnostics with status invalid/failed

- unknown

## Other responses

- `422`: Validation Error
- `429`: Rate limit exceeded (3/minute, 20/hour per IP)

---

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