{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/thanks-io/json-schema/thanks-io-send-mailer-base-schema.json",
  "title": "send-mailer-base",
  "x-generated": "2026-10-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/thanks-io-openapi.json#/components/schemas/send-mailer-base",
  "type": "object",
  "properties": {
    "preview": {
      "type": "boolean",
      "description": "Set to true to return a preview instead of sending the mail piece. You can use this with any send call to inspect the output before submitting the order. On the Free and Business plans, preview images carry a DRAFT watermark; the mail you send never does. Professional and Enterprise previews have no watermark."
    },
    "mailing_list_ids": {
      "type": "array",
      "description": "Mailing list IDs to send to. Required if `recipients` and `radius_search` are not provided.",
      "items": {
        "type": "integer"
      }
    },
    "recipients": {
      "type": "array",
      "description": "Recipients to send to. Required if `mailing_list_ids` and `radius_search` are not provided.",
      "items": {
        "$ref": "#/$defs/recipient-create-no-mailinglist"
      }
    },
    "radius_search": {
      "type": "object",
      "description": "Use a radius search to find recipients near an address. Required if `mailing_list_ids` and `recipients` are not provided. Lookup fees are $0.05 per record.",
      "properties": {
        "preview": {
          "type": "boolean",
          "description": "Return a preview of the number of matching recipients and the estimated cost.",
          "default": false
        },
        "address": {
          "type": "string",
          "description": "Full street address to use as the center point of the nearest-neighbor search."
        },
        "record_count": {
          "type": "integer",
          "description": "Number of nearby records to return.",
          "minimum": 1,
          "maximum": 10000
        },
        "record_types": {
          "type": "string",
          "description": "Record type to search for",
          "enum": [
            "all",
            "likelytomove",
            "likelytorefi",
            "absenteeowner",
            "highnetworth",
            "majorityhomeequity",
            "homefreeclear",
            "underwater",
            "kidsinhousehold",
            "newhomeowner",
            "firsttimehomebuyer",
            "renters",
            "retiring",
            "retired",
            "pool",
            "onlybusinesses",
            "newbusiness"
          ],
          "default": "all"
        },
        "include_condos": {
          "type": "boolean",
          "description": "Include condos in search.",
          "default": false
        },
        "append_data": {
          "type": "boolean",
          "description": "Append phone and email to each record for an additional fee ($.20 per record).",
          "default": false
        },
        "use_property_owner": {
          "type": "boolean",
          "description": "Use the property owner's address when searching commercial records.",
          "default": false
        },
        "include_search_address": {
          "type": "boolean",
          "description": "Set to true to include the search address in the generated mailing list."
        }
      }
    },
    "handwriting_style_id": {
      "type": "integer",
      "description": "ID of handwriting style to use."
    },
    "handwriting_color": {
      "type": "string",
      "description": "Handwriting color to use. Options are preset named colors or specified as hex format, such as '#4287f5'",
      "enum": [
        "blue",
        "black",
        "green",
        "purple",
        "red"
      ]
    },
    "handwriting_realism": {
      "type": "boolean",
      "description": "Set to true to enable the realism effect for AI fonts."
    },
    "sub_account": {
      "type": "integer",
      "description": "Sub-account ID to use for this order."
    },
    "notification_emails": {
      "type": "string",
      "description": "Optional comma-separated list of email addresses to notify about order events such as QR scan notifications."
    },
    "email_lookup": {
      "type": "boolean",
      "description": "Whether a recipient given an `email` but no street address has their postal address looked up from the email. Each address found is charged as an Email to Address lookup. Defaults to `true`. Set to `false` to skip the lookup: recipients without a street address are then left out of the order, which mails only the recipients that have one. Estimates never run the lookup and price such recipients as if found.",
      "default": true
    },
    "postage_class": {
      "type": "string",
      "description": "Postage class for this order. `first_class` mails First Class. `standard` mails Standard Mail (also known as Marketing Mail): lower cost for US addresses and slower to deliver, with no tracking status and no return-to-sender. Omit it to use your account's default, set with Standard Mail Mode under Settings > Mail Preferences. Standard Mail only changes the price of US addresses. Nonprofit accounts always mail at their nonprofit rate. `standard` needs a paid plan: free plan accounts always mail First Class, and `standard` from one is rejected with a 422.",
      "enum": [
        "first_class",
        "standard"
      ]
    },
    "return_name": {
      "type": "string",
      "description": "Custom return name for the order."
    },
    "return_address": {
      "type": "string",
      "description": "Custom return address for the order."
    },
    "return_address2": {
      "type": "string",
      "description": "Custom return address line 2 for the order."
    },
    "return_city": {
      "type": "string",
      "description": "Custom return city for the order."
    },
    "return_state": {
      "type": "string",
      "description": "Custom return state/province for the order."
    },
    "return_postal_code": {
      "type": "string",
      "description": "Custom return postal code for the order."
    },
    "metadata": {
      "type": [
        "object",
        "null"
      ],
      "description": "Your own key/value data to store with the order. It is returned unchanged by the order endpoints and included in every webhook event for the order as `order.metadata`. Must be a JSON object rather than an array, and no larger than 8,192 bytes once encoded as JSON. thanks.io does not print or otherwise act on these values.",
      "additionalProperties": true
    }
  },
  "$defs": {
    "absentee-address": {
      "type": "string",
      "description": "The property (absentee) address for this recipient, such as a house an absentee owner owns, as opposed to where they get mail. Give either the whole address here, or the street line here with `absentee_city`, `absentee_province` and `absentee_postal_code`. When set, the `~ABSENTEE_STREET~`, `~ABSENTEE_FULL_ADDRESS~`, `~FULL_ADDRESS~` and `~STREET_VIEW~` image template variables, and `%ABSENTEE_STREET%` in messages, use this address instead of the mailing address. The mailer is still delivered to `address`. Include the city, state and ZIP so Street View finds the right property. It is stored and returned in its own `absentee_address` field, and also copied into `custom2` when that is empty, so templates that print `%CUSTOM2%` keep working; a `custom2` you send is never changed. The older convention of `custom1` = `absentee` with `custom2` = the property address is still accepted and copied into `absentee_address`."
    },
    "absentee-city": {
      "type": "string",
      "description": "City of the absentee (property) address. Requires `absentee_address` in the same request."
    },
    "absentee-postal-code": {
      "type": "string",
      "description": "ZIP or postal code of the absentee (property) address. Requires `absentee_address` in the same request."
    },
    "absentee-province": {
      "type": "string",
      "description": "State or province of the absentee (property) address. Requires `absentee_address` in the same request."
    },
    "mailing-list": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "user_id": {
          "type": "integer"
        },
        "sub_account_id": {
          "type": [
            "integer",
            "null"
          ]
        },
        "type": {
          "type": "string",
          "enum": [
            "csv",
            "manual",
            "map",
            "friends",
            "retarget",
            "leads",
            "zapier",
            "radius",
            "highlevel",
            "qrscans"
          ]
        },
        "description": {
          "type": "string"
        },
        "qrcode_url": {
          "type": [
            "string",
            "null"
          ]
        },
        "total_recipients": {
          "type": "integer"
        },
        "processed": {
          "type": "boolean"
        },
        "is_suppression_list": {
          "type": "boolean"
        },
        "total_scans": {
          "type": "integer"
        },
        "unique_scans": {
          "type": "integer"
        },
        "last_scan": {
          "type": [
            "string",
            "null"
          ]
        },
        "total_sends": {
          "type": "integer"
        },
        "last_send": {
          "type": [
            "string",
            "null"
          ]
        },
        "api_key": {
          "type": "string",
          "description": "API key that can be used to add recipients to this mailing list with thanks.io Webhooks"
        },
        "created_at": {
          "type": "string",
          "format": "date-time"
        },
        "created_at_diff": {
          "type": "string",
          "description": "Human-friendly relative time since creation"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "recipient-create-no-mailinglist": {
      "type": "object",
      "anyOf": [
        {
          "title": "Create Recipient by Address",
          "description": "Create a recipient by providing address details",
          "required": [
            "mailing_list_id",
            "address"
          ]
        },
        {
          "title": "Create Recipient by Email",
          "description": "Create a recipient by providing email address",
          "required": [
            "mailing_list_id",
            "email"
          ]
        }
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "company": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "address2": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "province": {
          "type": "string",
          "description": "State or Province"
        },
        "postal_code": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "dob": {
          "type": "string",
          "description": "Date of Birth in ISO 8601 format (YYYY-MM-DD) or null if not set. If provided as MM/DD/YYYY in requests, it will be converted to ISO 8601 format."
        },
        "anniversary": {
          "type": "string",
          "description": "Can be used for house purchase anniversaries, move-in dates, or any recurring annual milestone.  Anniversary date in ISO 8601 format (YYYY-MM-DD) or null if not set. If provided as MM/DD/YYYY in requests, it will be converted to ISO 8601 format."
        },
        "email": {
          "type": "string"
        },
        "phone": {
          "type": "string"
        },
        "custom1": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom2": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom3": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom4": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom5": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom6": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom7": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom8": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom9": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "custom10": {
          "type": "string",
          "description": "Custom field for additional information about the recipient"
        },
        "absentee_address": {
          "$ref": "#/$defs/absentee-address"
        },
        "absentee_city": {
          "$ref": "#/$defs/absentee-city"
        },
        "absentee_province": {
          "$ref": "#/$defs/absentee-province"
        },
        "absentee_postal_code": {
          "$ref": "#/$defs/absentee-postal-code"
        },
        "mailing-list": {
          "readOnly": true,
          "allOf": [
            {
              "$ref": "#/$defs/mailing-list"
            }
          ],
          "description": "The mailing list this recipient belongs to"
        },
        "created_at": {
          "readOnly": true,
          "type": "string"
        },
        "updated_at": {
          "readOnly": true,
          "type": "string"
        }
      }
    }
  }
}