Back

Postmark API Essential Guide

Aug 16, 20246 minute read

What type of API does Postmark provide?

Based on the search results provided, Postmark does not appear to be mentioned specifically. However, I can provide some general information about API types and make an educated guess about Postmark's API based on common industry practices.

API Types

There are several common types of APIs used in modern web development:

  1. REST (Representational State Transfer)
  2. SOAP (Simple Object Access Protocol)
  3. GraphQL
  4. RPC (Remote Procedure Call)

Postmark's API Type

While the search results don't explicitly mention Postmark's API type, it's highly likely that Postmark uses a REST API. Here's why:

  1. REST is currently the most popular and widely used API architecture for web services.
  2. Many modern email service providers and transactional email platforms typically use REST APIs due to their simplicity and ease of use.
  3. REST APIs are well-suited for web applications and services that deal with sending and managing emails, which is Postmark's primary function.

Key Points to Consider

  • REST APIs use standard HTTP methods (GET, POST, PUT, DELETE, etc.) and typically return data in JSON format.
  • REST APIs are stateless and use resources as the main abstraction, which fits well with email-related operations.
  • REST APIs are generally easier to implement and consume compared to SOAP or GraphQL for straightforward use cases like sending emails.

Best Practices

If Postmark indeed uses a REST API (which is the most likely scenario), here are some best practices to keep in mind when working with it:

  1. Use appropriate HTTP methods for different operations (e.g., POST for sending emails, GET for retrieving information).
  2. Handle API responses and error codes properly.
  3. Implement proper authentication and security measures as required by Postmark.
  4. Consider using a client library or SDK if provided by Postmark to simplify API interactions.

To get the most accurate and up-to-date information about Postmark's API, I recommend checking their official documentation or contacting their support team directly.

Does the Postmark API have webhooks?

Yes, the official Postmark API does have webhooks. Here are the key points about Postmark's webhook functionality:

Webhook Availability

Postmark offers webhooks to notify your application when specific events occur. This allows you to receive instant notifications rather than having to poll the API for updates.

Types of Events You Can Subscribe To

Postmark allows you to subscribe to the following types of webhook events:

  1. Bounce - Notifies when an email bounces
  2. Inbound - Notifies when an inbound email is received
  3. Open - Tracks when an email is opened
  4. Delivery - Notifies when an email is successfully delivered
  5. Click - Tracks when links in an email are clicked
  6. Spam Complaint - Notifies of spam complaints
  7. Subscription Change - Notifies of changes to subscriptions

Configuring Webhooks

You can configure webhooks for specific events through the Postmark API. When setting up a webhook, you can:

  • Specify the URL to receive webhook POST requests
  • Enable/disable specific event triggers
  • Configure HTTP authentication and custom headers
  • Set options like including full content for bounces/spam complaints

Webhook Data

Webhook data is sent as JSON payloads to your specified URL. The data includes relevant information about the event that occurred.

Best Practices

  • Use HTTPS for your webhook URL
  • Validate webhook requests using IP filtering or authentication
  • Implement retry logic to handle temporary failures
  • Test webhooks using tools like RequestBin before production use

Summary

Postmark's webhook system provides a robust way to get real-time notifications about email-related events, allowing you to build responsive and data-driven applications around your email infrastructure.

Rate Limits and other limitations

Based on the search results provided, here are the key points regarding the API Rate Limits of the Postmark API:

General Rate Limits

  1. Postmark does not have a hard limit for requests per second when sending email, unlike SendGrid which has a 10,000 requests/second maximum rate for their Mail endpoint.

  2. Postmark uses a 429 HTTP response code to indicate when rate limits are exceeded. The message states: "We have detected that you are making requests at a rate that exceeds acceptable use of the API, you should reduce the rate at which you query the API. If you have specific rate requirements, please contact support to request a rate increase."

Batch Sending Limits

  1. The batch endpoint accepts up to 500 messages per API call.

  2. The total payload size, including attachments, is limited to 50 MB for the Batch Email API.

Message Size Limits

  1. For the regular Email API, the size limit is 10 MB including attachments.

  2. For the Batch Email API, the total payload size limit is 50 MB.

Recipients Limit

Postmark messages can have up to 50 recipients in a single message.

Other Considerations

  1. Postmark does not have a daily send limit, but there are certain conditions that must be met to maintain unrestricted sending:

    • Spam complaint rate should be lower than 1 in 1,000 emails (0.1%)
    • Bounce rate should be lower than 10% of all emails sent
    • Compliance with Postmark's Terms of Service
  2. If you have specific rate requirements that exceed the default limits, you can contact Postmark support to request a rate increase.

Best Practices

  1. Monitor your usage and adjust your sending rate if you receive 429 status codes.
  2. For large batch sends, ensure you stay within the 500 messages per API call limit and the 50 MB total payload size.
  3. Keep individual message sizes under 10 MB including attachments.
  4. If you consistently need higher limits, reach out to Postmark support for potential adjustments.

Remember that while Postmark doesn't have strict published rate limits like some other providers, they do monitor usage and will notify you if you exceed acceptable use. It's always best to optimize your sending patterns and work with their support team if you have high-volume needs.

Latest API Version

Based on the search results, here are the key points about the most recent version of the Postmark API:

Current API Status

The search results do not provide a specific version number for the most recent Postmark API. However, they indicate that Postmark regularly updates its API and associated libraries. Some recent updates include:

  • Support for new features like Message Streams and custom metadata
  • Updates to various language-specific libraries (PHP, Java, Node.js, .NET, etc.)
  • Addition of new endpoints and functionality

Key Points to Consider

  1. Postmark maintains libraries in multiple programming languages to make integration easier. These libraries are frequently updated to support new API features.

  2. The API now supports HTTPS only - HTTP requests are no longer supported as of April 13, 2021 for security reasons.

  3. Postmark has deprecated static IP support for API access as of August 23, 2023. This change only affects the API and not SMTP or Webhook IPs.

  4. The company regularly performs maintenance on their systems, which can temporarily affect API availability.

  5. Postmark provides detailed API documentation and an API Explorer tool for developers to test API calls.

Best Practices

  1. Always use HTTPS for API requests to ensure security.

  2. Keep your integration up-to-date by following Postmark's update announcements and upgrading to the latest library versions when available.

  3. Be aware of scheduled maintenance windows that might affect API availability.

  4. Use the provided API documentation and Explorer tool to test and understand API functionality.

  5. If you were previously using IP allowlisting for API access, you'll need to update your integration to work without it.

While the search results don't provide a specific version number, they indicate that Postmark continuously updates its API. To ensure you're using the most recent version, it's best to check Postmark's official documentation or contact their support for the most up-to-date information.

How to get a Postmark developer account and API Keys?

To get a developer account for Postmark and create an API integration, follow these steps:

1. Create a Postmark account

First, you need to sign up for a Postmark account:

  1. Go to the Postmark website (postmarkapp.com).
  2. Click on the "Sign Up" or "Get Started" button.
  3. Fill in the required information to create your account.

2. Create a server

Once you have an account, you need to create a server:

  1. Log in to your Postmark account.
  2. Click on "Create Server".
  3. Name your server and choose a color (optional).
  4. Select the server type:
    • Choose "Live" if you want to send real emails.
    • Choose "Sandbox" for testing purposes (no actual emails will be sent).

3. Obtain API tokens

To use the Postmark API, you'll need two types of tokens:

  1. Server API token:

    • After creating a server, go to the "API Tokens" tab.
    • Find and copy the "Server API token".
  2. Account API token (for account management):

    • Go to the "API Tokens" tab in your Postmark account settings.
    • Find and copy the "Account API token".

4. Set up API integration

Now you can integrate Postmark into your application:

  1. Choose the appropriate library for your programming language from Postmark's official libraries.
  2. Install the library using the package manager for your language.
  3. Use the Server API token for sending emails and accessing server-specific data.
  4. Use the Account API token for account management tasks (e.g., managing servers, sender signatures).

What can you do with the Postmark API?

Based on the search results provided, here is a list of data models you can interact with using the Postmark API, along with what is possible for each:

Emails

  • Send transactional emails via API or SMTP [1]
  • Send batch emails [1]
  • Parse and process inbound emails using webhooks [5]

Message Streams

  • Organize and manage different types of email streams [5]

Templates

  • Create and manage email templates [5]
  • Use templates for sending emails [5]

Sender Signatures

  • Add and manage sender signatures (verified sending email addresses) [1]
  • Resend confirmation emails for sender signatures [1]

Servers

  • Manage API tokens for servers [1]
  • Configure server settings [1]

Analytics and Reporting

  • Access email analytics and retention data [5]

Webhooks

  • Set up and manage inbound and outbound webhooks [5]

Account

  • Manage account-level settings and API tokens [1]

Domains

  • Configure and manage sending domains [5]
  • Set up DMARC for domains [5]

Integrations

  • Set up and manage integrations with other tools and services [5]

Key points to consider:

  • Authentication is required for all API requests using either a Server Token or Account Token [1]
  • Different endpoints require different levels of authentication (server-level vs account-level) [1]
  • The API uses REST principles and enforces TLS encryption [1]
  • There are size limits for API requests (10 MB for Email API, 50 MB for Batch Email API) [1]
  • Rate limiting is in place to prevent excessive API usage [1]

Best practices:

  • Use the appropriate authentication token for each request [1]
  • Handle API error codes and HTTP response codes appropriately in your implementation [1]
  • Consider using official or community libraries for easier integration [1]
  • Use test mode (POSTMARK_API_TEST) when implementing to avoid sending actual emails [1]

This list covers the main data models and interactions possible with the Postmark API based on the provided search results. The API allows for comprehensive management of email sending, receiving, and related functionalities.