- Requirements
- Installation
- Getting Started
- Async
- Raw HTTP Response
- Reference
postmark.bounces_api.activate_bounce
postmark.bounces_api.get_bounce
postmark.bounces_api.get_delivery_stats
postmark.bounces_api.get_dump
postmark.bounces_api.list_bounces
postmark.inbound_rules_api.create_trigger
postmark.inbound_rules_api.delete_single_trigger
postmark.inbound_rules_api.list_triggers
postmark.messages_api.get_all_clicks
postmark.messages_api.get_inbound_message_details
postmark.messages_api.get_message_clicks
postmark.messages_api.get_message_dump
postmark.messages_api.get_message_opens
postmark.messages_api.get_outbound_message_details
postmark.messages_api.list_opens_for_outbound
postmark.messages_api.retry_inbound_message
postmark.messages_api.search_inbound_messages
postmark.messages_api.search_outbound_messages
postmark.messages_api.update_bypass_rules_for_inbound_message
postmark.sending_api.send_batch_emails
postmark.sending_api.send_batch_with_templates
postmark.sending_api.send_email_template
postmark.sending_api.send_single_email
postmark.server_configuration_api.get_configuration
postmark.server_configuration_api.update_configuration
postmark.stats_api.get_bounce_counts
postmark.stats_api.get_browser_platform_usage
postmark.stats_api.get_email_client_usage
postmark.stats_api.get_email_open_counts
postmark.stats_api.get_email_platform_usage
postmark.stats_api.get_outbound_click_counts
postmark.stats_api.get_outbound_clicks_browser_families
postmark.stats_api.get_outbound_clicks_location
postmark.stats_api.get_outbound_overview
postmark.stats_api.get_sent_counts
postmark.stats_api.get_spam_complaints
postmark.stats_api.get_tracked_email_counts
postmark.templates_api.create_template
postmark.templates_api.delete_template
postmark.templates_api.get_template_by_id
postmark.templates_api.list_templates
postmark.templates_api.send_batch_with_templates
postmark.templates_api.send_email_template
postmark.templates_api.update_template
postmark.templates_api.validate_template_content
Python >=3.7
from pprint import pprint
from postmark_python_sdk import Postmark, ApiException
postmark = Postmark(
server_token="YOUR_API_KEY",
)
try:
# Activate a bounce
activate_bounce_response = postmark.bounces_api.activate_bounce(
bounceid=1,
)
except ApiException as e:
print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["error_code"])
pprint(e.body["message"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
async
support is available by prepending a
to any method.
import asyncio
from pprint import pprint
from postmark_python_sdk import Postmark, ApiException
postmark = Postmark(
server_token="YOUR_API_KEY",
)
async def main():
try:
# Activate a bounce
activate_bounce_response = await postmark.bounces_api.aactivate_bounce(
bounceid=1,
)
except ApiException as e:
print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["error_code"])
pprint(e.body["message"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
asyncio.run(main())
To access raw HTTP response values, use the .raw
namespace.
from pprint import pprint
from postmark_python_sdk import Postmark, ApiException
postmark = Postmark(
server_token="YOUR_API_KEY",
)
try:
# Activate a bounce
activate_bounce_response = postmark.bounces_api.raw.activate_bounce(
bounceid=1,
)
pprint(activate_bounce_response.headers)
pprint(activate_bounce_response.status)
pprint(activate_bounce_response.round_trip_time)
except ApiException as e:
print("Exception when calling BouncesAPIApi.activate_bounce: %s\n" % e)
pprint(e.body)
if e.status == 422:
pprint(e.body["error_code"])
pprint(e.body["message"])
pprint(e.headers)
pprint(e.status)
pprint(e.reason)
pprint(e.round_trip_time)
Activate a bounce
activate_bounce_response = postmark.bounces_api.activate_bounce(
bounceid=1,
)
The ID of the Bounce to activate.
/bounces/{bounceid}/activate
put
Get a single bounce
get_bounce_response = postmark.bounces_api.get_bounce(
bounceid=1,
)
The ID of the bounce to retrieve.
/bounces/{bounceid}
get
Get delivery stats
get_delivery_stats_response = postmark.bounces_api.get_delivery_stats()
/deliverystats
get
Get bounce dump
get_dump_response = postmark.bounces_api.get_dump(
bounceid=1,
)
The ID for the bounce dump to retrieve.
/bounces/{bounceid}/dump
get
Get bounces
list_bounces_response = postmark.bounces_api.list_bounces(
count=1,
offset=1,
type="HardBounce",
inactive=True,
email_filter="string_example",
message_id="string_example",
tag="string_example",
todate="1970-01-01",
fromdate="1970-01-01",
)
Number of bounces to return per request. Max 500.
Number of bounces to skip.
Filter by type of bounce
Filter by emails that were deactivated by Postmark due to the bounce. Set to true or false. If this isn't specified it will return both active and inactive.
Filter by email address
Filter by messageID
Filter by tag
Filter messages up to the date specified. e.g. 2014-02-01
Filter messages starting from the date specified. e.g. 2014-02-01
/bounces
get
Create an inbound rule trigger
create_trigger_response = postmark.inbound_rules_api.create_trigger(
body=None,
rule="string_example",
)
/triggers/inboundrules
post
Delete a single trigger
delete_single_trigger_response = postmark.inbound_rules_api.delete_single_trigger(
triggerid=1,
)
The ID of the Inbound Rule that should be deleted.
/triggers/inboundrules/{triggerid}
delete
List inbound rule triggers
list_triggers_response = postmark.inbound_rules_api.list_triggers(
count=1,
offset=1,
)
Number of records to return per request.
Number of records to skip.
/triggers/inboundrules
get
Clicks for a all messages
get_all_clicks_response = postmark.messages_api.get_all_clicks(
count=1,
offset=1,
recipient="string_example",
tag="string_example",
client_name="string_example",
client_company="string_example",
client_family="string_example",
os_name="string_example",
os_family="string_example",
os_company="string_example",
platform="string_example",
country="string_example",
region="string_example",
city="string_example",
)
Number of message clicks to return per request. Max 500.
Number of messages to skip
Filter by To, Cc, Bcc
Filter by tag
Filter by client name, i.e. Outlook, Gmail
Filter by company, i.e. Microsoft, Apple, Google
Filter by client family, i.e. OS X, Chrome
Filter by full OS name and specific version, i.e. OS X 10.9 Mavericks, Windows 7
Filter by kind of OS used without specific version, i.e. OS X, Windows
Filter by company which produced the OS, i.e. Apple Computer, Inc., Microsoft Corporation
Filter by platform, i.e. webmail, desktop, mobile
Filter by country messages were opened in, i.e. Denmark, Russia
Filter by full name of region messages were opened in, i.e. Moscow, New York
Filter by full name of region messages were opened in, i.e. Moscow, New York
/messages/outbound/clicks
get
Inbound message details
get_inbound_message_details_response = (
postmark.messages_api.get_inbound_message_details(
messageid="messageid_example",
)
)
The ID of the message for which to details will be retrieved.
/messages/inbound/{messageid}/details
get
Retrieve Message Clicks
get_message_clicks_response = postmark.messages_api.get_message_clicks(
messageid="messageid_example",
count=1,
offset=0,
)
The ID of the Outbound Message for which click statistics should be retrieved.
Number of message clicks to return per request. Max 500.
Number of messages to skip.
/messages/outbound/clicks/{messageid}
get
Outbound message dump
get_message_dump_response = postmark.messages_api.get_message_dump(
messageid="messageid_example",
)
The ID of the message for which to retrieve a dump.
/messages/outbound/{messageid}/dump
get
Retrieve Message Opens
get_message_opens_response = postmark.messages_api.get_message_opens(
messageid="messageid_example",
count=1,
offset=0,
)
The ID of the Outbound Message for which open statistics should be retrieved.
Number of message opens to return per request. Max 500.
Number of messages to skip.
/messages/outbound/opens/{messageid}
get
Outbound message details
get_outbound_message_details_response = (
postmark.messages_api.get_outbound_message_details(
messageid="messageid_example",
)
)
The ID of the message for which to retrieve details.
/messages/outbound/{messageid}/details
get
Opens for all messages
list_opens_for_outbound_response = postmark.messages_api.list_opens_for_outbound(
count=1,
offset=1,
recipient="string_example",
tag="string_example",
client_name="string_example",
client_company="string_example",
client_family="string_example",
os_name="string_example",
os_family="string_example",
os_company="string_example",
platform="string_example",
country="string_example",
region="string_example",
city="string_example",
)
Number of message opens to return per request. Max 500.
Number of messages to skip
Filter by To, Cc, Bcc
Filter by tag
Filter by client name, i.e. Outlook, Gmail
Filter by company, i.e. Microsoft, Apple, Google
Filter by client family, i.e. OS X, Chrome
Filter by full OS name and specific version, i.e. OS X 10.9 Mavericks, Windows 7
Filter by kind of OS used without specific version, i.e. OS X, Windows
Filter by company which produced the OS, i.e. Apple Computer, Inc., Microsoft Corporation
Filter by platform, i.e. webmail, desktop, mobile
Filter by country messages were opened in, i.e. Denmark, Russia
Filter by full name of region messages were opened in, i.e. Moscow, New York
Filter by full name of region messages were opened in, i.e. Moscow, New York
/messages/outbound/opens
get
Retry a failed inbound message for processing
retry_inbound_message_response = postmark.messages_api.retry_inbound_message(
messageid="messageid_example",
)
The ID of the inbound message on which we should retry processing.
/messages/inbound/{messageid}/retry
put
Inbound message search
search_inbound_messages_response = postmark.messages_api.search_inbound_messages(
count=1,
offset=1,
recipient="string_example",
fromemail="string_example",
subject="string_example",
mailboxhash="string_example",
tag="string_example",
status="blocked",
todate="1970-01-01",
fromdate="1970-01-01",
)
Number of messages to return per request. Max 500.
Number of messages to skip
Filter by the user who was receiving the email
Filter by the sender email address
Filter by email subject
Filter by mailboxhash
Filter by tag
Filter by status (blocked
, processed
, queued
, failed
, scheduled
)
Filter messages up to the date specified. e.g. 2014-02-01
Filter messages starting from the date specified. e.g. 2014-02-01
/messages/inbound
get
Outbound message search
search_outbound_messages_response = postmark.messages_api.search_outbound_messages(
count=1,
offset=1,
recipient="string_example",
fromemail="string_example",
tag="string_example",
status="queued",
todate="1970-01-01",
fromdate="1970-01-01",
)
Number of messages to return per request. Max 500.
Number of messages to skip
Filter by the user who was receiving the email
Filter by the sender email address
Filter by tag
Filter by status (queued
or sent
)
Filter messages up to the date specified. e.g. 2014-02-01
Filter messages starting from the date specified. e.g. 2014-02-01
/messages/outbound
get
Bypass rules for a blocked inbound message
update_bypass_rules_for_inbound_message_response = (
postmark.messages_api.update_bypass_rules_for_inbound_message(
messageid="messageid_example",
)
)
The ID of the message which should bypass inbound rules.
/messages/inbound/{messageid}/bypass
put
Send a batch of emails
send_batch_emails_response = postmark.sending_api.send_batch_emails(
body=[None],
)
/email/batch
post
Send a batch of email using templates.
send_batch_with_templates_response = postmark.sending_api.send_batch_with_templates(
body=None,
messages=[None],
)
SendEmailTemplatedBatchRequest
/email/batchWithTemplates
post
Send an email using a Template
send_email_template_response = postmark.sending_api.send_email_template(
body=None,
_from="string_example",
template_alias="string_example",
template_id=1,
template_model={},
to="string_example",
attachments=[None],
bcc="string_example",
cc="string_example",
headers=[None],
inline_css=True,
reply_to="string_example",
tag="string_example",
track_links="None",
track_opens=True,
)
Required if 'TemplateId' is not specified.
Required if 'TemplateAlias' is not specified.
attachments: AttachmentCollection
headers: HeaderCollection
Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.
Activate open tracking for this email.
/email/withTemplate
post
Send a single email
send_single_email_response = postmark.sending_api.send_single_email(
body=None,
attachments=[None],
bcc="string_example",
cc="string_example",
_from="string_example",
headers=[None],
html_body="string_example",
reply_to="string_example",
subject="string_example",
tag="string_example",
text_body="string_example",
to="string_example",
track_links="None",
track_opens=True,
)
attachments: AttachmentCollection
Bcc recipient email address. Multiple addresses are comma seperated. Max 50.
Recipient email address. Multiple addresses are comma seperated. Max 50.
The sender email address. Must have a registered and confirmed Sender Signature.
headers: HeaderCollection
If no TextBody specified HTML email message
Reply To override email address. Defaults to the Reply To set in the sender signature.
Email Subject
Email tag that allows you to categorize outgoing emails and get detailed statistics.
If no HtmlBody specified Plain text email message
Recipient email address. Multiple addresses are comma seperated. Max 50.
Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.
Activate open tracking for this email.
/email
post
Get Server Configuration
get_configuration_response = postmark.server_configuration_api.get_configuration()
/server
get
Edit Server Configuration
update_configuration_response = postmark.server_configuration_api.update_configuration(
body=None,
bounce_hook_url="string_example",
click_hook_url="string_example",
color="purple",
delivery_hook_url="string_example",
inbound_domain="string_example",
inbound_hook_url="string_example",
inbound_spam_threshold=1,
name="string_example",
open_hook_url="string_example",
post_first_open_only=True,
raw_email_enabled=True,
smtp_api_activated=True,
track_links="None",
track_opens=True,
)
Webhook url allowing real-time notification when tracked links are clicked.
EditServerConfigurationRequest
The settings that should be modified for the current server.
/server
put
Get bounce counts
get_bounce_counts_response = postmark.stats_api.get_bounce_counts(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/bounces
get
Get browser plaform usage
get_browser_platform_usage_response = postmark.stats_api.get_browser_platform_usage(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/clicks/platforms
get
Get email client usage
get_email_client_usage_response = postmark.stats_api.get_email_client_usage(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/opens/emailclients
get
Get email open counts
get_email_open_counts_response = postmark.stats_api.get_email_open_counts(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/opens
get
Get email platform usage
get_email_platform_usage_response = postmark.stats_api.get_email_platform_usage(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/opens/platforms
get
Get click counts
get_outbound_click_counts_response = postmark.stats_api.get_outbound_click_counts(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/clicks
get
Get browser usage by family
get_outbound_clicks_browser_families_response = (
postmark.stats_api.get_outbound_clicks_browser_families(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/clicks/browserfamilies
get
Get clicks by body location
get_outbound_clicks_location_response = postmark.stats_api.get_outbound_clicks_location(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/clicks/location
get
Get outbound overview
get_outbound_overview_response = postmark.stats_api.get_outbound_overview(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound
get
Get sent counts
get_sent_counts_response = postmark.stats_api.get_sent_counts(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/sends
get
Get spam complaints
get_spam_complaints_response = postmark.stats_api.get_spam_complaints(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats up to the date specified. e.g. 2014-02-01
/stats/outbound/spam
get
Get tracked email counts
get_tracked_email_counts_response = postmark.stats_api.get_tracked_email_counts(
tag="string_example",
fromdate="1970-01-01",
todate="1970-01-01",
)
Filter by tag
Filter stats starting from the date specified. e.g. 2014-01-01
Filter stats starting from the date specified. e.g. 2014-01-01
/stats/outbound/tracked
get
Create a Template
create_template_response = postmark.templates_api.create_template(
body=None,
name="string_example",
subject="string_example",
alias="string_example",
html_body="string_example",
text_body="string_example",
)
The friendly display name for the template.
The Subject template definition for this Template.
The optional string identifier for referring to this Template (numbers, letters, and '.', '-', '_' characters, starts with a letter).
The HTML template definition for this Template.
The Text template definition for this Template.
/templates
post
Delete a Template
delete_template_response = postmark.templates_api.delete_template(
template_id_or_alias="templateIdOrAlias_example",
)
The 'TemplateID' or 'Alias' value for the Template you wish to delete.
/templates/{templateIdOrAlias}
delete
Get a Template
get_template_by_id_response = postmark.templates_api.get_template_by_id(
template_id_or_alias="templateIdOrAlias_example",
)
The 'TemplateID' or 'Alias' value for the Template you wish to retrieve.
/templates/{templateIdOrAlias}
get
Get the Templates associated with this Server
list_templates_response = postmark.templates_api.list_templates(
count=3.14,
offset=3.14,
)
The number of Templates to return
The number of Templates to "skip" before returning results.
/templates
get
Send a batch of email using templates.
send_batch_with_templates_response = postmark.templates_api.send_batch_with_templates(
body=None,
messages=[None],
)
SendEmailTemplatedBatchRequest
/email/batchWithTemplates
post
Send an email using a Template
send_email_template_response = postmark.templates_api.send_email_template(
body=None,
_from="string_example",
template_alias="string_example",
template_id=1,
template_model={},
to="string_example",
attachments=[None],
bcc="string_example",
cc="string_example",
headers=[None],
inline_css=True,
reply_to="string_example",
tag="string_example",
track_links="None",
track_opens=True,
)
Required if 'TemplateId' is not specified.
Required if 'TemplateAlias' is not specified.
attachments: AttachmentCollection
headers: HeaderCollection
Replace links in content to enable \"click tracking\" stats. Default is 'null', which uses the server's LinkTracking setting'.
Activate open tracking for this email.
/email/withTemplate
post
Update a Template
update_template_response = postmark.templates_api.update_template(
body=None,
template_id_or_alias="templateIdOrAlias_example",
alias="string_example",
html_body="string_example",
name="string_example",
subject="string_example",
text_body="string_example",
)
The 'TemplateID' or 'Alias' value for the Template you wish to update.
The optional string identifier for referring to this Template (numbers, letters, and '.', '-', '_' characters, starts with a letter).
The HTML template definition for this Template.
The friendly display name for the template.
The Subject template definition for this Template.
The Text template definition for this Template.
/templates/{templateIdOrAlias}
put
Test Template Content
validate_template_content_response = postmark.templates_api.validate_template_content(
body=None,
html_body="string_example",
inline_css_for_html_test_render=True,
subject="string_example",
test_render_model={},
text_body="string_example",
)
The html body content to validate. Must be specified if Subject or TextBody are not. See our template language documentation for more information on the syntax for this field.
When HtmlBody is specified, the test render will have style blocks inlined as style attributes on matching html elements. You may disable the css inlining behavior by passing false for this parameter.
The subject content to validate. Must be specified if HtmlBody or TextBody are not. See our template language documentation for more information on the syntax for this field.
The model to be used when rendering test content.
The text body content to validate. Must be specified if HtmlBody or Subject are not. See our template language documentation for more information on the syntax for this field.
/templates/validate
post
This Python package is automatically generated by Konfig