Schemas

The named shapes the REST API's fields link to: every entity and model, documented once instead of repeated at every use.

66 schemasEnglish only

AccountDataExport

Everything Mercastra stores about the account and the workshops it belongs to, for portability. Workshops the account is only a member of (not the owner) are included in the same list as owned ones.

FieldTypeRequiredConstraintsDescription
userAccountDataExportUserYes-The account record as stored, minus authentication method secrets.
workshopsarray of AccountDataExportWorkshopEntryYes--
feedbackarray of AccountDataExportFeedbackYes--
authProvidersarray of AccountDataExportAuthProviderYes--

AccountDataExportAuthProvider

A linked OAuth provider identity, as stored.

FieldTypeRequiredConstraintsDescription
providerstringYesconst: "google"-
subjectstringYes--
linkedAtstringYesformat: "date-time"-

AccountDataExportEstimate

An estimate belonging to the workshop, with its saved revisions. Its PDF exports and hand-offs are not included (tracked in MR-44).

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
namestringYes--
recipientNamestringNo--
createdAtstringYesformat: "date-time"-
updatedAtstringYesformat: "date-time"-
markupPercentnumberYes--
discountPercentnumberYes--
lineItemsarray of AccountDataExportLineItemYes--
revisionsarray of AccountDataExportEstimateRevisionYes--

AccountDataExportEstimateRevision

A saved revision of an estimate, as stored.

FieldTypeRequiredConstraintsDescription
idstringYes--
revisionNumbernumberYes--
createdAtstringYesformat: "date-time"-
createdByUidstringYes--
namestringYes--
markupPercentnumberYes--
discountPercentnumberYes--
lineItemsarray of AccountDataExportLineItemYes--

AccountDataExportFeedback

One feedback or support message the account submitted.

FieldTypeRequiredConstraintsDescription
idstringYes--
kindFeedbackKindYes-Whether the message is general feedback or a support request.
titlestringYes--
messagestringYes--
emailstringYesformat: "email"-
localeUserLocaleYes-The account's UI language preference.
pathstringNo--
userAgentstringNo--
createdAtstringYesformat: "date-time"-

AccountDataExportGrid

A grid belonging to the workshop, as stored.

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
namestringYes--
iconSizestringYesenum"small""medium""large"-
createdAtstringYesformat: "date-time"-
updatedAtstringYesformat: "date-time"-
buttonsarray of AccountDataExportGridButtonYes--

AccountDataExportGridButton

One button on a grid, as stored.

FieldTypeRequiredConstraintsDescription
idstringYes--
emojistringYes--
labelstringYes--
unitstringYesenum"sqm""linear_m""piece""pair""hour""job""freeform"-
unitPricenumberYes--
backgroundColorstringNo--
iconFileIdstringNo--

AccountDataExportLineItem

One line item on an estimate or one of its revisions, as stored.

FieldTypeRequiredConstraintsDescription
idstringYes--
labelstringYes--
unitstringYesenum"sqm""linear_m""piece""pair""hour""job""freeform"-
unitPricenumberYes--
quantitynumberYes--
sourceButtonIdstringNo--

AccountDataExportOrder

An order belonging to the workshop, as stored.

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
titlestringYes--
customerNamestringYes--
notesstringYes--
statusOrderStatusYes-An order's stage, always one of these three values in this order: todo, in_progress, done.
createdAtstringYesformat: "date-time"-
lastActivityAtstringYesformat: "date-time"-
statusHistoryarray of OrderStatusHistoryEntryYes--

AccountDataExportUser

The account record as stored, minus authentication method secrets.

FieldTypeRequiredConstraintsDescription
uidstringYes--
emailstringYesformat: "email"-
namestringYes--
statusstringYesenum"pending""active""suspended""deleted"-
emailVerifiedAtstring | nullYes--
termsVersionstringNo--
termsAcceptedAtstringNoformat: "date-time"-
lastLoginAtstringNoformat: "date-time"-
localeUserLocaleNo-The account's UI language preference.

AccountDataExportWorkshop

A workshop the account owns or belongs to, as stored: unlike the public Workshop resource this includes the raw billing ids and the AI rate-limit attempt timestamps, since this endpoint exports the record as kept, not the trimmed member-facing view.

FieldTypeRequiredConstraintsDescription
idstringYes--
namestringYes--
taglinestringYes--
logostringYes--
crafterNamestringYes--
crafterAvatarSeedstringYes--
backgroundBackgroundYes-A preset background id for the workshop's poster. The id → CSS mapping is owned by the frontend.
customBackgroundWorkshopCustomBackgroundNo-A freeform solid or gradient background overriding the preset `background` id, or null for no override.
titleFontTitleFontYes-A preset title font id for the workshop's poster. The id → font mapping is owned by the frontend.
accentColorHexColor | nullNo--
planWorkshopPlanNo-The workshop's resolved plan; an expired time-boxed Pro reads back as free.
planExpiresAtstring | nullNo--
planSourceWorkshopPlanSource | nullNo--
billingCustomerIdstringNo--
billingSubscriptionIdstring | nullNo--
billingCancelAtPeriodEndbooleanNo--
contextWorkshopContextNo-The workshop's context notes as stored: free text describing the workshop and the moment the server last saved them.
contextDerivedWorkshopContextDerivedNo-The AI-synthesized summary and suggested intents distilled from the workshop's context notes.
contextSynthesisAttemptsarray of stringNo--
messageDraftAttemptsarray of stringNo--
isDefaultbooleanYes--
createdAtstringYesformat: "date-time"-

AccountDataExportWorkshopEntry

One owned or joined workshop and everything in it.

FieldTypeRequiredConstraintsDescription
workshopAccountDataExportWorkshopYes-A workshop the account owns or belongs to, as stored: unlike the public Workshop resource this includes the raw billing ids and the AI rate-limit attempt timestamps, since this endpoint exports the record as kept, not the trimmed member-facing view.
gridsarray of AccountDataExportGridYes--
estimatesarray of AccountDataExportEstimateYes--
ordersarray of AccountDataExportOrderYes--

AuthenticatedUser

The signed-in account, as returned by the endpoint that grants the session.

FieldTypeRequiredConstraintsDescription
uidstringYes--
emailstringYesformat: "email"-
namestringYes--
localeUserLocaleYes-The account's UI language preference.

AuthenticateResponse

FieldTypeRequiredConstraintsDescription
userAuthenticatedUserYes-The signed-in account, as returned by the endpoint that grants the session.

Background

A preset background id for the workshop's poster. The id → CSS mapping is owned by the frontend.

string
enum"paper""linen""sage""mist""blush""indigo""forest""plum""terracotta""charcoal""astral""ember""meadow""dusk""tide""orchid""copper""aurora""dawn""cloud"

DocumentLocale

The language a generated estimate PDF or hand-off message is written in: pl (Polish) or en (English).

string
enum"pl""en"

Emoji

One emoji from Mercastra's curated icon set (see EMOJI_CATEGORIES).

string
minLength: 1

Estimate

An estimate as returned to a member. Confirming it (see the confirm endpoint) snapshots this content into a new revision; nothing about the estimate itself records whether it has ever been confirmed.

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
namestringYes--
recipientNamestringNo-Absent when the estimate has no named recipient
createdAtstringYesformat: "date-time"-
updatedAtstringYesformat: "date-time"-
markupPercentnumberYes--
discountPercentnumberYes--
lineItemsarray of LineItemYes--

EstimateConfirmation

FieldTypeRequiredConstraintsDescription
estimateEstimateYes-An estimate as returned to a member. Confirming it (see the confirm endpoint) snapshots this content into a new revision; nothing about the estimate itself records whether it has ever been confirmed.
revisionEstimateRevisionYes-A snapshot of an estimate's content at the moment it was confirmed, numbered from 1.

EstimateRevision

A snapshot of an estimate's content at the moment it was confirmed, numbered from 1.

FieldTypeRequiredConstraintsDescription
idstringYes--
revisionNumbernumberYes--
createdAtstringYesformat: "date-time"-
createdByUidstringYes--
namestringYes--
markupPercentnumberYes--
discountPercentnumberYes--
lineItemsarray of LineItemYes--

EstimateRevisionsList

FieldTypeRequiredConstraintsDescription
revisionsarray of EstimateRevisionYes--

EstimatesList

FieldTypeRequiredConstraintsDescription
estimatesarray of EstimateYes--

FeedbackKind

Whether the message is general feedback or a support request.

string
enum"feedback""support"

FileCategory

What a file is used for. Decides the accepted content types and any per-file size cap: grid_tile_icon (an image attached to a grid button, up to 512 KB) or estimate_pdf (a generated estimate PDF, no per-file cap).

string
enum"grid_tile_icon""estimate_pdf"

FileRecord

A stored file's metadata. Omits the internal GCS storage path; download the bytes through GET /files/{fileId}.

FieldTypeRequiredConstraintsDescription
idstringYes--
scopeFileScopeYes-The kind of resource a file is authorized against: workshop or estimate. Both categories accepted by POST /files resolve to workshop; estimate-scoped files are created by other endpoints, not this one.
scopeIdstringYes--
categoryFileCategoryYes-What a file is used for. Decides the accepted content types and any per-file size cap: grid_tile_icon (an image attached to a grid button, up to 512 KB) or estimate_pdf (a generated estimate PDF, no per-file cap).
namestringNo--
contentTypestringYes--
sizeBytesintegerYesminimum: -9007199254740991maximum: 9007199254740991-
uploadedByUidstringYes--
createdAtstringYesformat: "date-time"-
estimateIdstringNo-Set only for files created against an estimate scope.

FileScope

The kind of resource a file is authorized against: workshop or estimate. Both categories accepted by POST /files resolve to workshop; estimate-scoped files are created by other endpoints, not this one.

string
enum"estimate""workshop"

FilesList

FieldTypeRequiredConstraintsDescription
filesarray of FileRecordYes--

Grid

A grid as returned to a member: a named board of priceable buttons, capped at 10 per workshop.

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
namestringYes--
iconSizeGridIconSizeYes-A grid's icon size, one of these three values.
createdAtstringYesformat: "date-time"-
updatedAtstringYesformat: "date-time"-
buttonsarray of GridButtonYes--

GridButton

One priceable button on a grid. unit and unitPrice become the sourceButtonId'd line item's defaults when added to an estimate.

FieldTypeRequiredConstraintsDescription
idstringYes--
emojiEmojiYes-One emoji from Mercastra's curated icon set (see EMOJI_CATEGORIES).
labelstringYes--
unitLineItemUnitYes-A line item's unit of measure, one of these seven values.
unitPricenumberYes--
backgroundColorHexColorNo-Absent when the button has no background override
iconFileIdstringNo-Id of a file uploaded through POST /files with category grid_tile_icon. Absent when the button has no icon.

GridIconInUse

The ids of every grid in the workshop with a button still referencing this icon.

FieldTypeRequiredConstraintsDescription
gridIdsarray of stringYes--

GridIconSize

A grid's icon size, one of these three values.

string
enum"small""medium""large"

GridsList

FieldTypeRequiredConstraintsDescription
gridsarray of GridYes--

GridTemplate

A named starting set of catalog items for one domain, ready to turn into a grid's buttons.

FieldTypeRequiredConstraintsDescription
slugstringYes--
domainSlugstringYes-References a PredefinedItemDomain's slug, by string match, not enforced
nameLocalizedTextYes-The same text in English and Polish.
descriptionLocalizedTextYes-The same text in English and Polish.
itemIdsarray of stringYes-References PredefinedGridItem ids, by string match, not enforced

Handoff

A record that an estimate was handed off to its recipient somehow - not the message or PDF itself, just that it happened, when, how and in what tone.

FieldTypeRequiredConstraintsDescription
idstringYes--
kindHandoffKindYes-How a crafter delivered an estimate to its recipient, one of these five values: message-copied, message-shared, pdf-shared, pdf-and-message-shared or email-opened. Caller-supplied and not verified against anything that actually happened, see the hand-off endpoint's own description.
localeDocumentLocaleYes-The language a generated estimate PDF or hand-off message is written in: pl (Polish) or en (English).
preliminarybooleanYes--
toneMessageToneYes-The tone of a hand-off message, formal or friendly. Recorded on every hand-off regardless of aiDrafted, not just ones whose text came from the AI draft endpoint.
aiDraftedbooleanYes-Whether the delivered message text came from POST .../message-draft rather than being hand-written.
revisionNumbernumberYes-The estimate's latest revision number at the time of hand-off.
createdAtstringYesformat: "date-time"-
createdByUidstringYes--
pdfExportIdstringNo-The pdf export this hand-off refers to, when one was involved. Absent otherwise.

HandoffKind

How a crafter delivered an estimate to its recipient, one of these five values: message-copied, message-shared, pdf-shared, pdf-and-message-shared or email-opened. Caller-supplied and not verified against anything that actually happened, see the hand-off endpoint's own description.

string
enum"message-copied""message-shared""pdf-shared""pdf-and-message-shared""email-opened"

HandoffsList

FieldTypeRequiredConstraintsDescription
handoffsarray of HandoffYes--

HexColor

A #RRGGBB hex color.

string
pattern: "^#[0-9A-Fa-f]{6}
quot;

LineItem

One priced line on an estimate.

FieldTypeRequiredConstraintsDescription
idstringYes--
labelstringYes--
unitLineItemUnitYes-A line item's unit of measure, one of these seven values.
unitPricenumberYes--
quantitynumberYes--
sourceButtonIdstringNo-The grid button this line item was added from, when it was. Not validated on write.

LineItemUnit

A line item's unit of measure, one of these seven values.

string
enum"sqm""linear_m""piece""pair""hour""job""freeform"

LocalizedText

The same text in English and Polish.

FieldTypeRequiredConstraintsDescription
enstringYes--
plstringYes--

MeProfile

The signed-in account's own profile.

FieldTypeRequiredConstraintsDescription
namestringYes--
emailstringYesformat: "email"-
localeUserLocaleYes-The account's UI language preference.
signInMethodsarray of SignInMethodYes--

MessageTone

The tone of a hand-off message, formal or friendly. Recorded on every hand-off regardless of aiDrafted, not just ones whose text came from the AI draft endpoint.

string
enum"formal""friendly"

MostUsedLineItemsList

FieldTypeRequiredConstraintsDescription
lineItemsarray of objectYes--
lineItems[].labelstringYes--
lineItems[].unitLineItemUnitYes-A line item's unit of measure, one of these seven values.
lineItems[].unitPricenumberYes--
lineItems[].countnumberYes-How many of the workshop's estimates use a line item with this label and unit
lineItems[].lastUsedAtstringYesformat: "date-time"The updatedAt of the most recent estimate that uses it

Order

An order as returned to a member: title, customer name and notes are edited in place through this same shape, status changes are recorded in statusHistory.

FieldTypeRequiredConstraintsDescription
idstringYes--
workshopIdstringYes--
titlestringYes--
customerNamestringYes-Blank when the order has no named customer
notesstringYes--
statusOrderStatusYes-An order's stage, always one of these three values in this order: todo, in_progress, done.
createdAtstringYesformat: "date-time"-
lastActivityAtstringYesformat: "date-time"-
statusHistoryarray of OrderStatusHistoryEntryYes--

OrdersList

FieldTypeRequiredConstraintsDescription
ordersarray of OrderYes--

OrderStatus

An order's stage, always one of these three values in this order: todo, in_progress, done.

string
enum"todo""in_progress""done"

OrderStatusHistoryEntry

One entry in an order's status history: the status it moved to and when.

FieldTypeRequiredConstraintsDescription
statusOrderStatusYes-An order's stage, always one of these three values in this order: todo, in_progress, done.
atstringYesformat: "date-time"-

PdfExport

Metadata for one generated estimate PDF; this shape never carries the file's bytes, download them with GET /estimates/{estimateId}/pdf-exports/{pdfExportId}.

FieldTypeRequiredConstraintsDescription
idstringYes--
revisionNumbernumberYes-The estimate's latest revision number at the time of export.
togglesPdfExportOptionsYes-The visual toggles for a generated estimate PDF, each defaulting server-side when omitted.
generatedAtstringYesformat: "date-time"-
createdByUidstringYes--
localeDocumentLocaleNo-Absent only on a pdf export generated before locale was tracked.
preliminarybooleanNo-Absent only on a pdf export generated before preliminary was tracked.

PdfExportOptions

The visual toggles for a generated estimate PDF, each defaulting server-side when omitted.

FieldTypeRequiredConstraintsDescription
breakdownbooleanYesdefault: trueInclude the itemized line-item breakdown table.
showMarkupbooleanYesdefault: falseShow the markup percentage and amount.
showDiscountbooleanYesdefault: falseShow the discount percentage and amount.
showRecipientbooleanYesdefault: trueShow the recipient's name.
showBrandMarkbooleanYesdefault: trueShow Mercastra's brand mark. A workshop whose plan cannot disable it (see entitlements) has this forced back to true server-side regardless of what is sent.

PdfExportsList

FieldTypeRequiredConstraintsDescription
pdfExportsarray of PdfExportYes--

PredefinedGridItem

One reference item a grid button can be built from: a label, a default unit and free-text tags.

FieldTypeRequiredConstraintsDescription
idstringYes--
emojiEmojiYes-One emoji from Mercastra's curated icon set (see EMOJI_CATEGORIES).
labelLocalizedTextYes-The same text in English and Polish.
unitLineItemUnitYes-A line item's unit of measure, one of these seven values.
tagsarray of stringYes--

PredefinedItemDomain

One craft domain grouping catalog items and templates, for example woodworking-and-carpentry.

FieldTypeRequiredConstraintsDescription
slugstringYes--
labelLocalizedTextYes-The same text in English and Polish.

PredefinedItemsCatalog

FieldTypeRequiredConstraintsDescription
itemsarray of PredefinedGridItemYes--
domainsarray of PredefinedItemDomainYes--
templatesarray of GridTemplateYes--

SignInMethod

A way the account can authenticate: a password, or a linked OAuth provider.

string
enum"password""google"

TitleFont

A preset title font id for the workshop's poster. The id → font mapping is owned by the frontend.

string
enum"sans""serif""didone""mono""rounded"

UserLocale

The account's UI language preference.

string
enum"en""pl"

Workshop

A workshop as returned to a member: billing ids and AI rate-limit attempt lists are stripped, the plan is already resolved for expiry.

FieldTypeRequiredConstraintsDescription
idstringYes--
namestringYes--
taglinestringYes--
logostringYes-One emoji from the curated icon set
crafterNamestringYes--
crafterAvatarSeedstringYes--
backgroundBackgroundYes-A preset background id for the workshop's poster. The id → CSS mapping is owned by the frontend.
customBackgroundWorkshopCustomBackgroundNo-A freeform solid or gradient background overriding the preset `background` id, or null for no override.
titleFontTitleFontYes-A preset title font id for the workshop's poster. The id → font mapping is owned by the frontend.
accentColorHexColor | nullNo--
planWorkshopPlanYes-The workshop's resolved plan; an expired time-boxed Pro reads back as free.
planExpiresAtstring | nullNo-Set while `plan` is a time-boxed Pro (a trial or a paid subscription's current period); null on a permanent plan
planSourceWorkshopPlanSource | nullNo--
contextWorkshopContextNo-The workshop's context notes as stored: free text describing the workshop and the moment the server last saved them.
contextDerivedWorkshopContextDerivedNo-The AI-synthesized summary and suggested intents distilled from the workshop's context notes.
isDefaultbooleanYes--
membersarray of WorkshopMemberYes--
createdAtstringYesformat: "date-time"-

WorkshopBilling

FieldTypeRequiredConstraintsDescription
hasAccountbooleanYes-True once a payment-provider customer exists for the workshop
planSourceWorkshopPlanSource | nullYes--
cancelAtPeriodEndbooleanYes-True only for a subscription the customer already canceled at the provider
checkoutAvailabilitystringYesenum"available""pro_purchase_disabled""payments_not_configured"-

WorkshopContext

The workshop's context notes as stored: free text describing the workshop and the moment the server last saved them.

FieldTypeRequiredConstraintsDescription
notesstringYes--
updatedAtstringYesformat: "date-time"-

WorkshopContextDerived

The AI-synthesized summary and suggested intents distilled from the workshop's context notes.

FieldTypeRequiredConstraintsDescription
summaryLocalizedTextYes-At most 400 characters per language
suggestedIntentsobjectYesadditionalProperties: false3 to 5 entries per language, at most 80 characters each
suggestedIntents.enarray of stringYes--
suggestedIntents.plarray of stringYes--
sourceUpdatedAtstringYesformat: "date-time"The `context.updatedAt` this was derived from
generatedAtstringYesformat: "date-time"-

WorkshopCustomBackground

A freeform solid or gradient background overriding the preset `background` id, or null for no override.

object | object | null
-

WorkshopEntitlementsUsage

The workshop's plan entitlements and current quota usage, derived from stored state only.

FieldTypeRequiredConstraintsDescription
planWorkshopPlanYes-The workshop's resolved plan; an expired time-boxed Pro reads back as free.
planExpiresAtstring | nullYes--
brandMarkobjectYesadditionalProperties: false-
brandMark.canDisablebooleanYes--
fileStorageobjectYesadditionalProperties: false-
fileStorage.usedBytesnumberYes--
fileStorage.limitBytesnumberYes--
revisionsobjectYesadditionalProperties: falsenull means unlimited (Pro); the value is per estimate, it carries no usage counter
revisions.limitPerEstimatenumber | nullYes--
billingWorkshopBillingYes--

WorkshopMember

A workshop member, resolved from its membership record.

FieldTypeRequiredConstraintsDescription
idstringYes-The member's user id
namestringYes--
avatarSeedstringYes--
rolestringYesenum"owner""member"-

WorkshopPlan

The workshop's resolved plan; an expired time-boxed Pro reads back as free.

string
enum"free""pro"

WorkshopPlanSource

What granted the current Pro plan: a founder CLI grant, the mocked self-serve trial, or a paid subscription.

string
enum"grant""trial""subscription"

WorkshopsList

FieldTypeRequiredConstraintsDescription
workshopsarray of WorkshopYes--