### Verify and Parse Addresses Source: https://www.postgrid.com/api-docs These cURL examples demonstrate how to automatically parse and correct freeform US or Canadian addresses, and how to use the international API for global address verification. ```bash # Automatically parse and correct a freeform US or Canadian address curl https://api.postgrid.com/v1/addver/verifications \ -u API_KEY: \ -d address="14-20 bay st, floor 11, toronto, on, canada" ``` ```bash # Use our international API to verify addresses around the world curl https://api.postgrid.com/v1/intl_addver/verifications \ -u API_KEY: \ -d address[line1]="33 Nine Elms Lane" \ -d address[city]="London" \ -d address[postalOrZip]="SW11 7US" \ -d address[country]="United Kingdom" ``` -------------------------------- ### Send a Postcard with PostGrid API Source: https://www.postgrid.com/api-docs This cURL example demonstrates how to send a custom postcard. You need to provide your API key, postcard dimensions, template IDs, and mailing class. ```bash curl https://api.postgrid.com/print-mail/v1/postcards \ -u API_KEY: \ -d to[firstName]="Kevin" \ -d to[lastName]="Villena" \ -d to[addressLine1]="145 Mulberry St, Apt PH D, New York, NY 10013" \ -d to[countryCode]="US" \ -d size="6x4" \ -d frontTemplate="template_6a3k5LqumLD7cpdD9VkQUd" \ -d backTemplate="template_oa8Au5h4DqFr1mRDLaKhJz" \ -d mailingClass="standard_class" \ -d mergeVariables[qr_code_url]="https://postgrid.com?source=postcard" ``` -------------------------------- ### Address Autocompletion Source: https://www.postgrid.com/api-docs These cURL commands show how to list address suggestions for partial input in the US & Canada, and how to list international addresses sorted by distance to the user's IP. ```bash # List US & Canada previews for partial address input curl https://api.postgrid.com/v1/addver/completions?partialStreet=182+Se \ -u API_KEY: ``` ```bash # List addresses from around the world, sorted by distance to user IP curl https://api.postgrid.com/v1/intl_addver/completions?partialStreet=15&countriesFilter=UK \ -u API_KEY: ``` -------------------------------- ### List and Retrieve Mail Items Source: https://www.postgrid.com/api-docs These cURL commands show how to list letters based on search criteria (e.g., destination and status) and retrieve a specific check with expanded bank account details. ```bash # List all letters destined for New York that have left their final USPS facility. curl https://api.postgrid.com/print-mail/v1/letters?search= "NY out_for_delivery" \ -u API_KEY: ``` ```bash # Retrieve a check and its corresponding bank account curl https://api.postgrid.com/print-mail/v1/cheques/cheque_dUtnqaaFTFyz9Yo56PuEfn?expand[]="bankAccount" \ -u API_KEY: ``` -------------------------------- ### Address Autocompletion Source: https://www.postgrid.com/api-docs List address suggestions for partial input, both for US/Canada and international addresses. ```APIDOC ## GET /v1/addver/completions ### Description List US & Canada previews for partial address input. ### Method GET ### Endpoint https://api.postgrid.com/v1/addver/completions ### Parameters #### Query Parameters - **partialStreet** (string) - Required - Partial street input. ## GET /v1/intl_addver/completions ### Description List addresses from around the world, sorted by distance to user IP. ### Method GET ### Endpoint https://api.postgrid.com/v1/intl_addver/completions ### Parameters #### Query Parameters - **partialStreet** (string) - Required - Partial street input. - **countriesFilter** (string) - Optional - Filter by country code (e.g., "UK"). ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Send a Check with PostGrid API Source: https://www.postgrid.com/api-docs Use this cURL command to send a check. This includes sender and recipient details, bank account information, amount, and an optional letter PDF attachment. ```bash curl https://api.postgrid.com/print-mail/v1/cheques \ -u API_KEY: \ -d to[firstName]="Kevin" \ -d to[lastName]="Villena" \ -d to[addressLine1]="145 Mulberry St, Apt PH D, New York, NY 10013" \ -d to[countryCode]="US" \ -d from[companyName]="PostGrid" \ -d from[addressLine1]="90 Canal St, Suite 400, Boston, MA" \ -d from[countryCode]="US" \ -d bankAccount="bank_k9zDtHjZmBe9ruVC4F8PZN" \ -d amount=4242 \ -d message="Here is the payment for the attached invoice." \ -d letterPDF="https://pg-prod-bucket-1.s3.amazonaws.com/assets/sample-invoice.pdf" ``` -------------------------------- ### Send a Letter with PostGrid API Source: https://www.postgrid.com/api-docs Use this cURL command to send a personalized letter. Ensure you replace API_KEY with your actual key and specify the template and merge variables. ```bash curl https://api.postgrid.com/print-mail/v1/letters \ -u API_KEY: \ -d to[firstName]="Kevin" \ -d to[lastName]="Villena" \ -d to[addressLine1]="145 Mulberry St, Apt PH D, New York, NY 10013" \ -d to[countryCode]="US" \ -d from[companyName]="PostGrid" \ -d from[addressLine1]="90 Canal St, Suite 400, Boston, MA" \ -d from[countryCode]="US" \ -d color=true \ -d express=true \ -d template="template_4hXPyVphgFPynPyHFTJaKo" \ -d mergeVariables[verification_code]=4242 ``` -------------------------------- ### List and Retrieve Mailings Source: https://www.postgrid.com/api-docs List letters or retrieve specific checks with expanded bank account details. ```APIDOC ## GET /print-mail/v1/letters ### Description List letters with search parameters. ### Method GET ### Endpoint https://api.postgrid.com/print-mail/v1/letters ### Parameters #### Query Parameters - **search** (string) - Optional - Search query (e.g., "NY out_for_delivery"). ## GET /print-mail/v1/cheques/{cheque_id} ### Description Retrieve a check and its corresponding bank account details. ### Method GET ### Endpoint https://api.postgrid.com/print-mail/v1/cheques/{cheque_id} ### Parameters #### Path Parameters - **cheque_id** (string) - Required - The ID of the check to retrieve. #### Query Parameters - **expand[]** (string) - Optional - Expand related resources, e.g., "bankAccount". ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Send a Postcard Source: https://www.postgrid.com/api-docs Send customized postcards with specified front and back templates. Supports standard mailing class. ```APIDOC ## POST /print-mail/v1/postcards ### Description Send customized postcards with specified front and back templates. Supports standard mailing class. ### Method POST ### Endpoint https://api.postgrid.com/print-mail/v1/postcards ### Parameters #### Request Body - **to** (object) - Required - Recipient's details. - **firstName** (string) - Required - **lastName** (string) - Required - **addressLine1** (string) - Required - **countryCode** (string) - Required - **size** (string) - Required - Postcard size (e.g., "6x4"). - **frontTemplate** (string) - Required - The ID of the front template. - **backTemplate** (string) - Required - The ID of the back template. - **mailingClass** (string) - Required - Mailing class (e.g., "standard_class"). - **mergeVariables** (object) - Optional - Variables to merge into the templates. - **qr_code_url** (string) - Example merge variable. ### Request Example ```json { "to": { "firstName": "Kevin", "lastName": "Villena", "addressLine1": "145 Mulberry St, Apt PH D, New York, NY 10013", "countryCode": "US" }, "size": "6x4", "frontTemplate": "template_6a3k5LqumLD7cpdD9VkQUd", "backTemplate": "template_oa8Au5h4DqFr1mRDLaKhJz", "mailingClass": "standard_class", "mergeVariables": { "qr_code_url": "https://postgrid.com?source=postcard" } } ``` ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Address Verification Source: https://www.postgrid.com/api-docs Verify and correct addresses for the US, Canada, and internationally. Supports autocompletion. ```APIDOC ## POST /v1/addver/verifications ### Description Automatically parse and correct a freeform US or Canadian address. ### Method POST ### Endpoint https://api.postgrid.com/v1/addver/verifications ### Parameters #### Request Body - **address** (string) - Required - The freeform address to verify. ## POST /v1/intl_addver/verifications ### Description Use our international API to verify addresses around the world. ### Method POST ### Endpoint https://api.postgrid.com/v1/intl_addver/verifications ### Parameters #### Request Body - **address** (object) - Required - Address details. - **line1** (string) - Required - **city** (string) - Required - **postalOrZip** (string) - Required - **country** (string) - Required ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Send a Check Source: https://www.postgrid.com/api-docs Send US & Canadian checks with letter attachments. Requires bank account details and amount. ```APIDOC ## POST /print-mail/v1/cheques ### Description Send US & Canadian checks with letter attachments. Requires bank account details and amount. ### Method POST ### Endpoint https://api.postgrid.com/print-mail/v1/cheques ### Parameters #### Request Body - **to** (object) - Required - Recipient's details. - **firstName** (string) - Required - **lastName** (string) - Required - **addressLine1** (string) - Required - **countryCode** (string) - Required - **from** (object) - Required - Sender's details. - **companyName** (string) - Optional - **addressLine1** (string) - Required - **countryCode** (string) - Required - **bankAccount** (string) - Required - The ID of the bank account. - **amount** (number) - Required - The check amount. - **message** (string) - Optional - A message to include with the check. - **letterPDF** (string) - Optional - URL to a PDF to attach to the check. ### Request Example ```json { "to": { "firstName": "Kevin", "lastName": "Villena", "addressLine1": "145 Mulberry St, Apt PH D, New York, NY 10013", "countryCode": "US" }, "from": { "companyName": "PostGrid", "addressLine1": "90 Canal St, Suite 400, Boston, MA", "countryCode": "US" }, "bankAccount": "bank_k9zDtHjZmBe9ruVC4F8PZN", "amount": 4242, "message": "Here is the payment for the attached invoice.", "letterPDF": "https://pg-prod-bucket-1.s3.amazonaws.com/assets/sample-invoice.pdf" } ``` ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` -------------------------------- ### Send a Letter Source: https://www.postgrid.com/api-docs Send personalized letters with automatic address verification. Supports custom templates and express delivery. ```APIDOC ## POST /print-mail/v1/letters ### Description Send personalized letters with automatic address verification. Supports custom templates and express delivery. ### Method POST ### Endpoint https://api.postgrid.com/print-mail/v1/letters ### Parameters #### Request Body - **to** (object) - Required - Recipient's details. - **firstName** (string) - Required - **lastName** (string) - Required - **addressLine1** (string) - Required - **countryCode** (string) - Required - **from** (object) - Required - Sender's details. - **companyName** (string) - Optional - **addressLine1** (string) - Required - **countryCode** (string) - Required - **color** (boolean) - Optional - Whether to print in color. - **express** (boolean) - Optional - Whether to use express delivery. - **template** (string) - Required - The ID of the template to use. - **mergeVariables** (object) - Optional - Variables to merge into the template. - **verification_code** (string) - Example merge variable. ### Request Example ```json { "to": { "firstName": "Kevin", "lastName": "Villena", "addressLine1": "145 Mulberry St, Apt PH D, New York, NY 10013", "countryCode": "US" }, "from": { "companyName": "PostGrid", "addressLine1": "90 Canal St, Suite 400, Boston, MA", "countryCode": "US" }, "color": true, "express": true, "template": "template_4hXPyVphgFPynPyHFTJaKo", "mergeVariables": { "verification_code": "4242" } } ``` ### Response #### Success Response (200) (Response details not provided in source) #### Response Example (Response example not provided in source) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.