{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postedly-com/json-schema/postedly-com-quote-schema.json",
  "title": "Quote",
  "description": "Immutable quote, normally valid for 20 minutes. The document is the final proof (including any fax cover or mail layout), which may differ from the uploaded file. Review this proof and the normalized contact/options snapshot. No approval, order or payment is created. Omitted optional properties are not null.",
  "x-generated": "2026-11-21",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/postedly-com-api-openapi.json#/components/schemas/Quote",
  "type": "object",
  "required": [
    "id",
    "service",
    "amountCents",
    "currency",
    "lineItems",
    "expiresAt",
    "estimatedDelivery",
    "summary",
    "recipient",
    "sender",
    "options"
  ],
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Use as quoteId for the review link or explicitly approved checkout."
    },
    "service": {
      "$ref": "#/$defs/Service"
    },
    "amountCents": {
      "type": "integer",
      "minimum": 0,
      "description": "Amount in integer US cents; never a floating-point dollar amount."
    },
    "underReview": {
      "type": "boolean",
      "description": "Present and true when the quote is paused for a routine review before payment. It cannot be approved until released; nothing is charged."
    },
    "reviewMessage": {
      "type": "string",
      "description": "Calm wording to show the person when underReview is true."
    },
    "currency": {
      "type": "string",
      "const": "USD"
    },
    "lineItems": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/LineItem"
      }
    },
    "expiresAt": {
      "type": "string",
      "format": "date-time"
    },
    "estimatedDelivery": {
      "type": "string",
      "description": "Provider estimate, not guaranteed arrival."
    },
    "summary": {
      "type": "string"
    },
    "document": {
      "$ref": "#/$defs/Document"
    },
    "recipient": {
      "$ref": "#/$defs/Contact"
    },
    "sender": {
      "$ref": "#/$defs/Contact"
    },
    "options": {
      "type": "object",
      "additionalProperties": true,
      "description": "Saved, provider-validated options for this quote."
    },
    "handwritten": {
      "$ref": "#/$defs/HandwrittenReview"
    },
    "addressWarnings": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AddressWarning"
      }
    }
  },
  "$defs": {
    "AddressWarning": {
      "type": "object",
      "required": [
        "role",
        "code",
        "message",
        "address"
      ],
      "description": "Immutable warning for one explicitly selected send-as-entered postal address. The browser review must obtain separate address-risk acceptance before payment.",
      "properties": {
        "role": {
          "type": "string",
          "enum": [
            "recipient",
            "sender"
          ]
        },
        "code": {
          "type": "string",
          "enum": [
            "address_unit_required",
            "address_unverified"
          ]
        },
        "message": {
          "type": "string"
        },
        "address": {
          "$ref": "#/$defs/Contact"
        }
      }
    },
    "Contact": {
      "type": "object",
      "required": [
        "name"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string",
          "format": "email"
        },
        "fax": {
          "type": "string"
        },
        "phone": {
          "type": "string"
        },
        "address1": {
          "type": "string"
        },
        "address2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "state": {
          "type": "string"
        },
        "postalCode": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "default": "US"
        }
      }
    },
    "Document": {
      "type": "object",
      "required": [
        "id",
        "name",
        "pages",
        "bytes",
        "sha256",
        "contentType",
        "previewUrl"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "Use this value as documentId in a quote; the person does not need to copy it."
        },
        "name": {
          "type": "string",
          "maxLength": 180
        },
        "pages": {
          "type": "integer",
          "minimum": 1,
          "description": "Inspected page count; images count as one. Upload PDFs allow up to 50 pages; service-specific quote limits can be lower."
        },
        "bytes": {
          "type": "integer",
          "minimum": 1,
          "maximum": 10485760
        },
        "sha256": {
          "type": "string",
          "pattern": "^[a-f0-9]{64}$",
          "description": "Server-computed SHA-256 of the stored raw file bytes."
        },
        "contentType": {
          "type": "string",
          "enum": [
            "application/pdf",
            "image/jpeg",
            "image/png"
          ],
          "description": "Detected media type, not a trusted client declaration."
        },
        "previewUrl": {
          "type": "string",
          "format": "uri-reference",
          "description": "Private preview. Standard document URLs require the same owner’s bearer token; capability-scoped handoff URLs require their unexpired ticket. Resolve relative URLs against this API origin. Never make the file public to show a preview."
        },
        "coverPage": {
          "type": "string",
          "enum": [
            "mail-address",
            "fax-cover"
          ],
          "description": "An added first page in the final proof. Content pages follow it; an ordinary upload or postcard has no added cover label."
        }
      }
    },
    "HandwrittenReview": {
      "type": "object",
      "required": [
        "cardId",
        "cardName",
        "cardImageUrl",
        "fontId",
        "fontLabel",
        "fontImageUrl",
        "message",
        "wishes",
        "sender",
        "recipient",
        "previewKind",
        "stampOptionId",
        "stampName"
      ],
      "description": "Immutable quoted card, handwriting style, exact text, postal addresses and postage option. Images are design/style samples, not a rendered final-message proof.",
      "properties": {
        "cardId": {
          "type": "string",
          "pattern": "^[1-9]\\d{0,14}$"
        },
        "cardName": {
          "type": "string"
        },
        "cardImageUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "fontId": {
          "type": "string"
        },
        "fontLabel": {
          "type": "string"
        },
        "fontImageUrl": {
          "type": "string",
          "format": "uri",
          "pattern": "^https://"
        },
        "message": {
          "type": "string",
          "minLength": 1,
          "maxLength": 1000
        },
        "wishes": {
          "type": "string",
          "maxLength": 200
        },
        "sender": {
          "$ref": "#/$defs/Contact"
        },
        "recipient": {
          "$ref": "#/$defs/Contact"
        },
        "previewKind": {
          "type": "string",
          "const": "design_and_style_samples"
        },
        "stampOptionId": {
          "type": "integer"
        },
        "stampName": {
          "type": "string"
        }
      }
    },
    "LineItem": {
      "type": "object",
      "required": [
        "label",
        "amountCents"
      ],
      "properties": {
        "label": {
          "type": "string"
        },
        "amountCents": {
          "type": "integer",
          "minimum": 0,
          "description": "Amount in integer US cents; never a floating-point dollar amount."
        }
      }
    },
    "Service": {
      "type": "string",
      "enum": [
        "fax",
        "letter",
        "certified",
        "postcard",
        "handwritten"
      ],
      "description": "Services accepted by the document/card quote APIs."
    }
  }
}