Create campaign
POST /v2/campaigns Creates a campaign. No parameters are strictly required – if none are provided, an empty campaign draft is created.
Some fields become required depending on your choices:
-
designsare required if the template is anown_designtemplate. -
map_targetingis required if thetargeting_methodismap. -
recipientsorrecipients_csvis required if thetargeting_methodisrecipients.
thumbnails and proof are rendered in the background. Poll the campaign resource until they appear.
Form Data Parameters
Validation and basics
Validation level:
-
template→ requiretemplate -
content→ requiretemplate+content -
targeting→ requiretemplate+content+targeting
own_list or map. first_class or standard. false Default false. If true, one extra mailpiece is sent to the sender.
Targeting (map)
all or single_family, multi_family. Targeting (own list)
You can either provide a properly structured CSV (publicly accessible URL or multipart) or an array of recipients JSON.
CSV with columns in order: Name,Address,City,State,Zip.
If Name is empty it defaults to Current Resident
Template data
square_feet or acres. JUST LISTED or JUST SOLD. 1, 1.5). 1, 1.5). Template photos
height, width, x, y). Own design templates
height, width, x, y). QR codes
QR code overlays are grouped by side ( front, back). Each side holds an array of QR codes. Positions and sizes are in inches. A template_id is required when sending QR codes, and letter templates may only use the front side.
https. https. Metadata
Agent
height, width, x, y). Sender
height, width, x, y). curl -X POST https://www.realmailers.com/v2/campaigns \
-H 'Authorization: Bearer YOUR_API_KEY USER_EMAIL' \
-H 'X-Create-User: true' \
-F "postage_class"="first_class" \
-F "template_id"="1" \
-F "designs[][file]"="https://www.example.com/front.jpg" \
-F "designs[][file]"="https://www.example.com/back.jpg" \
-F "company[name]"="JOHN SMITH" \
-F "company[street_address]"="20 W 34TH ST" \
-F "company[city]"="NEW YORK" \
-F "company[state]"="NY" \
-F "company[zip]"="10001" {
template_uid: String
template_id: Number
expected_delivery_date: Timestamp(ISO8601)
scheduled_at: Timestamp(ISO8601)
created_at: Timestamp(ISO8601)
updated_at: Timestamp(ISO8601)
sent_at: Timestamp(ISO8601)
send_copy_to_sender: Boolean
notification_email: String
targeting_method: String
recipient_count: Number
discount_code: String
postage_class: String
price: Number
name: String
id: Number
thumbnails: Array(URL)
proof: URL
status: Enum(
draft
in_queue
mailed
in_production
in_transit
in_local_area
processed_for_delivery)
designs: Array({
thumbnail: URL
height: Number
width: Number
file: URL
crop: {
height: Number
width: Number
y: Number
x: Number
}
})
qr_codes: {
front: Array({
url: String
size: Number
y: Number
x: Number
})
back: Array({
url: String
size: Number
y: Number
x: Number
})
}
targeting_center: {
coordinates: Array(Number)
postcard_count: Number
address: String
}
template_data: {
landing_page_url: String
square_footage: Number
lot_size_type: String
description: String
maintenance: Number
back_title: String
photos: Array(URL)
bathrooms: Number
bedrooms: Number
lot_size: Number
address: String
label: String
price: Number
taxes: Number
variables: {
key: String
}
}
sender: {
street_address: String
state: String
name: String
city: String
zip: String
logo: URL
}
agent: {
license_number: String
cell_phone: String
first_name: String
last_name: String
landline: String
email: String
photo: URL
}
meta_data: {
key: String
}
}