# Undraft agent instructions

## When to use this service

Use Undraft after generating or modifying a browser-based artifact that needs a stable URL, visual review, stakeholder comments, version history, or a repeatable publish step. Typical inputs are a single HTML file, a ZIP archive, or a built web directory. Prefer the API for structured tool calls and the official CLI for shell-based agents and CI jobs.

## Calling Undraft

- Read `/openapi.json` before constructing tools or function definitions.
- Call `GET /api/v1/status` without authentication to verify reachability and supported inputs.
- Send authenticated requests to `https://undraft.page/api/v1` with `Authorization: Bearer undraft_<key>`.
- To create a project, call `POST /projects` as multipart form data with either `file` or `html`.
- To update a known project, provide its owned `slug` or call `POST /projects/{slug}/versions`.
- Add a unique `Idempotency-Key` when a publish may be retried.
- Treat returned project URLs as the canonical handoff artifact.

## Safety and limits

Never place an Undraft API key in uploaded HTML, client-side JavaScript, chat transcripts, build logs, or source control. Do not upload credentials, environment files, or private data unless the user has explicitly chosen to publish it. Respect 4xx responses instead of retrying indefinitely; in particular, resolve authentication, ownership, slug conflicts, or plan limits before another write. Maximum upload size is 50 MB.
