{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/postedly-com/json-schema/postedly-com-quote-request-schema.json",
  "title": "QuoteRequest",
  "description": "Handwritten cards use an exact catalog card, handwriting style, message and optional closing, with complete US sender and recipient addresses. No PDF upload is required. Catalog character limits apply to the exact raw text.",
  "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/QuoteRequest",
  "type": "object",
  "required": [
    "service",
    "recipient",
    "sender"
  ],
  "allOf": [
    {
      "if": {
        "properties": {
          "service": {
            "const": "handwritten"
          }
        },
        "required": [
          "service"
        ]
      },
      "then": {
        "required": [
          "options"
        ],
        "properties": {
          "options": {
            "type": "object",
            "required": [
              "productId",
              "fontLabel",
              "message"
            ],
            "additionalProperties": false,
            "properties": {
              "promoCode": {
                "type": "string",
                "maxLength": 40,
                "description": "Optional discount code. HOLIDAY takes $1 off an eligible holiday handwritten card or composed holiday postcard before tax through December 31, 2026 Pacific time."
              },
              "productId": {
                "type": "string",
                "pattern": "^[1-9]\\d{0,14}$"
              },
              "fontLabel": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100
              },
              "message": {
                "type": "string",
                "minLength": 1,
                "maxLength": 1000,
                "pattern": "\\S"
              },
              "wishes": {
                "type": "string",
                "maxLength": 200,
                "default": ""
              },
              "quantity": {
                "type": "integer",
                "const": 1
              }
            },
            "description": "The selected card’s catalog limits are authoritative. Raw message.length plus wishes.length must fit combinedCharacterLimit, never above 1000. Plain text only; signature codes, QR codes and template substitutions are not supported."
          },
          "sender": {
            "type": "object",
            "required": [
              "name",
              "address1",
              "city",
              "state",
              "postalCode",
              "country"
            ],
            "properties": {
              "country": {
                "const": "US"
              }
            },
            "description": "When email is omitted, the connected account’s verified email is used; unverified sessions must supply it."
          },
          "recipient": {
            "type": "object",
            "required": [
              "name",
              "address1",
              "city",
              "state",
              "postalCode",
              "country"
            ],
            "properties": {
              "country": {
                "const": "US"
              }
            }
          }
        }
      },
      "else": {
        "properties": {
          "options": {
            "properties": {
              "message": {
                "type": "string",
                "maxLength": 500
              }
            }
          }
        }
      }
    }
  ],
  "properties": {
    "service": {
      "type": "string",
      "enum": [
        "fax",
        "letter",
        "certified",
        "postcard",
        "handwritten"
      ]
    },
    "documentId": {
      "type": "string",
      "format": "uuid",
      "description": "The id returned by an upload owned by this same session/OAuth connection. Required for document channels; handwritten cards do not require an upload."
    },
    "recipient": {
      "$ref": "#/$defs/Contact"
    },
    "sender": {
      "allOf": [
        {
          "$ref": "#/$defs/Contact"
        }
      ],
      "description": "Omit email to reuse the current connected account’s verified email. An unverified session must supply email and complete verification before checkout. Explicit values are never overwritten. Sender name and service-specific return/billing address remain required."
    },
    "options": {
      "type": "object",
      "additionalProperties": true,
      "properties": {
        "promoCode": {
          "type": "string",
          "maxLength": 40,
          "description": "Optional discount code. HOLIDAY takes $1 off an eligible holiday handwritten card or composed holiday postcard before tax through December 31, 2026 Pacific time."
        },
        "sendAsEntered": {
          "type": "object",
          "additionalProperties": false,
          "properties": {
            "recipient": {
              "type": "boolean"
            },
            "sender": {
              "type": "boolean"
            }
          },
          "description": "PostGrid postal mail only. Requests an exact-address quote for an address that failed live verification, set separately for each role. Does not grant approval; the delivery risk shown in addressWarnings is accepted only on the secure approval page before payment."
        },
        "productId": {
          "type": "string",
          "description": "Exact product id returned by the current product catalog."
        },
        "fontLabel": {
          "type": "string",
          "minLength": 1,
          "maxLength": 100,
          "description": "Handwritten cards only. Exact label from the selected card’s options.handwritingStyles; a style ID is not a substitute for this label."
        },
        "wishes": {
          "type": "string",
          "maxLength": 200,
          "default": "",
          "description": "Handwritten cards only. Exact optional closing. Raw message.length + wishes.length must not exceed the card’s options.combinedCharacterLimit; no separator is added to this count."
        },
        "quantity": {
          "type": "integer",
          "const": 1,
          "description": "One selected item per order."
        },
        "message": {
          "type": "string",
          "maxLength": 1000,
          "description": "Exact personal message. Handwritten cards require nonempty text, at most options.maxMessageLength (never above 1000), with message plus wishes within options.combinedCharacterLimit."
        }
      }
    }
  },
  "$defs": {
    "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"
        }
      }
    }
  }
}