swagger: "2.0"
host: api.postmarkapp.com
basePath: /
info:
  description: |
    Postmark makes sending and receiving email
    incredibly easy. The Account-level API allows users to
    configure all Servers, Domains, and Sender Signatures associated
    with an Account.
  title: Postmark Account-level API
  version: 0.9.0
  x-apisguru-categories:
    - email
  x-logo:
    url: https://api.apis.guru/v2/cache/logo/https_pbs.twimg.com_profile_images_879295889185157120_ZYlwxzeY_400x400.jpg
  x-origin:
    - format: swagger
      url: https://postmarkapp.com/swagger/account.yml
      version: "2.0"
  x-providerName: postmarkapp.com
  x-serviceName: account
consumes:
  - application/json
produces:
  - application/json
responses:
  "422":
    description: An error was generated due to incorrect use of the API. See the Message associated with this response for more information.
    schema:
      $ref: "#/definitions/StandardPostmarkResponse"
  "500":
    description: Indicates an internal server error occurred.
paths:
  /domains:
    get:
      operationId: listDomains
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: Number of records to return per request. Max 500.
          in: query
          maximum: 500
          minimum: 1
          name: count
          required: true
          type: integer
        - description: Number of records to skip
          in: query
          minimum: 0
          name: offset
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainListingResults"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: List Domains
      tags:
        - Domains API
    post:
      operationId: createDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - in: body
          name: body
          schema:
            $ref: "#/definitions/DomainCreationModel"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Create a Domain
      tags:
        - Domains API
  "/domains/{domainid}":
    delete:
      operationId: deleteDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain that should be deleted by the request.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/StandardPostmarkResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Delete a Domain
      tags:
        - Domains API
    get:
      operationId: getDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain that should be retrieved.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Get a Domain
      tags:
        - Domains API
    put:
      operationId: editDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain that should be modified by the request.
          in: path
          name: domainid
          required: true
          type: integer
        - in: body
          name: body
          schema:
            $ref: "#/definitions/DomainEditingModel"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Update a Domain
      tags:
        - Domains API
  "/domains/{domainid}/rotatedkim":
    post:
      description: |
        Creates a new DKIM key to replace your current key. Until the DNS entries are confirmed,
        the new values will be in the `DKIMPendingHost` and `DKIMPendingTextValue` fields.
        After the new DKIM value is verified in DNS, the pending values will migrate to
        `DKIMTextValue` and `DKIMPendingTextValue` and Postmark will begin to sign emails
        with the new DKIM key.
      operationId: rotateDKIMKeyForDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature for which a new DKIM Key should be generated.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DKIMRotationResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Rotate DKIM Key
      tags:
        - Domains API
  "/domains/{domainid}/verifydkim":
    put:
      operationId: requestDkimVerificationForDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain for which DKIM DNS records should be verified.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Request DNS Verification for DKIM
      tags:
        - Domains API
  "/domains/{domainid}/verifyreturnpath":
    put:
      operationId: requestReturnPathVerificationForDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain for which Return-Path DNS records should be verified.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Request DNS Verification for Return-Path
      tags:
        - Domains API
  "/domains/{domainid}/verifyspf":
    post:
      operationId: requestSPFVerificationForDomain
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Domain for which SPF DNS records should be verified.
          in: path
          name: domainid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/DomainSPFResult"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Request DNS Verification for SPF
      tags:
        - Domains API
  /senders:
    get:
      operationId: listSenderSignatures
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: Number of records to return per request. Max 500.
          in: query
          maximum: 500
          minimum: 1
          name: count
          required: true
          type: integer
        - description: Number of records to skip
          in: query
          minimum: 0
          name: offset
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SenderListingResults"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: List Sender Signatures
      tags:
        - Sender Signatures API
    post:
      operationId: createSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - in: body
          name: body
          schema:
            $ref: "#/definitions/SenderSignatureCreationModel"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SenderSignatureExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Create a Sender Signature
      tags:
        - Sender Signatures API
  "/senders/{signatureid}":
    delete:
      operationId: deleteSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature that should be deleted by the request.
          in: path
          name: signatureid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/StandardPostmarkResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Delete a Sender Signature
      tags:
        - Sender Signatures API
    get:
      operationId: getSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature that should be retrieved.
          in: path
          name: signatureid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SenderSignatureExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Get a Sender Signature
      tags:
        - Sender Signatures API
    put:
      operationId: editSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature that should be modified by the request.
          in: path
          name: signatureid
          required: true
          type: integer
        - in: body
          name: body
          schema:
            $ref: "#/definitions/SenderSignatureEditingModel"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SenderSignatureExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Update a Sender Signature
      tags:
        - Sender Signatures API
  "/senders/{signatureid}/requestnewdkim":
    post:
      description: |
        Requests a new DKIM key to be created. Until the DNS entries are confirmed,
        the new values will be in the `DKIMPendingHost` and `DKIMPendingTextValue` fields.
        After the new DKIM value is verified in DNS, the pending values will migrate to
        `DKIMTextValue` and `DKIMPendingTextValue` and Postmark will begin to sign emails
        with the new DKIM key.
      operationId: requestNewDKIMKeyForSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature for which a new DKIM Key should be generated.
          in: path
          name: signatureid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/StandardPostmarkResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Request a new DKIM Key
      tags:
        - Sender Signatures API
  "/senders/{signatureid}/resend":
    post:
      operationId: resendSenderSignatureConfirmationEmail
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature that should have its confirmation email resent.
          in: path
          name: signatureid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/StandardPostmarkResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Resend Signature Confirmation Email
      tags:
        - Sender Signatures API
  "/senders/{signatureid}/verifyspf":
    post:
      operationId: requestSPFVerificationForSenderSignature
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID for the Sender Signature for which SPF DNS records should be verified.
          in: path
          name: signatureid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/SenderSignatureExtendedInformation"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Request DNS Verification for SPF
      tags:
        - Sender Signatures API
  /servers:
    get:
      operationId: listServers
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: Number of servers to return per request.
          in: query
          name: count
          required: true
          type: integer
        - description: Number of servers to skip.
          in: query
          name: offset
          required: true
          type: integer
        - description: Filter by a specific server name
          in: query
          name: name
          type: string
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ServerListingResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: List servers
      tags:
        - Server Management API
    post:
      operationId: createServer
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - in: body
          name: body
          schema:
            $ref: "#/definitions/CreateServerPayload"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ExtendedServerInfo"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Create a Server
      tags:
        - Server Management API
  "/servers/{serverid}":
    delete:
      operationId: deleteServer
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID of the Server that should be deleted.
          in: path
          name: serverid
          required: true
          type: integer
      responses:
        "200":
          description: OK
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Delete a Server
      tags:
        - Server Management API
    get:
      operationId: getServerInformation
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID of the Server to get.
          in: path
          name: serverid
          required: true
          type: integer
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ExtendedServerInfo"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Get a Server
      tags:
        - Server Management API
    put:
      operationId: editServerInformation
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - description: The ID of the Server to update.
          in: path
          name: serverid
          required: true
          type: integer
        - in: body
          name: body
          schema:
            $ref: "#/definitions/EditServerPayload"
      responses:
        "200":
          description: OK
          schema:
            $ref: "#/definitions/ExtendedServerInfo"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Edit a Server
      tags:
        - Server Management API
  /templates/push:
    put:
      operationId: pushTemplates
      parameters:
        - description: The token associated with the Account on which this request will operate.
          in: header
          name: X-Postmark-Account-Token
          required: true
          type: string
        - in: body
          name: body
          required: true
          schema:
            $ref: "#/definitions/TemplatesPushModel"
      responses:
        "200":
          description: ok
          schema:
            $ref: "#/definitions/TemplatesPushResponse"
        "422":
          $ref: "#/responses/422"
        "500":
          $ref: "#/responses/500"
      summary: Push templates from one server to another
      tags:
        - Templates API
definitions:
  CreateServerPayload:
    description: ""
    properties:
      BounceHookUrl:
        type: string
      ClickHookUrl:
        type: string
      Color:
        type: string
      DeliveryHookUrl:
        type: string
      InboundDomain:
        type: string
      InboundHookUrl:
        type: string
      InboundSpamThreshold:
        type: integer
      Name:
        type: string
      OpenHookUrl:
        type: string
      PostFirstOpenOnly:
        type: boolean
      RawEmailEnabled:
        type: boolean
      SmtpApiActivated:
        type: boolean
      TrackLinks:
        enum:
          - None
          - HtmlAndTextTracking
          - HtmlOnlyTracking
          - TextOnlyTracking
        type: string
      TrackOpens:
        type: boolean
  DKIMRotationResponse:
    description: ""
    properties:
      DKIMHost:
        type: string
      DKIMPendingHost:
        type: string
      DKIMPendingTextValue:
        type: string
      DKIMRevokedHost:
        type: string
      DKIMRevokedTextValue:
        type: string
      DKIMTestValue:
        type: string
      DKIMUpdateStatus:
        type: string
      DKIMVerified:
        type: boolean
      ID:
        format: int64
        type: integer
      Name:
        type: string
      SafeToRemoveRevokedKeyFromDNS:
        type: boolean
      WeakDKIM:
        type: boolean
  DomainCreationModel:
    description: ""
    properties:
      Name:
        type: string
      ReturnPathDomain:
        type: string
  DomainEditingModel:
    description: ""
    properties:
      ReturnPathDomain:
        type: string
  DomainExtendedInformation:
    description: ""
    properties:
      DKIMHost:
        type: string
      DKIMPendingHost:
        type: string
      DKIMPendingTextValue:
        type: string
      DKIMRevokedHost:
        type: string
      DKIMRevokedTextValue:
        type: string
      DKIMTestValue:
        type: string
      DKIMUpdateStatus:
        type: string
      DKIMVerified:
        type: boolean
      ID:
        format: int64
        type: integer
      Name:
        type: string
      ReturnPathDomain:
        type: string
      ReturnPathDomainCNAMEValue:
        type: string
      ReturnPathDomainVerified:
        type: boolean
      SPFHost:
        type: string
      SPFTextValue:
        type: string
      SPFVerified:
        type: boolean
      SafeToRemoveRevokedKeyFromDNS:
        type: boolean
      WeakDKIM:
        type: boolean
  DomainInformation:
    description: ""
    properties:
      DKIMVerified:
        type: boolean
      ID:
        format: int64
        type: integer
      Name:
        type: string
      ReturnPathDomainVerified:
        type: boolean
      SPFVerified:
        type: boolean
      WeakDKIM:
        type: boolean
  DomainListingResults:
    description: ""
    properties:
      Domains:
        items:
          $ref: "#/definitions/DomainInformation"
        type: array
      TotalCount:
        type: integer
  DomainSPFResult:
    description: ""
    properties:
      SPFHost:
        type: string
      SPFTextValue:
        type: string
      SPFVerified:
        type: boolean
  EditServerPayload:
    description: ""
    properties:
      BounceHookUrl:
        type: string
      ClickHookUrl:
        type: string
      Color:
        type: string
      DeliveryHookUrl:
        type: string
      InboundDomain:
        type: string
      InboundHookUrl:
        type: string
      InboundSpamThreshold:
        type: integer
      Name:
        type: string
      OpenHookUrl:
        type: string
      PostFirstOpenOnly:
        type: boolean
      RawEmailEnabled:
        type: boolean
      SmtpApiActivated:
        type: boolean
      TrackLinks:
        enum:
          - None
          - HtmlAndTextTracking
          - HtmlOnlyTracking
          - TextOnlyTracking
        type: string
      TrackOpens:
        type: boolean
  ExtendedServerInfo:
    description: ""
    properties:
      ApiTokens:
        items:
          type: string
        type: array
      BounceHookUrl:
        type: string
      ClickHookUrl:
        type: string
      Color:
        type: string
      DeliveryHookUrl:
        type: string
      ID:
        type: integer
      InboundAddress:
        type: string
      InboundDomain:
        type: string
      InboundHash:
        type: string
      InboundHookUrl:
        type: string
      InboundSpamThreshold:
        type: integer
      Name:
        type: string
      OpenHookUrl:
        type: string
      PostFirstOpenOnly:
        type: boolean
      RawEmailEnabled:
        type: boolean
      ServerLink:
        type: string
      SmtpApiActivated:
        type: boolean
      TrackLinks:
        enum:
          - None
          - HtmlAndTextTracking
          - HtmlOnlyTracking
          - TextOnlyTracking
        type: string
      TrackOpens:
        type: boolean
  SenderListingResults:
    description: ""
    properties:
      SenderSignatures:
        items:
          $ref: "#/definitions/SenderSignatureInformation"
        type: array
      TotalCount:
        type: integer
  SenderSignatureCreationModel:
    description: ""
    properties:
      FromEmail:
        format: email
        type: string
      Name:
        type: string
      ReplyToEmail:
        format: email
        type: string
      ReturnPathDomain:
        type: string
  SenderSignatureEditingModel:
    description: ""
    properties:
      Name:
        type: string
      ReplyToEmail:
        format: email
        type: string
      ReturnPathDomain:
        type: string
  SenderSignatureExtendedInformation:
    description: ""
    properties:
      Confirmed:
        type: boolean
      DKIMHost:
        type: string
      DKIMPendingHost:
        type: string
      DKIMPendingTextValue:
        type: string
      DKIMRevokedHost:
        type: string
      DKIMRevokedTextValue:
        type: string
      DKIMTestValue:
        type: string
      DKIMUpdateStatus:
        type: string
      DKIMVerified:
        type: boolean
      Domain:
        type: string
      EmailAddress:
        format: email
        type: string
      ID:
        format: int64
        type: integer
      Name:
        type: string
      ReplyToEmailAddress:
        format: email
        type: string
      ReturnPathDomain:
        type: string
      ReturnPathDomainCNAMEValue:
        type: string
      ReturnPathDomainVerified:
        type: boolean
      SPFHost:
        type: string
      SPFTextValue:
        type: string
      SPFVerified:
        type: boolean
      SafeToRemoveRevokedKeyFromDNS:
        type: boolean
      WeakDKIM:
        type: boolean
  SenderSignatureInformation:
    description: ""
    properties:
      Confirmed:
        type: boolean
      Domain:
        type: string
      EmailAddress:
        format: email
        type: string
      ID:
        format: int64
        type: integer
      Name:
        type: string
      ReplyToEmailAddress:
        format: email
        type: string
  ServerListingResponse:
    description: The results of listing servers.
    properties:
      Servers:
        items:
          $ref: "#/definitions/ExtendedServerInfo"
        type: array
      TotalCount:
        type: integer
  StandardPostmarkResponse:
    description: A Postmark API error.
    properties:
      ErrorCode:
        type: integer
      Message:
        type: string
  TemplatesPushModel:
    description: ""
    properties:
      DestinationServerId:
        type: integer
      PerformChanges:
        type: boolean
      SourceServerId:
        type: integer
  TemplatesPushResponse:
    description: ""
    properties:
      Templates:
        items:
          properties:
            Action:
              type: string
            Alias:
              type: string
            Name:
              type: string
            TemplateId:
              type: integer
        type: array
      TotalCount:
        type: integer
