DraftScreens API
Everything the studio does, from your own code: create projects, draw screens and whole flows in a real design language, edit them, export them as React Native, SwiftUI or Flutter, share them and run them on a phone.
Authenticate with a key from Settings, Agents: Authorization: Bearer ds_live_.... The OpenAPI document is at /api/openapi.json.
Account
Who the key belongs to, and what is left on the plan.
| Endpoint | What it does |
|---|---|
| GET /api/billing/me | Plan and credits. The plan the key's account is on and the credits it has left. One credit draws one screen. |
Projects
A project holds one app's screens and flows and keeps one design language across them.
| Endpoint | What it does |
|---|---|
| GET /api/projects | List projects. Every project of the account, most recently changed first, with counts and the newest screen's HTML as a cover. |
| POST /api/projects | Create a project. Start an empty project. Give it a named design language, a design system, or neither (the first flow then picks one). |
| GET /api/projects/{id} | Get a project. A project with every screen (including its HTML), its flows and its chat. |
| PATCH /api/projects/{id} | Update a project. Rename, describe or pin a project, or change the design language new screens are drawn in. |
| POST /api/projects/{id}/scheme | Switch light or dark. Convert every screen of the project to the other colour scheme. Switching back restores the originals exactly. |
| POST /api/projects/{id}/duplicate | Duplicate a project. Copy a project with all its screens, flows and chat. |
| DELETE /api/projects/{id} | Delete a project. Move a project to the trash. It can be restored from the trash for 30 days. |
Generate
Draw screens and flows with AI. Both stream their progress as server-sent events. A failed generation is never charged.
| Endpoint | What it does |
|---|---|
| POST /api/generate | Generate or edit a screen. Draw one new screen in a project, in its design language, or change an existing screen when `screenId` is given. The answer streams: `delta` events carry the HTML as it is written, `done` names the saved screen. |
| POST /api/generate-flow | Generate an app flow. Plan an app's journey (4 to 6 linked screens, or the number the prompt names) in one design language and draw each screen. Screens link to each other as a prototype. |
Screens
Read, rename and edit screens by hand, and step through their version history.
| Endpoint | What it does |
|---|---|
| GET /api/screens/{id} | Get a screen. One screen with its HTML (390 by 844, inline styles) and its share link if it has one. |
| PATCH /api/screens/{id} | Update a screen. Replace a screen's HTML or rename it, as the visual editor does. The previous version stays in its history. No credits. |
| DELETE /api/screens/{id} | Delete a screen. Remove a screen from its project. |
| GET /api/screens/{id}/versions | List versions. Every version of a screen, newest first: generations, AI edits, hand edits and restores. |
| POST /api/screens/{id}/versions/{versionId}/restore | Restore a version. Put an earlier version back. Restoring is itself a new version, so nothing is lost. |
| POST /api/screens/{id}/undo-ai | Undo the last AI edit. Take back the most recent AI edit of a screen. |
Export
Pictures, HTML, Figma, and the app as code: React Native (Expo), SwiftUI and Flutter.
| Endpoint | What it does |
|---|---|
| GET /api/export/screens/{id}/png | Screen as PNG. A screen in its device frame. Free plans get the "Designed with DraftScreens" bar. |
| GET /api/export/screens/{id}/html | Screen as HTML. A screen as a standalone HTML page. |
| GET /api/export/projects/{id}/figma.svg | Project for Figma. Every screen as editable layers: paste the SVG into Figma. |
| GET /api/export/projects/{id}/zip | Project as a ZIP. Every screen as PNG and HTML, with the design tokens. |
| GET /api/export/projects/{id}/code/{target} | Project as code. The app as source files: `expo` (React Native with expo-router), `swiftui` (an Xcode project) or `flutter` (go_router). Text files come back inline; images by size only (use the ZIP for those). |
| GET /api/export/projects/{id}/code/{target}/zip | Code as a ZIP. The same project as one ZIP, images included, ready to open or run. |
| GET /api/export/projects/{id}/prompt-pack.md | Prompt pack. A markdown handoff for coding agents (Cursor, Claude Code, Lovable, Bolt): the design tokens and a build prompt per screen. |
Share
Public links where anyone can view a design and play its prototype.
| Endpoint | What it does |
|---|---|
| POST /api/share | Share. A public link to a screen, a flow or a whole project. Sharing the same thing again returns the same link. |
| PATCH /api/share/{token} | Turn remixing on or off. Whether visitors may remix the shared design into their own account. |
| DELETE /api/share/{token} | Unshare. The link stops working at once. |
Run on a phone
Build a project as a real app for Expo Go, a Flutter web preview, or a Swift Playground.
| Endpoint | What it does |
|---|---|
| POST /api/preview/projects/{id}/expo-go | Run in Expo Go. Build the React Native export for Expo Go and get its links: `url` (exp:// or exps://) opens it in Expo Go on a phone; `pageUrl` is a web page with its QR code. |
| POST /api/preview/projects/{id}/flutter-web | Flutter web preview. Build the Flutter export for the web and get the URL to open on a phone. |
| GET /api/preview/projects/{id}/swift-playground.zip | Swift Playground app. The SwiftUI export as a .swiftpm app for Swift Playground on iPad and Mac. |
Templates
Start a project in the design of a template.
| Endpoint | What it does |
|---|---|
| POST /api/templates/{slug}/remix | Remix a template. Give a new project (or `projectId`) a template's design language. No screens are copied: generate your own app in it next. |