## Create Postcard **post** `/print-mail/v1/postcards` 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 Parameters - `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 }` - `backHTML: string` The HTML content for the back of the postcard. You can supply _either_ this or `backTemplate` but not both. - `frontHTML: string` The HTML content for the front of the postcard. You can supply _either_ this or `frontTemplate` but not both. - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `to: ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `addressLine1: string` The first line of the contact's address. - `countryCode: string` The ISO 3611-1 country code of the contact's address. - `firstName: string` - `addressLine2: optional string` Second line of the contact's address, if applicable. - `city: optional string` The city of the contact's address. - `companyName: optional string` Company name of the contact. - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `email: optional string` Email of the contact. - `forceVerifiedStatus: optional boolean` If `true`, PostGrid will force this contact to have an `addressStatus` of `verified` even if our address verification system says otherwise. - `jobTitle: optional string` Job title of the contact. - `lastName: optional string` Last name of the contact. - `metadata: optional map[unknown]` See the section on Metadata. - `phoneNumber: optional string` Phone number of the contact. - `postalOrZip: optional string` The postal or ZIP code of the contact's address. - `provinceOrState: optional string` Province or state of the contact's address. - `skipVerification: optional boolean` If `true`, PostGrid will skip running this contact's address through our address verification system. - `ContactCreateWithCompanyName = object { addressLine1, companyName, countryCode, 13 more }` - `addressLine1: string` The first line of the contact's address. - `companyName: string` - `countryCode: string` The ISO 3611-1 country code of the contact's address. - `addressLine2: optional string` Second line of the contact's address, if applicable. - `city: optional string` The city of the contact's address. - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `email: optional string` Email of the contact. - `firstName: optional string` First name of the contact. - `forceVerifiedStatus: optional boolean` If `true`, PostGrid will force this contact to have an `addressStatus` of `verified` even if our address verification system says otherwise. - `jobTitle: optional string` Job title of the contact. - `lastName: optional string` Last name of the contact. - `metadata: optional map[unknown]` See the section on Metadata. - `phoneNumber: optional string` Phone number of the contact. - `postalOrZip: optional string` The postal or ZIP code of the contact's address. - `provinceOrState: optional string` Province or state of the contact's address. - `skipVerification: optional boolean` If `true`, PostGrid will skip running this contact's address through our address verification system. - `string` - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `from: optional ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `string` - `mailingClass: optional "first_class" or "standard_class" or "express" or 23 more` The mailing class of this order. If not provided, automatically set to `first_class`. - `"first_class"` - `"standard_class"` - `"express"` - `"certified"` - `"certified_return_receipt"` - `"registered"` - `"usps_first_class"` - `"usps_standard_class"` - `"usps_eddm"` - `"usps_express_2_day"` - `"usps_express_3_day"` - `"usps_first_class_certified"` - `"usps_first_class_certified_return_receipt"` - `"usps_first_class_registered"` - `"usps_express_3_day_signature_confirmation"` - `"usps_express_3_day_certified"` - `"usps_express_3_day_certified_return_receipt"` - `"ca_post_lettermail"` - `"ca_post_personalized"` - `"ca_post_neighbourhood_mail"` - `"ups_express_overnight"` - `"ups_express_2_day"` - `"ups_express_3_day"` - `"royal_mail_first_class"` - `"royal_mail_second_class"` - `"au_post_second_class"` - `mergeVariables: optional map[unknown]` 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. - `metadata: optional map[unknown]` See the section on Metadata. - `sendDate: optional string` This order will transition from `ready` to `printing` on the day after this date. You can use this parameter to schedule orders for a future date. - `PostcardCreateWithTemplate = object { backTemplate, frontTemplate }` - `backTemplate: string` The template ID for the back of the postcard. You can supply _either_ this or `backHTML` but not both. - `frontTemplate: string` The template ID for the front of the postcard. You can supply _either_ this or `frontHTML` but not both. - `PostcardCreateWithPdfurl = object { pdf, size, to, 6 more }` - `pdf: string` 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). - `size: PostcardSize` Enum representing the supported postcard sizes. - `to: ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `string` - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `from: optional ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `string` - `mailingClass: optional "first_class" or "standard_class" or "express" or 23 more` The mailing class of this order. If not provided, automatically set to `first_class`. - `"first_class"` - `"standard_class"` - `"express"` - `"certified"` - `"certified_return_receipt"` - `"registered"` - `"usps_first_class"` - `"usps_standard_class"` - `"usps_eddm"` - `"usps_express_2_day"` - `"usps_express_3_day"` - `"usps_first_class_certified"` - `"usps_first_class_certified_return_receipt"` - `"usps_first_class_registered"` - `"usps_express_3_day_signature_confirmation"` - `"usps_express_3_day_certified"` - `"usps_express_3_day_certified_return_receipt"` - `"ca_post_lettermail"` - `"ca_post_personalized"` - `"ca_post_neighbourhood_mail"` - `"ups_express_overnight"` - `"ups_express_2_day"` - `"ups_express_3_day"` - `"royal_mail_first_class"` - `"royal_mail_second_class"` - `"au_post_second_class"` - `mergeVariables: optional map[unknown]` 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. - `metadata: optional map[unknown]` See the section on Metadata. - `sendDate: optional string` This order will transition from `ready` to `printing` on the day after this date. You can use this parameter to schedule orders for a future date. - `PostcardCreateWithPdfFile = object { pdf, size, to, 6 more }` - `pdf: string` 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). - `size: PostcardSize` Enum representing the supported postcard sizes. - `to: ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `string` - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `from: optional ContactCreateWithFirstName or ContactCreateWithCompanyName or string` 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 }` - `string` - `mailingClass: optional "first_class" or "standard_class" or "express" or 23 more` The mailing class of this order. If not provided, automatically set to `first_class`. - `"first_class"` - `"standard_class"` - `"express"` - `"certified"` - `"certified_return_receipt"` - `"registered"` - `"usps_first_class"` - `"usps_standard_class"` - `"usps_eddm"` - `"usps_express_2_day"` - `"usps_express_3_day"` - `"usps_first_class_certified"` - `"usps_first_class_certified_return_receipt"` - `"usps_first_class_registered"` - `"usps_express_3_day_signature_confirmation"` - `"usps_express_3_day_certified"` - `"usps_express_3_day_certified_return_receipt"` - `"ca_post_lettermail"` - `"ca_post_personalized"` - `"ca_post_neighbourhood_mail"` - `"ups_express_overnight"` - `"ups_express_2_day"` - `"ups_express_3_day"` - `"royal_mail_first_class"` - `"royal_mail_second_class"` - `"au_post_second_class"` - `mergeVariables: optional map[unknown]` 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. - `metadata: optional map[unknown]` See the section on Metadata. - `sendDate: optional string` This order will transition from `ready` to `printing` on the day after this date. You can use this parameter to schedule orders for a future date. ### Returns - `Postcard = object { id, createdAt, live, 17 more }` - `id: string` A unique ID prefixed with postcard_ - `createdAt: string` The UTC time at which this resource was created. - `live: boolean` `true` if this is a live mode resource else `false`. - `mailingClass: "first_class" or "standard_class" or "express" or 23 more` The mailing class of this order. This determines the speed and cost of delivery. See `OrderMailingClass` for more details. - `"first_class"` - `"standard_class"` - `"express"` - `"certified"` - `"certified_return_receipt"` - `"registered"` - `"usps_first_class"` - `"usps_standard_class"` - `"usps_eddm"` - `"usps_express_2_day"` - `"usps_express_3_day"` - `"usps_first_class_certified"` - `"usps_first_class_certified_return_receipt"` - `"usps_first_class_registered"` - `"usps_express_3_day_signature_confirmation"` - `"usps_express_3_day_certified"` - `"usps_express_3_day_certified_return_receipt"` - `"ca_post_lettermail"` - `"ca_post_personalized"` - `"ca_post_neighbourhood_mail"` - `"ups_express_overnight"` - `"ups_express_2_day"` - `"ups_express_3_day"` - `"royal_mail_first_class"` - `"royal_mail_second_class"` - `"au_post_second_class"` - `object: "postcard"` Always `postcard`. - `"postcard"` - `sendDate: string` 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. - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `status: "ready" or "printing" or "processed_for_delivery" or 2 more` See `OrderStatus` for more details on the status of this order. - `"ready"` - `"printing"` - `"processed_for_delivery"` - `"completed"` - `"cancelled"` - `to: Contact` The recipient of this order. This will be provided even if you delete the underlying contact. - `id: string` A unique ID prefixed with contact_ - `addressLine1: string` The first line of the contact's address. - `addressStatus: "verified" or "corrected" or "failed"` One of `verified`, `corrected`, or `failed`. - `"verified"` - `"corrected"` - `"failed"` - `countryCode: string` The ISO 3611-1 country code of the contact's address. - `createdAt: string` The UTC time at which this resource was created. - `live: boolean` `true` if this is a live mode resource else `false`. - `object: "contact"` Always `contact`. - `"contact"` - `updatedAt: string` The UTC time at which this resource was last updated. - `addressErrors: optional string` A series of human-readable errors/warnings that were raised when running the provided address through our address verification. - `addressLine2: optional string` Second line of the contact's address, if applicable. - `city: optional string` The city of the contact's address. - `companyName: optional string` Company name of the contact. - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `email: optional string` Email of the contact. - `firstName: optional string` First name of the contact. - `forceVerifiedStatus: optional boolean` If `true`, PostGrid will force this contact to have an `addressStatus` of `verified` even if our address verification system says otherwise. - `jobTitle: optional string` Job title of the contact. - `lastName: optional string` Last name of the contact. - `metadata: optional map[unknown]` See the section on Metadata. - `phoneNumber: optional string` Phone number of the contact. - `postalOrZip: optional string` The postal or ZIP code of the contact's address. - `provinceOrState: optional string` Province or state of the contact's address. - `skipVerification: optional boolean` If `true`, PostGrid will skip running this contact's address through our address verification system. - `updatedAt: string` The UTC time at which this resource was last updated. - `cancellation: optional object { reason, cancelledByUser, note }` The cancellation details of this order. Populated if the order has been cancelled. - `reason: "user_initiated" or "invalid_content" or "invalid_order_mailing_class"` The reason for the cancellation. - `"user_initiated"` - `"invalid_content"` - `"invalid_order_mailing_class"` - `cancelledByUser: optional string` The user ID who cancelled the order. - `note: optional string` An optional note provided by the user who cancelled the order. - `description: optional string` An optional string describing this resource. Will be visible in the API and the dashboard. - `from: optional Contact` The contact information of the sender. - `imbDate: optional string` 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. - `"entered_mail_stream"` - `"out_for_delivery"` - `"returned_to_sender"` - `imbZIPCode: optional string` The most recent ZIP code of the USPS facility that the order has been processed through. Only populated when an `imbStatus` is present. - `mergeVariables: optional map[unknown]` 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. - `metadata: optional map[unknown]` See the section on Metadata. - `trackingNumber: optional string` The tracking number of this order. Populated after an express/certified order has been processed for delivery. - `url: optional string` 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. ### Example ```http 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" } }' ``` #### Response ```json { "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" } ```