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.

EndpointWhat it does
GET /api/billing/mePlan 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.

EndpointWhat it does
GET /api/projectsList projects. Every project of the account, most recently changed first, with counts and the newest screen's HTML as a cover.
POST /api/projectsCreate 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}/schemeSwitch light or dark. Convert every screen of the project to the other colour scheme. Switching back restores the originals exactly.
POST /api/projects/{id}/duplicateDuplicate 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.

EndpointWhat it does
POST /api/generateGenerate 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-flowGenerate 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.

EndpointWhat 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}/versionsList versions. Every version of a screen, newest first: generations, AI edits, hand edits and restores.
POST /api/screens/{id}/versions/{versionId}/restoreRestore a version. Put an earlier version back. Restoring is itself a new version, so nothing is lost.
POST /api/screens/{id}/undo-aiUndo 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.

EndpointWhat it does
GET /api/export/screens/{id}/pngScreen as PNG. A screen in its device frame. Free plans get the "Designed with DraftScreens" bar.
GET /api/export/screens/{id}/htmlScreen as HTML. A screen as a standalone HTML page.
GET /api/export/projects/{id}/figma.svgProject for Figma. Every screen as editable layers: paste the SVG into Figma.
GET /api/export/projects/{id}/zipProject 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}/zipCode as a ZIP. The same project as one ZIP, images included, ready to open or run.
GET /api/export/projects/{id}/prompt-pack.mdPrompt 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.

EndpointWhat it does
POST /api/shareShare. 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.

EndpointWhat it does
POST /api/preview/projects/{id}/expo-goRun 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-webFlutter 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.zipSwift 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.

EndpointWhat it does
POST /api/templates/{slug}/remixRemix a template. Give a new project (or `projectId`) a template's design language. No screens are copied: generate your own app in it next.

Connect an AI agent over MCP