Browser application contracts
Routes use session authentication, CSRF and verified email. They are not a separately advertised public token API.
| Operation | Endpoint | Response |
|---|---|---|
| Save | PUT /app/presentations/{id} | confirmed revision |
| Upload | POST /app/attachments | private-file metadata |
| List files | GET /app/attachments?page=1&kind=image | paginated tenant data |
| Generate | POST /app/generations | 202, job ID/status |
| Poll | GET /app/generations/{id} | state and completed editor URL |
| Start assistant | POST /app/agent-sessions | 202, persistent session snapshot |
| Read assistant | GET /app/agent-sessions/{id}?after={cursor} | current state and one event page |
| Answer assistant | POST /app/agent-sessions/{id}/messages | 202, resumed session snapshot |
| Cancel assistant | POST /app/agent-sessions/{id}/cancel | terminal snapshot; preserves draft |
| Retry assistant | POST /app/agent-sessions/{id}/retry | 202, explicit retry from persisted draft |
| Image catalog | GET /app/image-generations/catalog | configured models, capabilities, image allowance and recent jobs |
| Generate image | POST /app/image-generations | 202, image job metadata |
| Poll image | GET /app/image-generations/{id} | state and private attachment URL when ready |
| Download image | GET /app/attachments/{id}/download | authenticated workspace file |
| Vector catalog | GET /app/visual-assets/search?query=&kind=all&pack=&page=1 | paginated local vector metadata and capabilities |
| Vector artwork | GET /vectors/{pack}/{name}.svg?color=%23RRGGBB | public sanitized bundled SVG; fixed local asset identifier |
| Share/revoke | POST/DELETE /app/presentations/{id}/share | URL+expiry / 204 |
| Versions | GET /app/presentations/{id}/revisions | version metadata |
| Restore | POST /app/presentations/{id}/revisions/{revision} | new document revision |
| Export | GET /app/presentations/{id}/export/{json or html} | download |
Presentation generation accepts prompt (10–6000 characters), slide_count (3–20), locale (en/ar), theme, UUID idempotency_key, and optional context: audience, goal, tone, attachment_ids (five ready files maximum). Optional provider/model choices must be configured and server-allowed; omitting them uses the operator's defaults. Image references require a vision-capable model.
Assistant sessions — 1.2
The assistant endpoints require the initiating user and workspace, not merely a valid session ID. Creating a session accepts:
| Field | Contract |
|---|---|
message |
Initial user instruction, 3–6000 characters. |
idempotency_key |
UUID retained when retrying the same ambiguous HTTP request. A different payload with the same key returns 409. |
consent |
Accepted acknowledgment of sending the conversation and selected references to the chosen provider. |
provider, model |
Optional configured, server-allowed choice. Supplying provider requires model. Omission uses server defaults, which are pinned in the session. |
locale |
Optional language hint of at most 20 letters/hyphens. The model is instructed to follow the conversation's language. |
slide_count, theme |
Optional new-deck settings; 3–20 slides, default 8, and a server theme. |
attachment_ids |
At most five distinct, ready files from the workspace. Image references require a vision-capable model. |
presentation_id, base_revision |
Optional existing-deck edit. Revision is required and must match; the deck's current count/theme are retained. Omit slide_count for editing. |
allow_ai_images |
Optional boolean, default false. Grants the agent permission to request up to its image-tool limit using the configured image provider. |
Statuses are queued, running, awaiting_user, completed, failed and cancelled. The model chooses whether a useful clarification is needed. ask_user supplies question: {text, options: string[]} and pauses execution. Answer only while awaiting_user: POST messages with message (1–6000 characters), accepted consent, a new UUID idempotency_key, and optional additional attachment_ids. Existing references remain selected and the combined list cannot exceed five.
Retry requires a new UUID and a failed session that has budget remaining. A repeated retry request with the same key does not dispatch twice. Revision conflicts require a new request from the latest saved deck. Completed/cancelled sessions are not retried. Cancellation has no request body and is idempotent; it preserves the draft, releases slide-credit reservations and invalidates pending agent steps. It can cancel queued child image jobs, but cannot recall an already running provider request.
Snapshots include identity/status, provider/model, public messages, question, plan, current document, slide_progress, stockPhotos, presentation ID/URL/revision, error/can_retry, limits, sanitized provider_usage and reported_cost_usd. Draft slides appear only after they have passed validation. Provider usage can be incomplete or unavailable; a missing cost remains null in its report and the reported total is not a final bill.
Slide tool indices are zero-based: 0 is the first slide. Agent context supplies explicit slot indices and missing indices. The internal write_slide tool uses opacity_fraction in 0..1 and converts it to the document's opacity percentage in 0..100. The browser save/export document keeps the percentage contract; it does not accept the agent-only opacity_fraction field.
The internal style_elements action accepts slide_indices, element_ids (empty selects all unlocked objects in those slides), and style. Its provider schema uses nullable opacity_fraction (0–1), fill, stroke, radius (0–80), text_color (hex), font_size (6–160), and asset_color (hex). Older requests may omit asset_color. At least one property and one applicable unlocked object must match. Explicit IDs must belong to the selected draft slides. Text color/font size apply to text objects; asset_color applies only to original icons and recolorable vector assets. Multicolor illustrations are unchanged. Results identify changed_slide_indices, matched_elements, changed_elements and already_applied. Styling preserves all unselected fields and object IDs. Repeating a satisfied style does not reserve additional slide credits or emit another slide update.
Vector resources — 1.3
Catalog search accepts query (up to 120 characters), kind (all, icon, illustration), optional pack, page and per_page (1–48). It returns data, total, page, per_page, last_page, has_more, packs, counts and version. Asset metadata includes id, name, optional name_ar, kind, pack, recolorable, intrinsic width/height, tags and a local svg_url. Counts/version reflect the installed catalog.
Search feedback includes the attempted query/kind and match_mode/result_note when available, so callers can distinguish exact-term results from broader semantic matches. The agent receives returned/total counts and a concrete simplification hint when no result is found; no empty result is presented as a selected asset.
Vector IDs use pack:name, with lowercase letters, digits and hyphens; pack/name lengths are bounded. A freeform type=vector requires an available vector_id. Geometry and document opacity keep the existing element contract. typography.color requests a tint for monochrome assets; valid tint values are ignored for multicolor artwork. The browser cannot supply SVG source or an arbitrary artwork URL.
Agent search_vectors accepts a 2–120-character query and kind, returns up to twelve compact results, and omits SVG content/URLs. use_vector accepts an exact returned ID and adds it to that session's allowlist. New vector IDs cannot be invented in write_slide even when they happen to exist elsewhere in the catalog. Search and selection use local data and do not call a paid model or stock vendor themselves.
Event pagination and ordering
events contains up to 100 records {id, type, data, created_at}. cursor is the last delivered event ID. version is the latest event ID for the entire session, regardless of which page was returned. has_more means the page cursor is behind that version.
- Read the initial snapshot and retain its version/cursor.
- Poll
?after={cursor}; merge events by ID and retain the maximum cursor already received. - Accept current document/status metadata only if the response version is not older than the displayed version. This prevents late polls from reversing a cancellation or completion.
- Continue fetching pages while has_more is true, including after a terminal state. A new snapshot may have a high version and still contain the first event page.
Event types include message, model.started, model.completed, model.retrying, tool.started, tool.completed, tool.failed, question, plan, slide.updated, resource.waiting, resource.ready, resource.failed, completed, status and usage.updated. Tool events identify the registered tool and call ID; slide events identify the index/title/object count. They are real execution notifications, not a reasoning transcript. Errors contain safe application diagnostics rather than provider response bodies.
model.retrying identifies a single automatic correction of a definitively received but invalid action response, with stage, reason, attempt and run_id. The session remains running and the next request is a separately queued, budgeted step. A second invalid response fails normally. No automatic retry is made for funding, transport/timeouts, incomplete responses, context or revision errors. A failed snapshot may include diagnostic: {stage, reason, http_status}; these fields are sanitized codes, never raw model output or headers. Usage receipts are retained before action validation, including rejected responses when the provider supplies accounting.
Image requests
POST /app/image-generations accepts:
| Field | Contract |
|---|---|
| provider | openai, gemini or openrouter, with an operator-configured key |
| model | An image model from the authenticated catalog |
| prompt | 10–4000 characters |
| aspect_ratio | A catalog-supported ratio among auto, 1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3 |
| format | png or jpeg; this is the final private-file format |
| background | opaque or transparent; transparency requires model support and PNG |
| quality | Optional low, medium, high or default; accepted only when supported, with low preferred when available |
| consent | Accepted acknowledgment of sending the prompt to the selected provider |
| idempotency_key | A fresh UUID for a new request; retain it when retrying an ambiguous network failure |
The same workspace/key and payload returns the existing job. Reusing a key for different input is rejected. At most two image jobs can be pending per workspace. Pending and completed jobs reserve/use that UTC month's image allowance; failed jobs do not count. This meter does not consume presentation slide credits. Each pending job also reserves 8 MB of storage; insufficient unreserved storage produces a 422 response before dispatch. Ordinary uploads cannot consume reserved image space.
Status values are queued, processing, completed and failed. Metadata includes id, status, provider, model, attachment_id, content_url, error, and provider_cost_usd when reported. Provider-reported cost is not a fixed price promise. Responses omit prompt text, API keys, storage paths and cross-workspace records. The catalog's recent list belongs to the signed-in user; image access remains workspace-scoped.
Poll until a terminal status. A failed network request does not prove generation failed: retry status polling or reopen Image Studio. Image jobs have no standalone cancellation endpoint; cancelling an assistant session can cancel its queued child image jobs. A stale image job is failed by scheduled recovery after 15 minutes without progress.
Saving requires title/theme/locale/slides and the last confirmed revision. Conflict: 409; invalid input: 422; unauthorized resource: 403/404. Preserve unsaved work before re-authenticating/reloading.
SlideDocument and editor/types.ts define the contract: up to 60 edited slides, six bullets, eight chart categories, four table columns/six rows. The 1.1 document also supports structured visual components, allowlisted icons, solid/gradient backgrounds, decorative shapes and motion settings. Existing documents without these optional fields remain valid. Images must belong to the workspace.
Document collections—including slides, elements, bullets, chart labels/values, table rows/cells, visual items and decorations—must be ordered JSON arrays. Object-shaped collections or sparse numeric keys are rejected rather than saved into a document the browser cannot render.
JSON export identifies schema deckixa.presentation.v1 and does not embed private media. HTML/PPTX embed images. JSON import is not a feature in this release.