Endpoints
The table below renders from the same declaration GET /api/agent/v0/capabilities serves, so it cannot drift from what the API declares about itself.
POST/api/agent/v0/projects/:id/edit-previewversketch:validate
Prepare a deterministic move/resize-opening or translate/quarter-turn-group edit. Returns a validated patch and baseRevision; never writes a proposal or document. Architectural transforms require explicit dependency inclusion; room resize is unsupported. Discover operation arguments with get_authoring_schema.
- versketch:validate scope; shared 30/min validation bucket; 64KB request limit.
- {baseRevision, operation, ...arguments}. Operations: move_opening (openingId, offset mm); resize_opening (openingId, width mm, height? mm); translate_group (ids, dx mm, dy mm); rotate_group (ids, pivot:[x,y], angleDeg: ±90/±180/±270).
- Building transforms require complete dependencies across all levels; includeLevelDependencies:true explicitly includes them. Read returned dependencyIds before proposing. Constraint-aware room resize is unsupported.
- Grid axes/offsets rotate with the group. Shed highSide follows every quarter turn, including 180 degrees. Hip roofs require axis-aligned rectangles with long-axis ridges; quarter turns swap the ridge axis.
200 — {kind:"edit-preview", projectId, baseRevision, patch, affectedIds, dependencyIds, validation, nextStep}. No proposal or document is written. Submit the returned patch and baseRevision through the proposal endpoint only if the preview matches the request.- 400 bad_body/bad_selection/unknown_opening/unsupported_operation/dependent_selection_required/edit_invalid/no_change/patch_too_large.
- 404 not_found; 409 revision_conflict; 413 payload_too_large; 503 db_error.
GET/api/agent/v0/projects/:id/preview?baseRevision=&level=&proposalId=versketch:read
Render a bounded 2D PNG of a saved project or proposal at an exact baseRevision. Returns an MCP image plus skipped/withheld-element report. Check the report: the image omits unsupported geometry and is not a 3D view.
- versketch:read scope; separate 12/min rendering bucket.
- Required baseRevision=current saved revision. Optional level=level ID and proposalId=owned proposal ID.
- With proposalId, this request is where the state of that proposal is decided, at the moment it is asked. The plan's revision and the proposal's status are read as they stood at one moment. A proposal is drawn only while it is pending, the plan is at the revision the proposal was drafted on, and baseRevision names that revision; and the picture is released only if a second check, made after drawing, finds the same. That check is the whole guarantee: the owner can still save or decide while the answer is on its way. Anything else is a 409 that states currentRevision, proposalId, proposalStatus, proposalBaseRevision and reviewUrl, carries no image, and names the next call in nextPreview.
- stale_revision / stale_proposal: baseRevision, or the revision the proposal was drafted on, is not the plan's current revision. If only the request was wrong (the proposal was drafted on the current revision), nextPreview is the corrected request {tool:"get_project_preview", arguments:{id, baseRevision, proposalId, level?}}. If the plan was saved after the proposal was drafted, nextPreview is {tool:"get_project", arguments:{id}}: read the plan and draft a new proposal from it. The current revision is never offered with the old proposalId, which would only be refused again.
- proposal_decided: the proposal is accepted, rejected, expired or superseded. A decided proposal has no preview from this request. The owner can open reviewUrl for its status in Studio. (If the plan has also moved on, the code is the stale one and proposalStatus still states the decision.) For a picture of the plan as saved, nextPreview is {tool:"get_project", arguments:{id}}, then this request with the revision it returns and no proposalId.
- A proposalId of another account or another project answers 404 not_found, with nothing about the proposal.
- Without proposalId the saved plan is drawn; asked for at a revision that is not current, it answers 409 stale_revision with currentRevision and the corrected request in nextPreview. One case is refused instead: the saved plan is still empty and a proposal of yours prepared against this revision is pending (the state POST /projects leaves until the owner accepts). That answers 409 preview_needs_proposal with nextPreview; it never returns an empty sheet as the design.
- With one pending proposal, nextPreview is {tool:"get_project_preview", arguments:{id, baseRevision, proposalId, level?}}: over REST that is GET /api/agent/v0/projects/{id}/preview?baseRevision={baseRevision}&proposalId={proposalId}, with &level={level} added when arguments carries one (the level you asked for). A proposal that does not contain that level answers 400 bad_level; no other level is drawn in its place.
- With several pending proposals none is chosen for you: pendingProposals is the exact count and pending lists the candidates oldest first (at most 10: proposalId, createdAt, summary). nextPreview is then the same request one argument short, {tool:"get_project_preview", arguments:{id, baseRevision, level?}, missing:"proposalId"}: ask the user which proposal they mean and add its proposalId. The refusal is followed from pending alone; GET /projects/:id/proposals returns the 50 newest proposals of any status and is not where these are looked up.
- report.measuredAreas states the area of every Space on the drawn level, measured the way Studio and its PDF room schedule measure a plan: areaM2 to two decimals, areaMm2 exact, levelTotals for the level. Quote these figures instead of working areas out, and use the level total rather than adding rows. A figure that cannot be measured is left out and listed in unmeasured with its reason.
- report.measuredAreas is held to 16,000 bytes. listing counts what is here and what is not (spaces, spacesOmitted, unmeasured, unmeasuredOmitted, namesOmitted): names are left out before any figure is, since they are the names in the plan, by spaceId. When a level has more Spaces than fit, the result is partial: listing.fullList states how many are listed and how many are left out. Each result states how many rows it shows and how many it omits, within its own byte budget, so another result may contain rows this one left out (a create receipt can list a level in full that this preview lists in part). Use only area values a tool has returned; never work one out.
- A control character that an image cannot carry (such as U+000B in a room name) is left out of the drawn labels; report.limitations says how many, and the data keeps the name as stored.
200 — {kind:"plan-2d", source, projectId, revision, proposalId, proposalStatus, levelId, mimeType:"image/png", imageBase64, width, height, report:{skipped, withheld, limitations, measuredAreas:{unit:"m2", method, listing, levelTotals, unmeasured, spaces:[{spaceId, levelId, name, areaMm2, areaM2}]}}}. MCP returns the PNG as an image block and metadata as text. Read the report; unsupported geometry is explicitly withheld. Preview is bounded to 1024×1024 and is not a 3D rendering.- 400 bad_revision/bad_level/bad_preview_selector; 404 not_found; 413 preview_too_complex/preview_too_large.
- 409 stale_revision / stale_proposal / proposal_decided — {error, message, currentRevision, proposalId?, proposalStatus?, proposalBaseRevision?, reviewUrl?, nextPreview}; no image. Follow nextPreview.
- 422 preview_invalid — the plan or the proposal breaks a structural or validation rule, and the message states it (for example "walls[0].thickness: must be > 0"). Asking again does not change the answer; the plan has to.
- 500 internal_error — a fault on the server, or the picture of this plan cannot be made by the renderer. Either is logged, and the message is deliberately neutral. When it is the picture, the answer carries reviewUrl or projectUrl for the user to see the plan in Studio. Asking again does not help.
- 503 db_error / preview_unavailable — the store is unavailable, the project is being saved, or the renderer is busy or timed out. The same request can be made again shortly.
- 409 preview_needs_proposal — the saved plan is empty and a pending proposal holds the design: {error, message, pendingProposals, pending?, nextPreview}. Follow nextPreview.
GET/api/agent/v0/schema?detail=full|compact&elements=walls,slabsno auth
Discover canonical PlanSpec and PlanPatch authoring schemas, a valid create/edit example, units, limits, field preservation policy, and revision-safe human-review workflow. Read before authoring. detail=compact (the MCP default) replaces the JSON schemas with a per-element field summary at about a sixth of the size; elements= adds the exact schema of the named collections.
- No authentication. Read before authoring. The response is not cached because optional model-upload readiness can be withdrawn. MCP: get_authoring_schema.
- Optional ?detail=full|compact (REST default full; the MCP tool defaults to compact, about a sixth of the size: prose, limits, examples, patch grammar and a per-element field summary instead of the JSON schemas). Optional ?elements=walls,slabs adds elementSchemas with the exact PlanSpec item schema and PlanPatch upsert schema for those collections.
200 — { version, detail, profile, scope, instructions, schemas: { PlanSpec, PlanPatch }, portableSchemas, conventions, limits, examples, deterministicEdits, supported, unavailable, elements: { available, requiredOnCreate, summary, expand }, patchGrammar, elementSchemas? }. detail=compact omits schemas/portableSchemas, per-tool inputSchemas (available in tools/list), elements.available (the keys of elements.summary), the portable-only conventions.storeys and conventions.rampHandrails; it replaces examples.createHouse (a furnished one-bedroom house that passes validation) with a pointer to detail=full and the stair-shape field list with a pointer to elementSchemas. The former tokenBudget guidance is in instructions and elements.expand; the former conventions.externalModels is part of scope.
The native-direct-agent profile is generated from the AI-authorable subset of the authoritative core TypeScript model; its direct-agent patch schema includes explicit supported null clear signals. Externally admitted importedAssets/importedModels are withheld because agents cannot inspect or fabricate their blob identity, and existing values survive proposal application. The profile has no managed-vendor optional-field ceiling. portableSchemas carry an older, narrower legacy subset. Both profiles still require document validation and do not establish building-code approval.
When artifactImport.upload is available, it contains the currently attested source formats, exact model tool schemas, required scopes and the source-first workflow. During an operational outage, artifactImport.sourceStatus may remain available so an agent can read an already-created transfer without starting or completing new work.
Read the full project and focused working set at the same revision; validate {spec, patch}; submit {patch, baseRevision}; hand the absolute reviewUrl to the user verbatim (reviewPath is the same link relative to the VerSketch origin). A 409 revision_conflict requires re-reading and rebuilding. Creation returns {projectId, proposalId, status:"pending", projectPath, reviewPath, projectUrl, reviewUrl}; edit proposals return the same links. Humans review and accept in Studio. Confirm accepted and resolved_revision before claiming the design is saved.GET/api/agent/v0/resources?kind=all|furnishings|materials&category=&query=&limit=&fields=full|compactno auth
Discover actual built-in furnishing assetKeys and material IDs with dimensions, applicability, evidenced source/license provenance, and the GLB-display versus native-box downstream representation. Arbitrary 3D file upload/import is unavailable. category (furnishing category or palette group), query (substring) and limit narrow the answer; fields=compact (the MCP default) omits per-item provenance and the source registry. counts describe the answer, totals the whole catalogue.
- No authentication. Optional ?kind=all|furnishings|materials (default all). The response is not cached because artifactFiles follows current operational readiness. MCP: list_resources.
- Optional ?category= (a furnishing category or palette group from the categories block), ?query= (case-insensitive substring, max 64 chars), ?limit=1..200 and ?fields=full|compact (REST default full; the MCP tool defaults to compact, which omits per-item sourceAsset/sourceIds/sizeKB, material nameKey/textureKey/textureSourceId and the sources registry). Unknown values answer 400 bad_resource_category/bad_resource_query/bad_resource_limit/bad_resource_fields; the category refusal lists the available names.
200 — { version, kind, units:"mm", placement, modelRepresentation, artifactFiles, sources,
furnishings:[{assetKey, kind:"model", sourceAsset, sourceIds, sizeKB,
dimensionsMm:{width,depth,height}, category?, paletteGroup?, defaultMounting, sanitaryType?}],
materials:[{materialId, nameKey, appliesTo, displayColor, textureKey?, textureSourceId?, floorFinish?, wallFinish?}],
counts, totals, filter:{category, query, limit, fields, truncated}, categories:{category:{name:count}, paletteGroup:{name:count}} }
counts describe this answer; totals always describe the whole catalogue, so a filtered page is never mistaken for everything.
The response is derived from the built-in model catalogue and core material presets. Use only listed IDs. Catalogue GLBs are display geometry; the native PlanSpec, code check, BOQ and IFC export represent each one as its dimensioned furnishing box. A catalogue GLB does not infer walls, rooms, structure, services or whole-building semantics. artifactFiles reports the current model-upload state and attested formats; unavailable means no source-file ingress is being advertised.- 400 bad_resource_kind — kind is not all, furnishings, or materials.
- 400 bad_resource_category / bad_resource_query / bad_resource_limit / bad_resource_fields — see request.
GET/api/agent/v0/capabilitiesno auth
This document: endpoints, required scopes, export formats.
- No authentication. Cache-Control: no-store; optional model-upload endpoints and formats follow current operational readiness.
200 — the machine-readable version of this page:
{
"version": "v0",
"base": "/api/agent/v0",
"auth": { "type": "oauth2_introspection", "issuer": "AIVerID", ... },
"writePolicy": "proposal_only",
"resources": "/api/agent/v0/resources",
"endpoints": [ { "method", "path", "scope", "description", "annotations" }, ... ],
"exportFormats": ["versketch.json", "dxf", "ifc", "boq.csv"],
"unavailableExportFormats": ["gltf", "step", "dae", "usdz", "pdf"],
"unavailableFormats": ["gltf", "step", "dae", "usdz", "pdf"], // deprecated export-only alias
"artifactImport": { "upload": "available" | "unavailable", "importIntoExistingProject": "proposal_only" | "unavailable", "supportedUploadFormats": [...], "limits"?: {...} },
"exportAccess": { "freeFormats": ["versketch.json"], "paidFormats": [...], ... },
"errorShape": "{ \"error\": string, \"message\": string }",
"rateLimits": {
"perSubject": "120/minute",
"validate": "30/minute",
"propose": "10/minute",
"ifcExport": "4/minute",
"ifcConcurrentPerSubject": 1,
"ifcConcurrentGlobal": 4,
"ifcMaxExecutionSeconds": 240, ...
}
}GET/api/agent/v0/profileversketch:read
Stable identity of the authenticated account.
- versketch:read scope; no parameters. MCP: get_profile. Returns the AIVerID of the account this connection acts as, in the strict shape AI hosts that list connected accounts expect.
200
{ "id": string, "nickname": string }
id is the AIVerID subject of the authenticated credentials, never the website login or browser profile, and never changes for an account. nickname is the account's AIVerID name followed by the id in brackets ("Name (id)") when the connection was granted the profile scope; otherwise its email address followed by the id ("email (id)") when it was granted the email scope; otherwise "AIVerID " followed by the id. The name is the one entered in AIVerID and is not a verified name. No other field is ever added.- 401 invalid_token — the credentials carry no usable account identity.
GET/api/agent/v0/meversketch:read
The VerSketch account this connection acts as: AIVerID, connected host, granted scopes, plan and export access, project count and the three most recently updated project names.
- versketch:read scope; no parameters. MCP: whoami. Answers which account a connection is bound to — useful after reconnecting a connector.
200
{ "aiverid": string, "accountLabel": string, "connectedVia": string | null, "scopes": string[],
"plan": { "tier": string, "exports": { "versketch.json": boolean, "dxf": boolean, "ifc": boolean, "boq.csv": boolean }, "boq": boolean },
"projects": { "count": number, "recent": [ { "id": string, "name": string, "updated_at": string } ] },
"hint": string }
aiverid is the AIVerID subject; accountLabel is the same label as the profile nickname; connectedVia is the acting host the AIVerID hub named for this grant. plan.exports and plan.boq are computed by the same gate the export and BOQ endpoints enforce, for live projects (a Paid Archive snapshot may still export what it froze). projects.count counts live, non-archived projects; recent lists at most three, most recently updated first.- 503 db_error — project store unavailable; 503 entitlement_unavailable — plan could not be read; retry shortly.
GET/api/agent/v0/projectsversketch:read
List projects owned by the token subject.
- Lists projects owned by the token subject in immutable creation order. Each summary includes its current pendingProposals count. Optional limit is an integer from 1 to 100 (default 50). Optional cursor is the opaque nextCursor from the preceding page; unknown, duplicate, or malformed query parameters are refused. Restart from the first page to include projects created during an earlier traversal.
200
{ "projects": [ { "id": string, "name": string, "created_at": string, "updated_at": string, "pendingProposals": number } ], "nextCursor": string | null }- 400 invalid_pagination — limit or cursor is invalid, duplicated, or accompanied by an unknown parameter.
- 503 db_error — project store unavailable; retry shortly.
GET/api/agent/v0/projects/:idversketch:read
Full PlanSpec + revision of one owned project.
- Returns the full PlanSpec and the current document revision.
200
{ "project": { "id", "name", "created_at", "updated_at", "pendingProposals": number }, "spec": PlanSpec, "revision": number }- 404 not_found — no such project, or the token subject does not own it (ownership is never revealed as 403).
- 503 db_error — store unavailable.
GET/api/agent/v0/projects/:id/working-set?query=versketch:read
Bounded working set in the exact shape the patch prompt consumes (64KB cap).
- Optional ?query= (at most 4,000 characters) focuses the working set on the elements relevant to that request.
- Returns the bounded context the AI patch prompt consumes (64 KB cap), so an agent sees exactly what a model would see.
200
{
"mode": "full" | "compacted",
"text": string,
"editableIds": string[],
"includedElements": number,
"totalElements": number,
"contextJsonLength": number,
"caps": { "full": number, "compact": number },
"revision": number
}- 400 query_too_long — the query exceeds 4,000 characters.
- 404 not_found — unknown or unowned project.
- 503 db_error — store unavailable or the stored spec could not be read.
POST/api/agent/v0/validateversketch:validate
Stateless document validation: {spec} or {spec, patch} → draft/deliverable/completeness verdicts; with a patch, completeness blocks only errors the patch adds (base errors listed as preExisting). This is not building-code approval; code-check needs body.region or spec.meta.regionHint and is skipped if a requested patch fails.
- Body: { "spec": PlanSpec } or { "spec": PlanSpec, "patch": PlanPatch }, optional "region" (US, CA, UK, EU, AU, TH) — 8 MiB application ceiling (the hosting ingress can be lower).
- Stateless: nothing is stored; the verdict depends only on the body.
- A broken spec is a 200 with a failing verdict — "your spec is invalid" is the answer, never a 500. Only a malformed envelope is a 400.
- The code-check summary runs only when the spec is draft-valid and a jurisdiction is known (explicit "region" or a persisted spec.meta.regionHint). VerSketch never guesses a jurisdiction.
200
{
"verdict": "pass" | "fail",
"gates": {
"draft": { "ok": boolean, "errors": string[], "truncated"?: true, "total"?: number }, // at most 20 errors; total counts them only when the scan finished, and rules listed in skippedChecks did not run
"deliverable": { "ok", "errors" } | null, // null when an earlier gate failed: not run, not passed
"completeness": { "ok", "errors" } | null
},
"patch": { "requested": boolean, "applied": boolean, "error": string | null, "truncated"?: true, "total"?: number }, // error is the first thing wrong; issues lists all of it
"codeCheck": {
"region", "regionSupported", "codeAuthority",
"summary": { "errors", "warnings", "info", "total" },
"levels": [ { "levelId", "skippedReason": "pool" | null, "skipIneligibilityReason": "pool_has_spaces" | "pool_has_openings" | null, "errors", "warnings", "info", "total" } ],
"disclaimer": string
} | null,
"codeCheckSkippedReason": "region_required" | "draft_invalid" | "patch_invalid" | null,
"measuredAreas"?: { "unit": "m2", "method", "spaces": [{ "spaceId", "levelId", "name"?, "areaMm2", "areaM2" }], "levelTotals", "total"?, "unmeasured", "listing" }, // draft-valid subject, measured as in the PDF room schedule. unmeasured gives reasons. In a refusal, area names and rows yield to design and layout examples within 19,900 UTF-8 bytes. listing counts omitted rows.
"validatedSpec": PlanSpec | null, // the merged spec when a patch applied
"advisories": [{ "code": string, "message": string }],
"subject": "candidate" | "base", // the document the gates judged: the spec, or what the patch built even if it fails; "base" when a patch operation failed so nothing was built, or the base itself is invalid
"issues": [{ "code", "path", "elementId", "stage", "message", "blockedBy"?, "relatedIds"? }], // the listed errors in structured form
"skippedGates": [{ "gate", "blockedBy" }],
"skippedChecks": [{ "code", "path", "elementId", "stage", "blockedBy" }] // rules that depend on something already reported
}
A value that is not a plan document at all (not an object, unknown schemaVersion, wrong units, or levels/walls/columns/slabs missing) returns one error and no subject, issues, skippedGates or skippedChecks.- 400 bad_body / bad_json — the envelope is not { spec } or { spec, patch }.
- 400 bad_region — region is not one of US, CA, UK, EU, AU, TH.
- 400 spec_too_deep / spec_too_large / spec_too_complex — JSON or polygon budget exceeded.
- 413 payload_too_large — body exceeds the 8 MiB application ceiling (the hosting ingress can be lower).
GET/api/agent/v0/projects/:id/boq?format=json|csvversketch:read
Bill of quantities derived from the PlanSpec. Requires a plan with export (402 export_not_included otherwise).
- Optional ?format=json|csv (default json). The bill of quantities is derived from the stored PlanSpec — the same numbers the in-app BOQ panel shows.
- Requires a plan with export: the quantities are the export, so this endpoint enforces the same entitlement as /export.
200 (json) { "items": VbmBoqItem[], "revision": number }
200 (csv) { "csv": string, "revision": number }- 400 bad_format — format is not "json" or "csv".
- 402 export_not_included — the subject plan has no export; the body carries "tier".
- 404 not_found — unknown or unowned project.
- 422 export_invalid — a specific element cannot be quantified; the message names it.
- 503 entitlement_unavailable — the plan could not be confirmed (Retry-After: 30). 503 db_error — store unavailable.
GET/api/agent/v0/projects/:id/code-check?region=versketch:read
Informational code-check report per level (with the legal disclaimer). Requires ?region= or a persisted spec.meta.regionHint; VerSketch does not guess a jurisdiction.
- Jurisdiction is required: pass ?region=US|CA|UK|EU|AU|TH or persist spec.meta.regionHint. Neither present is a 400 — building rules are never guessed.
- Informational report per level, with the mandatory legal disclaimer. A pool is returned with skippedReason: "pool" only when it has neither rooms nor door/window openings; otherwise skipIneligibilityReason names why building-room checks still run. AI flags, a licensed professional verifies, the authority having jurisdiction approves.
200
{
"region", "regionSupported", "codeAuthority", "supportedRegions",
"levels": [ {
"levelId", "skippedReason": "pool" | null, "skipIneligibilityReason": "pool_has_spaces" | "pool_has_openings" | null, "violations": CodeViolation[],
"summary": { "errors", "warnings", "info", "total" },
"roomCoverage": "none" | "partial" | "complete",
"roomDetectionTruncated": boolean
} ],
"summary": { "errors", "warnings", "info", "total" },
"disclaimer": string,
"revision": number
}- 400 region_required — no ?region= and no persisted spec.meta.regionHint.
- 400 bad_region — unsupported region value.
- 404 not_found — unknown or unowned project.
- 503 db_error — store unavailable or the engine failed.
GET/api/agent/v0/projects/:id/export?format=versketch.json|dxf|ifc|boq.csvversketch:read
Server-side export. versketch.json is the free user-owned project file; dxf, ifc, and boq.csv require a plan with export (402 export_not_included otherwise). Mesh-kernel formats (gltf/step/dae/usdz/pdf) answer 501.
- Optional ?format=versketch.json|dxf|ifc|boq.csv (default versketch.json). DXF also accepts ?level= (defaults to the first level).
- versketch.json is the free, user-owned project file on every plan. dxf, ifc and boq.csv require a plan with export.
- Mesh-kernel formats (gltf, step, dae, usdz, pdf) need the browser kernel and answer 501 in v0 — export those from the VerSketch UI.
200 (versketch.json) { "format": "versketch.json", "spec": PlanSpec, "revision": number }
200 (dxf | boq.csv) { "format", "content": string, "contentType", "skipped": SkippedElement[], "revision" }
200 (ifc) { "format": "ifc", "content": base64 string, "contentType": "application/x-step", "skipped", "revision" }- 400 bad_format — unknown format. 400 no_levels / bad_level — DXF level selection failed.
- 402 export_not_included — paid format on a plan without export; the body carries "tier".
- 404 not_found — unknown or unowned project.
- 422 export_invalid — a specific element cannot be exported; the message names it.
- 501 format_not_available_v0 — mesh-kernel format; use the UI export.
- 503 entitlement_unavailable (Retry-After: 30) / db_error.
POST/api/agent/v0/projects/:id/proposalsversketch:propose
Submit {patch, baseRevision, summary?} against an owned project. Validated through the same gates as the editor, then held as a pending proposal for a human to accept on the canvas. Never modifies the plan.
- Body: { "patch": PlanPatch, "baseRevision": integer, "summary"?: string } — 8 MiB application ceiling (the hosting ingress can be lower), summary at most 2,000 characters.
- "baseRevision" must equal the current server revision (read it from GET /projects/:id); a mismatch on a new write is a 409 revision_conflict and the agent re-reads and re-proposes. An exact replay of an operationId that already created its proposal answers for that proposal (200, replayed: true) even if the plan has been saved since.
- The patch is applied with the same grammar the in-app AI rail uses, and the merged spec must pass every validation gate before the proposal is stored.
- A proposal never touches the document. It waits as a ghost overlay until a human accepts or rejects it on the canvas. At most 10 pending proposals per project.
- The receipt states facts that do not change with time (projectId, proposalId, the baseRevision the proposal was drafted on, reviewUrl), the status as it was read, and nextPreview, the request for its picture. {tool:"get_project_preview", arguments:{id, baseRevision, proposalId, level}} is GET /api/agent/v0/projects/{id}/preview?baseRevision={baseRevision}&proposalId={proposalId}&level={level} over REST. A replay of the same operationId returns the same projectId, proposalId, baseRevision and reviewUrl; its status, and the nextPreview and agentMessage that follow from the status, are as read at the replay (a proposal the owner rejected in between replays as rejected, with no nextPreview). After a first receipt that was "unverified", a replay returns the same projectId, proposalId and reviewUrl, and baseRevision appears if the first receipt had none. The base of a proposal never changes; whether the field is present depends on whether it could be read.
- The receipt does not say whether that request will return a picture. The owner can save the plan or decide the proposal at any moment, and the preview answers for the moment it is asked: see GET /projects/:id/preview for stale_revision, stale_proposal and proposal_decided, each with its own next step. agentMessage says the same in one sentence. If the preview returns an image, show the user only that image; if it returns none, or you cannot display it, give them reviewUrl.
- nextPreview is the preview request while the status read is pending. If the new proposal was stored but could not be read back, the receipt does not say what it is now: status is "unverified", createdStatus is the "pending" this request wrote, expiresAt is absent (and so is baseRevision when the project is new), and nextPreview is {tool:"get_proposal", arguments:{id, pid}, reason:"proposal_unread"}. Read status and base_revision from GET /projects/:id/proposals/:pid and act on that status; until it reads pending, the user is never told to accept it. The baseRevision of the request is kept. A proposal read as decided has no nextPreview; the owner can open reviewUrl for its status in Studio.
- measuredAreas states the area of every Space of the plan as it would be after this proposal, measured the way Studio and its PDF room schedule measure a plan (areaM2 to two decimals, areaMm2 exact), with levelTotals and total. Quote these figures instead of working areas out, and use the totals rather than adding rows.
- measuredAreas.changes reports what the edit changes against the saved plan: {changed, summary, spaces:[{spaceId, levelId, change:"added"|"changed", beforeMm2, beforeM2, afterMm2, afterM2}], levelTotals, total}. A room whose own boundary is untouched still appears when its figures move, and a total can move with no room changed (a floor opening). An edit that changes no area answers changed:false. Changed rooms come first in spaces.
- The whole receipt, as returned, is held to 20,000 bytes of UTF-8, whatever the plan. projectId, proposalId, status, baseRevision, nextPreview, agentMessage, operationId and the links are never cut. What varies with the plan shares the rest, in this order: problems the saved plan already had, layout findings (its counts always stay; omittedAdvisoryCount says how many findings are not listed), then measuredAreas. listing counts what is listed and what is not (spaces, spacesOmitted, unmeasured, unmeasuredOmitted, changes, changesOmitted, namesOmitted): names are left out before any figure is, then rows.
- completeness.preExisting lists problems the saved plan already had (they never block an edit). Each message is at most 240 characters including the ellipsis and the list at most 4,000 bytes; preExistingClipped marks shortened messages. When some are left out, preExistingTotal is how many the saved plan has and preExistingOmitted how many are not listed (listed + omitted = total); when neither is present, the list is all of them.
- When figures are left out, listing.fullList states how many Spaces the receipt lists and how many it leaves out. Each result states how many rows it shows and how many it omits: the preview of a level states that level in report.measuredAreas within its own byte budget of 16,000 bytes, so it may contain rows this receipt left out, and a level with very many Spaces is partial there too. Use only area values a tool has returned; never work one out. reviewUrl opens Studio on the proposal: the owner inspects it there while it is pending, and afterwards sees its status and what Studio then offers. Studio's exports, the PDF room schedule among them, are made from the saved plan and are not available while a proposal is shown: they include this proposal only after the owner accepts it.
201
{ "nextPreview": { "tool": "get_project_preview", "arguments": { "id": string, "baseRevision": number, "proposalId": string, "level": string }, "show": string },
"layout": object, "completeness"?: { "preExisting": string[], "preExistingTotal"?: number, "preExistingOmitted"?: number, "preExistingClipped"?: true },
"projectId": string, "proposalId": string,
"status": "pending" | "accepted" | "rejected" | "superseded" | "expired" | "unverified", "createdStatus"?: "pending", "baseRevision": number,
"expiresAt"?: string, "agentMessage": string, "operationId": string | null,
"projectPath": string, "reviewPath": string, "projectUrl": string, "reviewUrl": string,
"measuredAreas": { "unit": "m2", "method": string, "listing": { "spaces": number, "spacesOmitted": number, "unmeasured": number, "unmeasuredOmitted": number, "namesOmitted": boolean, "fullList"?: string },
"changes": { "changed": boolean, "summary": string, "spaces": array, "levelTotals": array, "total"?: object },
"levelTotals": [{ "levelId": string, "areaMm2": number, "areaM2": number }], "total": { "areaMm2": number, "areaM2": number },
"unmeasured": [{ "spaceId"?: string, "levelId"?: string, "reason": string }],
"spaces": [{ "spaceId": string, "levelId": string, "name"?: string, "areaMm2": number, "areaM2": number }] } }- 400 bad_json / bad_body — unparseable body, missing patch, or a non-integer baseRevision.
- 400 proposal_invalid — the patch failed to apply, or the merged spec failed a gate; the message carries the per-gate errors and issues lists them in the same structure as validate.
- 400 spec_too_deep / spec_too_large / spec_too_complex — JSON or polygon budget exceeded.
- 409 revision_conflict — the document moved past baseRevision.
- 409 too_many_pending — the project already holds 10 pending proposals.
- 413 body_too_large — body exceeds the 8 MiB application ceiling (the hosting ingress can be lower).
- 404 not_found / 503 db_error.
GET/api/agent/v0/projects/:id/proposalsversketch:read
List this subject's proposals on a project with their status.
- Lists this subject’s proposals on the project — metadata and status, without the spec payloads.
200
{ "proposals": [ {
"id", "project_id", "aiverid", "base_revision", "summary",
"status": "pending" | "accepted" | "rejected" | "superseded" | "expired",
"created_at", "resolved_at", "resolved_revision"
} ] }- 404 not_found — unknown or unowned project.
- 503 db_error — store unavailable.
GET/api/agent/v0/projects/:id/proposals/:pidversketch:read
One proposal: status, base and proposed specs, resolved revision once accepted.
- One proposal with its base and proposed specs — this is how an agent learns whether the human accepted its work and at which revision it landed (resolved_revision).
- "expired" means the pending proposal aged out before anyone resolved it; nothing was merged.
200
{ ...proposal row as above, "base_spec": PlanSpec, "proposal_spec": PlanSpec }- 404 not_found — unknown project or proposal.
- 503 db_error — store unavailable.
POST/api/agent/v0/projectsversketch:propose
Create an empty project and attach {name, spec, summary?, operationId?, locale?} to it as its first pending proposal. The plan itself lands only when a human accepts. locale (BCP 47) names the empty project's starter level in the user's language.
- Body: { "name": string, "spec": PlanSpec, "summary"?: string, "operationId"?: string, "locale"?: string } — 8 MiB application ceiling (the hosting ingress can be lower).
- "name" is required, at most 200 characters. "summary" is optional, at most 2,000 characters.
- "locale" is optional: a BCP 47 language tag for the person you are working with (for example "th" or "ja-JP"). The empty project's starter level is named in that language while the proposal waits for review; a language without a VerSketch dictionary uses English, and a malformed tag is refused with bad_body.
- The spec runs the full gate chain (draft structure, deliverable, completeness) before anything is stored.
- Creates an empty project and attaches the spec as its first pending proposal. The plan itself lands only when a human accepts it on the canvas.
- If a create response is absent or times out, list projects and inspect the newest matching project before retrying. Reuse the same operationId only for the same intent.
- The receipt states facts that do not change with time (projectId, proposalId, the baseRevision the proposal was drafted on, reviewUrl), the status as it was read, and nextPreview, the request for its picture. {tool:"get_project_preview", arguments:{id, baseRevision, proposalId, level}} is GET /api/agent/v0/projects/{id}/preview?baseRevision={baseRevision}&proposalId={proposalId}&level={level} over REST. A replay of the same operationId returns the same projectId, proposalId, baseRevision and reviewUrl; its status, and the nextPreview and agentMessage that follow from the status, are as read at the replay (a proposal the owner rejected in between replays as rejected, with no nextPreview). After a first receipt that was "unverified", a replay returns the same projectId, proposalId and reviewUrl, and baseRevision appears if the first receipt had none. The base of a proposal never changes; whether the field is present depends on whether it could be read.
- The receipt does not say whether that request will return a picture. The owner can save the plan or decide the proposal at any moment, and the preview answers for the moment it is asked: see GET /projects/:id/preview for stale_revision, stale_proposal and proposal_decided, each with its own next step. agentMessage says the same in one sentence. If the preview returns an image, show the user only that image; if it returns none, or you cannot display it, give them reviewUrl.
- nextPreview is the preview request while the status read is pending. If the new proposal was stored but could not be read back, the receipt does not say what it is now: status is "unverified", createdStatus is the "pending" this request wrote, expiresAt is absent (and so is baseRevision when the project is new), and nextPreview is {tool:"get_proposal", arguments:{id, pid}, reason:"proposal_unread"}. Read status and base_revision from GET /projects/:id/proposals/:pid and act on that status; until it reads pending, the user is never told to accept it. No base is guessed. A proposal read as decided has no nextPreview; the owner can open reviewUrl for its status in Studio.
- measuredAreas states the area of every Space of the proposed plan, measured the way Studio and its PDF room schedule measure a plan (areaM2 to two decimals, areaMm2 exact), with levelTotals and total. Quote these figures instead of working areas out, and use the totals rather than adding rows. A figure that cannot be measured is listed in unmeasured with its reason.
- The whole receipt, as returned, is held to 20,000 bytes of UTF-8, whatever the plan. projectId, proposalId, status, baseRevision, nextPreview, agentMessage, operationId and the links are never cut. What varies with the plan shares the rest, in this order: layout findings (its counts always stay; omittedAdvisoryCount says how many findings are not listed), then measuredAreas. listing counts what is listed and what is not (spaces, spacesOmitted, unmeasured, unmeasuredOmitted, namesOmitted): names are left out before any figure is, then rows.
- When figures are left out, listing.fullList states how many Spaces the receipt lists and how many it leaves out. Each result states how many rows it shows and how many it omits: the preview of a level states that level in report.measuredAreas within its own byte budget of 16,000 bytes, so it may contain rows this receipt left out, and a level with very many Spaces is partial there too. Use only area values a tool has returned; never work one out. reviewUrl opens Studio on the proposal: the owner inspects it there while it is pending, and afterwards sees its status and what Studio then offers. Studio's exports, the PDF room schedule among them, are made from the saved plan and are not available while a proposal is shown: they include this proposal only after the owner accepts it.
201
{ "nextPreview": { "tool": "get_project_preview", "arguments": { "id": string, "baseRevision": number, "proposalId": string, "level": string }, "show": string },
"layout": object, "projectId": string, "proposalId": string,
"status": "pending" | "accepted" | "rejected" | "superseded" | "expired" | "unverified", "createdStatus"?: "pending", "baseRevision"?: number,
"expiresAt"?: string, "agentMessage": string, "operationId": string | null,
"projectPath": string, "reviewPath": string, "projectUrl": string, "reviewUrl": string,
"measuredAreas": { "unit": "m2", "method": string, "listing": { "spaces": number, "spacesOmitted": number, "unmeasured": number, "unmeasuredOmitted": number, "namesOmitted": boolean, "fullList"?: string },
"levelTotals": [{ "levelId": string, "areaMm2": number, "areaM2": number }], "total": { "areaMm2": number, "areaM2": number },
"unmeasured": [{ "spaceId"?: string, "levelId"?: string, "reason": string }],
"spaces": [{ "spaceId": string, "levelId": string, "name"?: string, "areaMm2": number, "areaM2": number }] } }- 400 bad_json / bad_body — unparseable body, missing name or spec, or an invalid summary.
- 400 spec_too_deep / spec_too_large / spec_too_complex — JSON or polygon budget exceeded.
- 400 proposal_invalid — the spec failed to parse or failed a validation gate; the message carries the per-gate errors and issues lists them in the same structure as validate.
- 409 project_limit — the plan tier project ceiling is reached.
- 413 body_too_large — body exceeds the 8 MiB application ceiling (the hosting ingress can be lower).
- 503 db_error — store unavailable.