Create Mailing List Import
print_mail.mailing_list_imports.create(MailingListImportCreateParams**kwargs) -> MailingListImportResponse
POST/print-mail/v1/mailing_list_imports
Create a new mailing list import.
Initiates the import process for a contact list file. The import enters the
validating status while contacts are processed and verified.
Parameters
description: Optional[str]
An optional string describing this resource. Will be visible in the API and the dashboard.
receiver_merge_variable_mapping: Optional[Dict[str, str]]
Optional mapping of columns for receiver merge variables.
sender_address_mapping: Optional[Dict[str, str]]
Optional mapping of columns for sender addresses. If this is present, then all receivers should have a corresponding sender.
Create Mailing List Import
import os
from postgrid import PostGrid
client = PostGrid(
print_mail_api_key=os.environ.get("POSTGRID_PRINT_MAIL_API_KEY"), # This is the default and can be omitted
)
mailing_list_import_response = client.print_mail.mailing_list_imports.create(
file="https://signed-upload-url.csv",
file_type="csv",
receiver_address_mapping={
"description": "Description",
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email",
"addressLine1": "Address",
"city": "City",
"postalOrZip": "Postal Code",
"provinceOrState": "State",
"countryCode": "Country",
},
)
print(mailing_list_import_response.id){
"id": "mailing_list_import_123",
"live": false,
"createdAt": "2023-10-27T10:00:00Z",
"updatedAt": "2023-10-27T10:05:00Z",
"status": "completed",
"reportURL": "https://signed-report-url.csv",
"errors": [],
"notes": [],
"validRowCount": 100,
"invalidRowCount": 0,
"receiverStatusCount": {
"verifiedCount": 100,
"correctedCount": 0,
"failedCount": 0
},
"senderStatusCount": {
"verifiedCount": 100,
"correctedCount": 0,
"failedCount": 0
},
"organization": "org_123",
"file": {
"fileType": "csv",
"receiverAddressMapping": {
"description": "Description",
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email",
"addressLine1": "Address",
"addressLine2": "Address Line 2",
"city": "City",
"postalOrZip": "Postal Code",
"provinceOrState": "Province",
"countryCode": "Country"
},
"url": "https://signed.url/import_123.csv"
}
}Returns Examples
{
"id": "mailing_list_import_123",
"live": false,
"createdAt": "2023-10-27T10:00:00Z",
"updatedAt": "2023-10-27T10:05:00Z",
"status": "completed",
"reportURL": "https://signed-report-url.csv",
"errors": [],
"notes": [],
"validRowCount": 100,
"invalidRowCount": 0,
"receiverStatusCount": {
"verifiedCount": 100,
"correctedCount": 0,
"failedCount": 0
},
"senderStatusCount": {
"verifiedCount": 100,
"correctedCount": 0,
"failedCount": 0
},
"organization": "org_123",
"file": {
"fileType": "csv",
"receiverAddressMapping": {
"description": "Description",
"firstName": "First Name",
"lastName": "Last Name",
"email": "Email",
"addressLine1": "Address",
"addressLine2": "Address Line 2",
"city": "City",
"postalOrZip": "Postal Code",
"provinceOrState": "Province",
"countryCode": "Country"
},
"url": "https://signed.url/import_123.csv"
}
}