# Order Profiles # Cheques ## Create Cheque Profile `print_mail.order_profiles.cheques.create(ChequeCreateParams**kwargs) -> ChequeProfile` **post** `/print-mail/v1/order_profiles/cheques` Creates a new Cheque Profile. Requires a `bankAccount` ID. Can optionally include an attached letter via `letterHTML`, `letterTemplate`, or `letterPDF`. If providing `letterPDF` or `logo` (if logo needs upload, though schema suggests URL), use `multipart/form-data`. ### Parameters - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `currency_code: Optional[CurrencyCode]` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_pdf: Optional[Union[str, Base64FileInput]]` PDF file for an optional attached letter. Cannot be used with `letterHTML` or `letterTemplate`. Input only. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Returns - `class ChequeProfile: …` - `id: str` Unique identifier for the order profile. - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `created_at: datetime` Timestamp when the profile was created. - `currency_code: CurrencyCode` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `letter_uploaded_pdf: Optional[str]` A temporary, signed URL to view the attached letter PDF, if any. Output only. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Example ```python 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 ) cheque_profile = client.print_mail.order_profiles.cheques.create( bank_account="bankAccount", size="us_letter", ) print(cheque_profile.id) ``` #### Response ```json { "id": "cheque_profile_789", "object": "cheque_profile", "live": true, "description": "Vendor Payment Profile", "size": "us_letter", "bankAccount": "bank_acct_xyz", "currencyCode": "USD", "memo": "Invoice #12345", "mailingClass": "first_class", "createdAt": "2023-03-20T12:00:00Z", "updatedAt": "2023-03-20T12:00:00Z" } ``` ## List Cheque Profiles `print_mail.order_profiles.cheques.list(ChequeListParams**kwargs) -> SyncSkipLimit[ChequeListResponse]` **get** `/print-mail/v1/order_profiles/cheques` Retrieves a list of Cheque Profiles. ### Parameters - `limit: Optional[int]` - `search: Optional[str]` You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details. - `skip: Optional[int]` ### Returns - `class ChequeListResponse: …` - `id: str` Unique identifier for the order profile. - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `letter_uploaded_pdf: Optional[str]` A temporary, signed URL to view the attached letter PDF, if any. Output only. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Example ```python 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 ) page = client.print_mail.order_profiles.cheques.list() page = page.data[0] print(page.id) ``` #### Response ```json { "data": [ { "id": "cheque_profile_789", "object": "cheque_profile", "live": true, "description": "Vendor Payment Profile", "size": "us_letter", "bankAccount": "bank_acct_xyz", "currencyCode": "USD", "memo": "Invoice #12345", "mailingClass": "first_class", "createdAt": "2023-03-20T12:00:00Z", "updatedAt": "2023-03-20T12:00:00Z" } ], "object": "list", "totalCount": 1, "limit": 1, "skip": 0 } ``` ## Retrieve Cheque Profile `print_mail.order_profiles.cheques.retrieve(strid, ChequeRetrieveParams**kwargs) -> ChequeProfile` **get** `/print-mail/v1/order_profiles/cheques/{id}` Retrieves the details of a specific Cheque Profile. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. ### Returns - `class ChequeProfile: …` - `id: str` Unique identifier for the order profile. - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `created_at: datetime` Timestamp when the profile was created. - `currency_code: CurrencyCode` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `letter_uploaded_pdf: Optional[str]` A temporary, signed URL to view the attached letter PDF, if any. Output only. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Example ```python 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 ) cheque_profile = client.print_mail.order_profiles.cheques.retrieve( id="id", ) print(cheque_profile.id) ``` #### Response ```json { "id": "cheque_profile_789", "object": "cheque_profile", "live": true, "description": "Vendor Payment Profile", "size": "us_letter", "bankAccount": "bank_acct_xyz", "currencyCode": "USD", "memo": "Invoice #12345", "mailingClass": "first_class", "createdAt": "2023-03-20T12:00:00Z", "updatedAt": "2023-03-20T12:00:00Z" } ``` ## Update Cheque Profile `print_mail.order_profiles.cheques.update(strid, ChequeUpdateParams**kwargs) -> ChequeProfile` **post** `/print-mail/v1/order_profiles/cheques/{id}` Updates specific fields of an existing Cheque Profile. If providing `letterPDF` or `logo`, use `multipart/form-data`. ### Parameters - `id: str` - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `currency_code: Optional[CurrencyCode]` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_pdf: Optional[Union[str, Base64FileInput]]` PDF file for an optional attached letter. Cannot be used with `letterHTML` or `letterTemplate`. Input only. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Returns - `class ChequeProfile: …` - `id: str` Unique identifier for the order profile. - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `created_at: datetime` Timestamp when the profile was created. - `currency_code: CurrencyCode` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `letter_uploaded_pdf: Optional[str]` A temporary, signed URL to view the attached letter PDF, if any. Output only. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Example ```python 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 ) cheque_profile = client.print_mail.order_profiles.cheques.update( id="id", bank_account="bankAccount", size="us_letter", ) print(cheque_profile.id) ``` #### Response ```json { "id": "cheque_profile_789", "object": "cheque_profile", "live": true, "description": "Vendor Payment Profile", "size": "us_letter", "bankAccount": "bank_acct_xyz", "currencyCode": "USD", "memo": "Invoice #12345", "mailingClass": "first_class", "createdAt": "2023-03-20T12:00:00Z", "updatedAt": "2023-03-20T12:00:00Z" } ``` ## Delete Cheque Profile `print_mail.order_profiles.cheques.delete(strid) -> ChequeDeleteResponse` **delete** `/print-mail/v1/order_profiles/cheques/{id}` Deletes a Cheque Profile. ### Parameters - `id: str` ### Returns - `class ChequeDeleteResponse: …` - `id: str` Unique identifier for the order profile. - `deleted: Literal[true]` - `true` - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` ### Example ```python 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 ) cheque = client.print_mail.order_profiles.cheques.delete( "id", ) print(cheque.id) ``` #### Response ```json { "id": "cheque_profile_789", "object": "cheque_profile", "deleted": true } ``` ## Domain Types ### Cheque Profile - `class ChequeProfile: …` - `id: str` Unique identifier for the order profile. - `bank_account: str` ID of the bank account to use for the cheque. Required for creation. - `created_at: datetime` Timestamp when the profile was created. - `currency_code: CurrencyCode` Enum representing the supported currency codes. - `"CAD"` - `"USD"` - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["cheque_profile"]` Always `cheque_profile`. - `"cheque_profile"` - `size: ChequeSize` Enum representing the supported cheque sizes. - `"us_letter"` - `"us_legal"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `letter_template: Optional[str]` ID of a template for an optional attached letter. Cannot be used with `letterHTML` or `letterPDF`. - `letter_uploaded_pdf: Optional[str]` A temporary, signed URL to view the attached letter PDF, if any. Output only. - `logo: Optional[str]` A publicly accessible URL for the logo to print on the cheque. Set to `null` to remove during update. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class. Generally must be first class (or equivalent for destination country) for cheques. - `"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"` - `memo: Optional[str]` Memo line text for the cheque. Set to `null` to remove during update. - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `message: Optional[str]` Message included on the cheque stub. Set to `null` to remove during update. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. ### Currency Code - `Literal["CAD", "USD"]` Enum representing the supported currency codes. - `"CAD"` - `"USD"` # Letters ## Create Letter Profile `print_mail.order_profiles.letters.create(LetterCreateParams**kwargs) -> LetterProfile` **post** `/print-mail/v1/order_profiles/letters` Creates a new Letter Profile. You must provide either a `template` ID or upload a `pdf` file for the content. If providing PDF files (`pdf` or `attachedPDFFile`), the request `Content-Type` must be `multipart/form-data`. ### Parameters - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdfParam]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `pdf: Optional[str]` A PDF file containing the letter content. Cannot be used with `template`. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `return_envelope: Optional[str]` ID of a return envelope to include. - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. ### Returns - `class LetterProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `updated_at: datetime` Timestamp when the profile was last updated. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdf]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) letter_profile = client.print_mail.order_profiles.letters.create( size="us_letter", color=True, description="Monthly Newsletter Profile", mailing_class="first_class", merge_variables={ "salutation": "Valued Customer" }, metadata={ "campaign": "Q1 Newsletter" }, template="template_abc", ) print(letter_profile.id) ``` #### Response ```json { "id": "letter_profile_123", "object": "letter_profile", "live": false, "description": "Monthly Newsletter Profile", "metadata": { "campaign": "Q1 Newsletter" }, "mailingClass": "first_class", "mergeVariables": { "salutation": "Valued Customer" }, "size": "us_letter", "color": true, "doubleSided": true, "envelope": "standard", "addressPlacement": "top_first_page", "template": "template_123", "createdAt": "2023-01-10T10:00:00Z", "updatedAt": "2023-01-10T10:00:00Z" } ``` ## List Letter Profiles `print_mail.order_profiles.letters.list(LetterListParams**kwargs) -> SyncSkipLimit[LetterProfile]` **get** `/print-mail/v1/order_profiles/letters` Retrieves a list of Letter Profiles. The profiles are returned sorted by creation date, with the most recent appearing first. ### Parameters - `limit: Optional[int]` - `search: Optional[str]` You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details. - `skip: Optional[int]` ### Returns - `class LetterProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `updated_at: datetime` Timestamp when the profile was last updated. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdf]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) page = client.print_mail.order_profiles.letters.list() page = page.data[0] print(page.id) ``` #### Response ```json { "data": [ { "id": "letter_profile_123", "object": "letter_profile", "live": false, "description": "Monthly Newsletter Profile", "metadata": { "campaign": "Q1 Newsletter" }, "mailingClass": "first_class", "mergeVariables": { "salutation": "Valued Customer" }, "size": "us_letter", "color": true, "doubleSided": true, "envelope": "standard", "addressPlacement": "top_first_page", "template": "template_123", "createdAt": "2023-01-10T10:00:00Z", "updatedAt": "2023-01-10T10:00:00Z" } ], "object": "list", "totalCount": 1, "limit": 1, "skip": 0 } ``` ## Retrieve Letter Profile `print_mail.order_profiles.letters.retrieve(strid, LetterRetrieveParams**kwargs) -> LetterProfile` **get** `/print-mail/v1/order_profiles/letters/{id}` Retrieves the details of a specific Letter Profile by its ID. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. ### Returns - `class LetterProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `updated_at: datetime` Timestamp when the profile was last updated. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdf]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) letter_profile = client.print_mail.order_profiles.letters.retrieve( id="id", ) print(letter_profile.id) ``` #### Response ```json { "id": "letter_profile_123", "object": "letter_profile", "live": false, "description": "Monthly Newsletter Profile", "metadata": { "campaign": "Q1 Newsletter" }, "mailingClass": "first_class", "mergeVariables": { "salutation": "Valued Customer" }, "size": "us_letter", "color": true, "doubleSided": true, "envelope": "standard", "addressPlacement": "top_first_page", "template": "template_123", "createdAt": "2023-01-10T10:00:00Z", "updatedAt": "2023-01-10T10:00:00Z" } ``` ## Update Letter Profile `print_mail.order_profiles.letters.update(strid, LetterUpdateParams**kwargs) -> LetterProfile` **post** `/print-mail/v1/order_profiles/letters/{id}` Updates specific fields of an existing Letter Profile. Only the fields provided in the request body will be updated. If providing PDF files (`pdf` or `attachedPDFFile`), the request `Content-Type` must be `multipart/form-data`. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdfParam]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `pdf: Optional[str]` A PDF file containing the letter content. Cannot be used with `template`. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `return_envelope: Optional[str]` ID of a return envelope to include. - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. ### Returns - `class LetterProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `updated_at: datetime` Timestamp when the profile was last updated. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdf]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) letter_profile = client.print_mail.order_profiles.letters.update( id="id", color=False, description="Updated Newsletter Profile", ) print(letter_profile.id) ``` #### Response ```json { "id": "letter_profile_123", "object": "letter_profile", "live": false, "description": "Monthly Newsletter Profile", "metadata": { "campaign": "Q1 Newsletter" }, "mailingClass": "first_class", "mergeVariables": { "salutation": "Valued Customer" }, "size": "us_letter", "color": true, "doubleSided": true, "envelope": "standard", "addressPlacement": "top_first_page", "template": "template_123", "createdAt": "2023-01-10T10:00:00Z", "updatedAt": "2023-01-10T10:00:00Z" } ``` ## Delete Letter Profile `print_mail.order_profiles.letters.delete(strid) -> LetterDeleteResponse` **delete** `/print-mail/v1/order_profiles/letters/{id}` Deletes a Letter Profile. This action cannot be undone. Orders previously created using this profile are not affected. ### Parameters - `id: str` ### Returns - `class LetterDeleteResponse: …` - `id: str` Unique identifier for the order profile. - `deleted: Literal[true]` - `true` - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` ### Example ```python 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 ) letter = client.print_mail.order_profiles.letters.delete( "id", ) print(letter.id) ``` #### Response ```json { "id": "letter_profile_123", "object": "letter_profile", "deleted": true } ``` ## Domain Types ### Letter Profile - `class LetterProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["letter_profile"]` Always `letter_profile`. - `"letter_profile"` - `size: LetterSize` Enum representing the supported letter sizes. - `"us_letter"` - `"a4"` - `updated_at: datetime` Timestamp when the profile was last updated. - `address_placement: Optional[AddressPlacement]` Enum representing the placement of the address on the letter. - `"top_first_page"` - `"insert_blank_page"` - `attached_pdf: Optional[AttachedPdf]` Model representing an attached PDF. - `file: str` The file (multipart form upload) or URL pointing to a PDF for the attached PDF. - `placement: Literal["before_template", "after_template"]` Enum representing the placement of the attached PDF. - `"before_template"` - `"after_template"` - `color: Optional[bool]` Specifies whether to print in color (true) or black and white (false). - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `double_sided: Optional[bool]` Specifies whether to print on both sides of the paper. - `envelope: Optional[str]` ID of a custom envelope to use. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing 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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `perforated_page: Optional[Literal[1]]` Specifies which page number should be perforated (if any). - `1` - `template: Optional[str]` ID of a template to use for the letter content. Cannot be used with `pdf`. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. # Postcards ## Create Postcard Profile `print_mail.order_profiles.postcards.create(PostcardCreateParams**kwargs) -> PostcardProfile` **post** `/print-mail/v1/order_profiles/postcards` Creates a new Postcard Profile. Provide either `frontTemplate` and `backTemplate` IDs, or upload a 2-page `pdf`. If providing a `pdf`, the request `Content-Type` must be `multipart/form-data`. ### Parameters - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `pdf: Optional[str]` A 2-page PDF file containing the postcard content (front and back). Cannot be used with `frontTemplate`/`backTemplate`. ### Returns - `class PostcardProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `updated_at: datetime` Timestamp when the profile was last updated. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF content, if any. ### Example ```python 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 ) postcard_profile = client.print_mail.order_profiles.postcards.create( size="6x4", ) print(postcard_profile.id) ``` #### Response ```json { "id": "postcard_profile_456", "object": "postcard_profile", "live": false, "description": "Promo Postcard", "size": "6x4", "frontTemplate": "template_abc", "backTemplate": "template_abc", "mailingClass": "standard_class", "createdAt": "2023-02-15T11:00:00Z", "updatedAt": "2023-02-15T11:00:00Z" } ``` ## List Postcard Profiles `print_mail.order_profiles.postcards.list(PostcardListParams**kwargs) -> SyncSkipLimit[PostcardProfile]` **get** `/print-mail/v1/order_profiles/postcards` Retrieves a list of Postcard Profiles. ### Parameters - `limit: Optional[int]` - `search: Optional[str]` You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details. - `skip: Optional[int]` ### Returns - `class PostcardProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `updated_at: datetime` Timestamp when the profile was last updated. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF content, if any. ### Example ```python 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 ) page = client.print_mail.order_profiles.postcards.list() page = page.data[0] print(page.id) ``` #### Response ```json { "data": [ { "id": "postcard_profile_456", "object": "postcard_profile", "live": false, "description": "Promo Postcard", "size": "6x4", "frontTemplate": "template_abc", "backTemplate": "template_abc", "mailingClass": "standard_class", "createdAt": "2023-02-15T11:00:00Z", "updatedAt": "2023-02-15T11:00:00Z" } ], "object": "list", "totalCount": 1, "limit": 1, "skip": 0 } ``` ## Retrieve Postcard Profile `print_mail.order_profiles.postcards.retrieve(strid, PostcardRetrieveParams**kwargs) -> PostcardProfile` **get** `/print-mail/v1/order_profiles/postcards/{id}` Retrieves the details of a specific Postcard Profile. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. ### Returns - `class PostcardProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `updated_at: datetime` Timestamp when the profile was last updated. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF content, if any. ### Example ```python 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 ) postcard_profile = client.print_mail.order_profiles.postcards.retrieve( id="id", ) print(postcard_profile.id) ``` #### Response ```json { "id": "postcard_profile_456", "object": "postcard_profile", "live": false, "description": "Promo Postcard", "size": "6x4", "frontTemplate": "template_abc", "backTemplate": "template_abc", "mailingClass": "standard_class", "createdAt": "2023-02-15T11:00:00Z", "updatedAt": "2023-02-15T11:00:00Z" } ``` ## Update Postcard Profile `print_mail.order_profiles.postcards.update(strid, PostcardUpdateParams**kwargs) -> PostcardProfile` **post** `/print-mail/v1/order_profiles/postcards/{id}` Updates specific fields of an existing Postcard Profile. If providing a `pdf`, the request `Content-Type` must be `multipart/form-data`. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `pdf: Optional[str]` A 2-page PDF file containing the postcard content (front and back). Cannot be used with `frontTemplate`/`backTemplate`. ### Returns - `class PostcardProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `updated_at: datetime` Timestamp when the profile was last updated. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF content, if any. ### Example ```python 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 ) postcard_profile = client.print_mail.order_profiles.postcards.update( id="id", ) print(postcard_profile.id) ``` #### Response ```json { "id": "postcard_profile_456", "object": "postcard_profile", "live": false, "description": "Promo Postcard", "size": "6x4", "frontTemplate": "template_abc", "backTemplate": "template_abc", "mailingClass": "standard_class", "createdAt": "2023-02-15T11:00:00Z", "updatedAt": "2023-02-15T11:00:00Z" } ``` ## Delete Postcard Profile `print_mail.order_profiles.postcards.delete(strid) -> PostcardDeleteResponse` **delete** `/print-mail/v1/order_profiles/postcards/{id}` Deletes a Postcard Profile. ### Parameters - `id: str` ### Returns - `class PostcardDeleteResponse: …` - `id: str` Unique identifier for the order profile. - `deleted: Literal[true]` - `true` - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` ### Example ```python 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 ) postcard = client.print_mail.order_profiles.postcards.delete( "id", ) print(postcard.id) ``` #### Response ```json { "id": "postcard_profile_456", "object": "postcard_profile", "deleted": true } ``` ## Domain Types ### Postcard Profile - `class PostcardProfile: …` - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["postcard_profile"]` Always `postcard_profile`. - `"postcard_profile"` - `size: PostcardSize` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` - `updated_at: datetime` Timestamp when the profile was last updated. - `back_template: Optional[str]` ID of the template for the back side. Required unless `pdf` is provided. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `front_template: Optional[str]` ID of the template for the front side. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services like `certified` or `registered` for postcards, though). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF content, if any. ### Postcard Size - `Literal["6x4", "9x6", "11x6"]` Enum representing the supported postcard sizes. - `"6x4"` - `"9x6"` - `"11x6"` # Self Mailers ## Create Self-Mailer Profile `print_mail.order_profiles.self_mailers.create(SelfMailerCreateParams**kwargs) -> SelfMailerProfile` **post** `/print-mail/v1/order_profiles/self_mailers` Creates a new Self-Mailer Profile. Provide either `insideTemplate` and `outsideTemplate` IDs, or upload a 2-page `pdf`. If providing a `pdf`, the request `Content-Type` must be `multipart/form-data`. ### Parameters - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `pdf: Optional[str]` A 2-page PDF file containing the self-mailer content (inside and outside). Cannot be used with `insideTemplate`/`outsideTemplate`. ### Returns - `class SelfMailerProfile: …` Represents a Self-Mailer Profile resource. - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) self_mailer_profile = client.print_mail.order_profiles.self_mailers.create( size="8.5x11_bifold", ) print(self_mailer_profile.id) ``` #### Response ```json { "id": "self_mailer_profile_101", "object": "self_mailer_profile", "live": false, "description": "Marketing Self-Mailer", "size": "8.5x11_bifold", "insideTemplate": "template_123", "outsideTemplate": "template_456", "mailingClass": "standard_class", "createdAt": "2023-04-25T13:00:00Z", "updatedAt": "2023-04-25T13:00:00Z" } ``` ## List Self-Mailer Profiles `print_mail.order_profiles.self_mailers.list(SelfMailerListParams**kwargs) -> SyncSkipLimit[SelfMailerProfile]` **get** `/print-mail/v1/order_profiles/self_mailers` Retrieves a list of Self-Mailer Profiles. ### Parameters - `limit: Optional[int]` - `search: Optional[str]` You can supply any string to help narrow down the list of resources. For example, if you pass `"New York"` (quoted), it will return resources that have that string present somewhere in their response. Alternatively, you can supply a structured search query. See the documentation on `StructuredSearchQuery` for more details. - `skip: Optional[int]` ### Returns - `class SelfMailerProfile: …` Represents a Self-Mailer Profile resource. - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) page = client.print_mail.order_profiles.self_mailers.list() page = page.data[0] print(page.id) ``` #### Response ```json { "data": [ { "id": "self_mailer_profile_101", "object": "self_mailer_profile", "live": false, "description": "Marketing Self-Mailer", "size": "8.5x11_bifold", "insideTemplate": "template_123", "outsideTemplate": "template_456", "mailingClass": "standard_class", "createdAt": "2023-04-25T13:00:00Z", "updatedAt": "2023-04-25T13:00:00Z" } ], "object": "list", "totalCount": 1, "limit": 1, "skip": 0 } ``` ## Retrieve Self-Mailer Profile `print_mail.order_profiles.self_mailers.retrieve(strid, SelfMailerRetrieveParams**kwargs) -> SelfMailerProfile` **get** `/print-mail/v1/order_profiles/self_mailers/{id}` Retrieves the details of a specific Self-Mailer Profile. ### Parameters - `id: str` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. ### Returns - `class SelfMailerProfile: …` Represents a Self-Mailer Profile resource. - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) self_mailer_profile = client.print_mail.order_profiles.self_mailers.retrieve( id="id", ) print(self_mailer_profile.id) ``` #### Response ```json { "id": "self_mailer_profile_101", "object": "self_mailer_profile", "live": false, "description": "Marketing Self-Mailer", "size": "8.5x11_bifold", "insideTemplate": "template_123", "outsideTemplate": "template_456", "mailingClass": "standard_class", "createdAt": "2023-04-25T13:00:00Z", "updatedAt": "2023-04-25T13:00:00Z" } ``` ## Update Self-Mailer Profile `print_mail.order_profiles.self_mailers.update(strid, SelfMailerUpdateParams**kwargs) -> SelfMailerProfile` **post** `/print-mail/v1/order_profiles/self_mailers/{id}` Updates specific fields of an existing Self-Mailer Profile. If providing a `pdf`, the request `Content-Type` must be `multipart/form-data`. ### Parameters - `id: str` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `expand: Optional[SequenceNotStr[str]]` Optional list of related resources to expand in the response. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `pdf: Optional[str]` A 2-page PDF file containing the self-mailer content (inside and outside). Cannot be used with `insideTemplate`/`outsideTemplate`. ### Returns - `class SelfMailerProfile: …` Represents a Self-Mailer Profile resource. - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Example ```python 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 ) self_mailer_profile = client.print_mail.order_profiles.self_mailers.update( id="id", size="8.5x11_bifold", ) print(self_mailer_profile.id) ``` #### Response ```json { "id": "self_mailer_profile_101", "object": "self_mailer_profile", "live": false, "description": "Marketing Self-Mailer", "size": "8.5x11_bifold", "insideTemplate": "template_123", "outsideTemplate": "template_456", "mailingClass": "standard_class", "createdAt": "2023-04-25T13:00:00Z", "updatedAt": "2023-04-25T13:00:00Z" } ``` ## Delete Self-Mailer Profile `print_mail.order_profiles.self_mailers.delete(strid) -> SelfMailerDeleteResponse` **delete** `/print-mail/v1/order_profiles/self_mailers/{id}` Deletes a Self-Mailer Profile. ### Parameters - `id: str` ### Returns - `class SelfMailerDeleteResponse: …` - `id: str` Unique identifier for the order profile. - `deleted: Literal[true]` - `true` - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` ### Example ```python 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 ) self_mailer = client.print_mail.order_profiles.self_mailers.delete( "id", ) print(self_mailer.id) ``` #### Response ```json { "id": "self_mailer_profile_101", "object": "self_mailer_profile", "deleted": true } ``` ## Domain Types ### Self Mailer Profile - `class SelfMailerProfile: …` Represents a Self-Mailer Profile resource. - `id: str` Unique identifier for the order profile. - `created_at: datetime` Timestamp when the profile was created. - `live: bool` Indicates if the profile is associated with the live or test environment. - `object: Literal["self_mailer_profile"]` Always `self_mailer_profile`. - `"self_mailer_profile"` - `size: SelfMailerSize` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"` - `updated_at: datetime` Timestamp when the profile was last updated. - `description: Optional[str]` An optional description for the profile. Set to `null` to remove during update. - `inside_template: Optional[str]` ID of the template for the inside. Required unless `pdf` is provided. - `mailing_class: Optional[Literal["first_class", "standard_class", "express", 23 more]]` Mailing class (cannot include extra services for self-mailers). - `"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"` - `merge_variables: Optional[Dict[str, object]]` Default merge variables for orders created using this profile. - `metadata: Optional[Dict[str, str]]` Optional key-value metadata. - `outside_template: Optional[str]` ID of the template for the outside. Required unless `pdf` is provided. - `uploaded_pdf: Optional[str]` A temporary, signed URL to view the uploaded PDF, if any. ### Self Mailer Size - `Literal["8.5x11_bifold", "8.5x11_trifold", "9.5x16_trifold"]` Enum representing the supported self-mailer sizes. - `"8.5x11_bifold"` - `"8.5x11_trifold"` - `"9.5x16_trifold"`