In Postmark, servers are a way to organize the emails that you are sending or parsing. Each server has a unique inbound address and API token. Message activity and statistics are aggregated per server as well. You can use this to differentiate between different environments (production/staging), different clients, or different applications. You can use the
/servers API to manage the servers in your account. For full details of this endpoint, please refer to the servers API reference.
Creating a server is a pretty simple API call. Below is a discussion of some important points.
Servers belong to an account. This is different from what you might be used to with sending emails, which belong to an individual server in Postmark. To manage your servers, you will need an Account API token. Only accessible by the account owner, you can find this on the Account tab of your Postmark account. This token is used as the value for the
X-Postmark-Account-Token HTTP header. This HTTP header should be used as the authentication method for all API requests for the
/servers endpoint. If there is a problem with authentication, you will get an HTTP response with a status code of 401 (Unauthorized).
Only one field is required to create a server, the
Name field. All Postmark needs to know is what you want to call the server!
The full list of response fields is located here, but below are the subset of fields that will help you further work with servers.
IDfield is an important field to save if you want to do further things with this server, like edit or delete it.
ApiTokensarray contains the API tokens available to send email using this server. When you first create the server, this array will only have one entry, but it’s possible to create new API tokens later.
InboundHashfield is important if you plan on using inbound processing for this server. Your server has a unique email address at
:InboundHash@inbound.postmarkapp.com. Emails sent to that address will get processed for that server.
/servers API endpoint, you can fully manage your server. Some other important fields you can manage: