Create Postcard
Create a postcard. Note that you can supply one of the following:
- HTML content for the front and back of the postcard
- A template ID for the front and back of the postcard
- A URL or file for a 2 page PDF where the first page is the front of the postcard and the second page is the back
- Upload the aforementioned PDF file via a multipart form upload request
Body ParametersJSONExpand Collapse
body: object { backHTML, frontHTML, size, 7 more } or object { backTemplate, frontTemplate } or object { pdf, size, to, 6 more } or object { pdf, size, to, 6 more }
PostcardCreateWithHTML = object { backHTML, frontHTML, size, 7 more }
The HTML content for the back of the postcard. You can supply either this or backTemplate but not both.
The HTML content for the front of the postcard. You can supply either this or frontTemplate but not both.
to: ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
The recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
An optional string describing this resource. Will be visible in the API and the dashboard.
from: optional ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
The contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
mailingClass: optional "first_class" or "standard_class" or "express" or 23 moreThe mailing class of this order. If not provided, automatically set to first_class.
The mailing class of this order. If not provided, automatically set to first_class.
PostcardCreateWithPdfurl = object { pdf, size, to, 6 more }
A URL pointing to a 2 page PDF file. The first page is the front of the postcard and the second page is the back (where the address will be stamped on).
to: ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
The recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
An optional string describing this resource. Will be visible in the API and the dashboard.
from: optional ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
The contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
mailingClass: optional "first_class" or "standard_class" or "express" or 23 moreThe mailing class of this order. If not provided, automatically set to first_class.
The mailing class of this order. If not provided, automatically set to first_class.
PostcardCreateWithPdfFile = object { pdf, size, to, 6 more }
A 2 page PDF file. The first page is the front of the postcard and the second page is the back (where the address will be stamped on).
to: ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
The recipient of this order. You can either supply the contact information inline here or provide a contact ID. PostGrid will automatically deduplicate contacts regardless of whether you provide the information inline here or call the contact creation endpoint.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
An optional string describing this resource. Will be visible in the API and the dashboard.
from: optional ContactCreateWithFirstName { addressLine1, countryCode, firstName, 13 more } or ContactCreateWithCompanyName { addressLine1, companyName, countryCode, 13 more } or stringThe contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
The contact information of the sender. You can pass contact information inline here just like you can for the to. Unlike other order types, the sender address is optional for postcards.
ContactCreateWithFirstName = object { addressLine1, countryCode, firstName, 13 more }
ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }
mailingClass: optional "first_class" or "standard_class" or "express" or 23 moreThe mailing class of this order. If not provided, automatically set to first_class.
The mailing class of this order. If not provided, automatically set to first_class.
ReturnsExpand Collapse
Postcard = object { id, createdAt, live, 17 more }
mailingClass: "first_class" or "standard_class" or "express" or 23 moreThe mailing class of this order. This determines the speed and cost of delivery. See OrderMailingClass for more details.
The mailing class of this order. This determines the speed and cost of delivery. See OrderMailingClass for more details.
This order will transition from ready to printing on the day after this date. For example, if this is a date on Tuesday, the order will transition to printing on Wednesday at midnight eastern time.
status: "ready" or "printing" or "processed_for_delivery" or 2 moreSee OrderStatus for more details on the status of this order.
See OrderStatus for more details on the status of this order.
The recipient of this order. This will be provided even if you delete the underlying contact.
The recipient of this order. This will be provided even if you delete the underlying contact.
A series of human-readable errors/warnings that were raised when running the provided address through our address verification.
An optional string describing this resource. Will be visible in the API and the dashboard.
cancellation: optional object { reason, cancelledByUser, note } The cancellation details of this order. Populated if the order has been cancelled.
The cancellation details of this order. Populated if the order has been cancelled.
An optional string describing this resource. Will be visible in the API and the dashboard.
The contact information of the sender.
The contact information of the sender.
A series of human-readable errors/warnings that were raised when running the provided address through our address verification.
An optional string describing this resource. Will be visible in the API and the dashboard.
The last date that the IMB status was updated. See imbStatus for more details.
imbStatus: optional "entered_mail_stream" or "out_for_delivery" or "returned_to_sender"The Intelligent Mail Barcode (IMB) status of this order. Only populated for US-printed and US-destined orders. This is the most detailed way to track non-express/certified orders.
The Intelligent Mail Barcode (IMB) status of this order. Only populated for US-printed and US-destined orders. This is the most detailed way to track non-express/certified orders.
The most recent ZIP code of the USPS facility that the order has been processed through. Only populated when an imbStatus is present.
These will be merged with the variables in the template or HTML you create this order with. The keys in this object should match the variable names in the template exactly as they are case-sensitive. Note that these do not apply to PDFs uploaded with the order.
The tracking number of this order. Populated after an express/certified order has been processed for delivery.
PostGrid renders a PDF preview for all orders. This should be inspected to ensure that the order is correct before it is sent out because it shows what will be printed and mailed to the recipient. Once the PDF preview is generated, this field will be returned by all GET endpoints which produce this order.
This URL is a signed link to the PDF preview. It will expire after a short period of time. If you need to access this URL after it has expired, you can regenerate it by calling the GET endpoint again.
Create Postcard
curl https://api.postgrid.com/print-mail/v1/postcards \
-H 'Content-Type: application/json' \
-H "X-API-Key: $POSTGRID_PRINT_MAIL_API_KEY" \
-d '{
"backHTML": "backHTML",
"frontHTML": "frontHTML",
"size": "6x4",
"to": {
"addressLine1": "addressLine1",
"countryCode": "countryCode",
"firstName": "firstName"
}
}'{
"id": "postcard_123456",
"object": "postcard",
"status": "ready",
"live": false,
"to": {
"id": "contact_pxd7wnnD1xY6H6etKNvjb4",
"object": "contact",
"live": false,
"companyName": "PostGrid",
"addressLine1": "90 CANAL ST STE 600",
"city": "BOSTON",
"provinceOrState": "MA",
"postalOrZip": "90210-1234",
"countryCode": "US",
"skipVerification": false,
"forceVerifiedStatus": false,
"addressStatus": "verified",
"createdAt": "2022-02-16T15:08:41.052Z",
"updatedAt": "2022-02-16T15:08:41.052Z"
},
"from": {
"id": "contact_pxd7wnnD1xY6H6etKNvjb4",
"object": "contact",
"live": false,
"companyName": "PostGrid",
"addressLine1": "90 CANAL ST STE 600",
"city": "BOSTON",
"provinceOrState": "MA",
"postalOrZip": "90210-1234",
"countryCode": "US",
"skipVerification": false,
"forceVerifiedStatus": false,
"addressStatus": "verified",
"createdAt": "2022-02-16T15:08:41.052Z",
"updatedAt": "2022-02-16T15:08:41.052Z"
},
"size": "6x4",
"sendDate": "2020-11-12T23:23:47.974Z",
"createdAt": "2020-11-12T23:23:47.974Z",
"updatedAt": "2020-11-12T23:23:47.974Z",
"mailingClass": "first_class"
}Returns Examples
{
"id": "postcard_123456",
"object": "postcard",
"status": "ready",
"live": false,
"to": {
"id": "contact_pxd7wnnD1xY6H6etKNvjb4",
"object": "contact",
"live": false,
"companyName": "PostGrid",
"addressLine1": "90 CANAL ST STE 600",
"city": "BOSTON",
"provinceOrState": "MA",
"postalOrZip": "90210-1234",
"countryCode": "US",
"skipVerification": false,
"forceVerifiedStatus": false,
"addressStatus": "verified",
"createdAt": "2022-02-16T15:08:41.052Z",
"updatedAt": "2022-02-16T15:08:41.052Z"
},
"from": {
"id": "contact_pxd7wnnD1xY6H6etKNvjb4",
"object": "contact",
"live": false,
"companyName": "PostGrid",
"addressLine1": "90 CANAL ST STE 600",
"city": "BOSTON",
"provinceOrState": "MA",
"postalOrZip": "90210-1234",
"countryCode": "US",
"skipVerification": false,
"forceVerifiedStatus": false,
"addressStatus": "verified",
"createdAt": "2022-02-16T15:08:41.052Z",
"updatedAt": "2022-02-16T15:08:41.052Z"
},
"size": "6x4",
"sendDate": "2020-11-12T23:23:47.974Z",
"createdAt": "2020-11-12T23:23:47.974Z",
"updatedAt": "2020-11-12T23:23:47.974Z",
"mailingClass": "first_class"
}