{
  "openapi": "3.0.1",
  "info": {
    "title": "SecuMailer Public API",
    "version": "1.3.8"
  },
  "servers": [
    {
      "url": "https://test-public-api.secumail.nl/",
      "description": "Acceptance Environment for SecuMailer Public API"
    },
    {
      "url": "https://public-api.secumail.nl/",
      "description": "Production Environment for SecuMailer Public API"
    }
  ],
  "paths": {
    "/message": {
      "post": {
        "description": "Sends a secure email. Each email must have a sender, recipient(s) and a MIME encoded, escaped email message. **Each email must have an unique Message-ID in the message body**.\n\nIf you are sending NTA 7516 compliant emails, you must include the X-SecuMailer-NTA7516:true header in the header part of the body attribute.\n\nIf you require 2FA authentication of the recipient(s) you can add the mobile phone number of any recipient to the email address used in “To/Cc/Bcc” header in the header part of the body attribute. This can be done with the following syntax: \n\\<+country code\\>\\<phone number\\>+\\<email address\\>.\n\nExample: +31612345678+test@email.com",
        "operationId": "setMessage",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Message"
              },
              "example": "{ \"sender\": \"sender@example.com\", \"recipient\": [\"recipient@example.net\"], \"body\": \"From: \\\"Test Sender\\\" <sender@example.com>\\r\\nTo: \\\"Test Recipient\\\" <recipient@example.net>\\r\\nMessage-ID: <HE1PR03MB15630A98B97B714C5E9CADCF9F920@HE1PR03MB1563.eurprd03.prod.outlook.com>\\r\\nDate: Fri, 7 Jun 2019 17:20:19 +0000\\r\\nSubject: Example\\r\\nContent-Type: multipart\\/mixed;\\r\\n        boundary=\\\"_004_6a168860dad6479d9ef568358d518ee5_\\\"\\r\\nMIME-Version: 1.0\\r\\n\\r\\n--_004_6a168860dad6479d9ef568358d518ee5_\\r\\nContent-Type: multipart\\/alternative;\\r\\n        boundary=\\\"_000_6a168860dad6479d9ef568358d518ee5_\\\"\\r\\n\\r\\n--_000_6a168860dad6479d9ef568358d518ee5_\\r\\nContent-Type: text\\/plain; charset=\\\"iso-8859-1\\\"\\r\\nContent-Transfer-Encoding: quoted-printable\\r\\n\\r\\n\\r\\n\\r\\n--_000_6a168860dad6479d9ef568358d518ee5_\\r\\nContent-Type: text\\/html; charset=\\\"iso-8859-1\\\"\\r\\nContent-Transfer-Encoding: quoted-printable\\r\\n\\r\\n<html>\\r\\n<head>\\r\\n<meta http-equiv=3D\\\"Content-Type\\\" content=3D\\\"text\\/html; charset=3Diso-8859-=\\r\\n1\\\">\\r\\n<style type=3D\\\"text\\/css\\\" style=3D\\\"display:none;\\\"><!-- P {margin-top:0;margi=\\r\\nn-bottom:0;} --><\\/style>\\r\\n<\\/head>\\r\\n<body dir=3D\\\"ltr\\\">\\r\\n<div id=3D\\\"divtagdefaultwrapper\\\" style=3D\\\"font-size:12pt;color:#000000;font=\\r\\n-family:Calibri,Helvetica,sans-serif;\\\" dir=3D\\\"ltr\\\">\\r\\n<p><br>\\r\\n<\\/p>\\r\\n<\\/div>\\r\\n<\\/body>\\r\\n<\\/html>\\r\\n\\r\\n--_000_6a168860dad6479d9ef568358d518ee5_--\\r\\n\\r\\n--_004_6a168860dad6479d9ef568358d518ee5_\\r\\nContent-Type: application\\/vnd.ms-excel; name=\\\"data.csv\\\"\\r\\nContent-Description: data.csv\\r\\nContent-Disposition: attachment; filename=\\\"data.csv\\\"; size=532;\\r\\n        creation-date=\\\"Sun, 01 Jul 2018 17:20:49 GMT\\\";\\r\\n        modification-date=\\\"Sun, 01 Jul 2018 17:20:49 GMT\\\"\\r\\nContent-Transfer-Encoding: base64\\r\\n\\r\\ndGltZSxEZWxpdmVyZWQsU3VwcHJlc3NlZCxEcm9wcGVkLFBvc3RzIHZpYSBSb3V0ZXMKU2F0IE1h\\r\\neSAxOSAyMDE4IDAyOjAwOjAwIEdNVCswMjAwIChXZXN0LUV1cm9wYSAoem9tZXJ0aWpkKSksMTAs\\r\\nMCwxOCwwClN1biBNYXkgMjAgMjAxOCAwMjowMDowMCBHTVQrMDIwMCAoV2VzdC1FdXJvcGEgKHpv\\r\\nbWVydGlqZCkpLDUsMCw0LDAKTW9uIE1heSAyMSAyMDE4IDAyOjAwOjAwIEdNVCswMjAwIChXZXN0\\r\\nLUV1cm9wYSAoem9tZXJ0aWpkKSksOCwwLDQsMApUdWUgTWF5IDIyIDIwMTggMDI6MDA6MDAgR01U\\r\\nKzAyMDAgKFdlc3QtRXVyb3BhICh6b21lcnRpamQpKSwzMSwwLDQsMApXZWQgTWF5IDIzIDIwMTgg\\r\\nMDI6MDA6MDAgR01UKzAyMDAgKFdlc3QtRXVyb3BhICh6b21lcnRpamQpKSwzMCwwLDAsMApUaHUg\\r\\nTWF5IDI0IDIwMTggMDI6MDA6MDAgR01UKzAyMDAgKFdlc3QtRXVyb3BhICh6b21lcnRpamQpKSw0\\r\\nMSwwLDEsMApGcmkgTWF5IDI1IDIwMTggMDI6MDA6MDAgR01UKzAyMDAgKFdlc3QtRXVyb3BhICh6\\r\\nb21lcnRpamQpKSwzNywwLDAsMA==\\r\\n\\r\\n--_004_6a168860dad6479d9ef568358d518ee5_--\\r\\n\" }\n"
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Created"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "500": {
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      },
      "options": {
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Headers": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Empty"
                }
              }
            }
          }
        }
      }
    },
    "/account": {
      "get": {
        "description": "Retrieves DNS configuration for an organization",
        "operationId": "getAccount",
        "parameters": [
          {
            "name": "domain",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Domain"
            }
          },
          {
            "name": "reseller",
            "in": "query",
            "required": true,
            "schema": {
              "$ref": "#/components/schemas/Reseller"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "$ref": "#/components/schemas/AccountStatus"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AccountResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "404": {
            "description": "Not Found",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "500": {
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      },
      "post": {
        "description": "Creates a new account for an organization",
        "operationId": "setAccount",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Account"
              },
              "example": {
                "domain": "customer.com",
                "reseller": "info@secumailer.com",
                "org": "SecuMailer",
                "prefix": "secumailer",
                "user": "webshop@secumailer.com",
                "contact": "someone@customer.com"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Created",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Created"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "500": {
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      }
    },
    "/address": {
      "post": {
        "description": "Creates a new address for an organization",
        "operationId": "setAddress",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddressPhonenumber"
              },
              "example": {
                "mailbox": "info@secumailer.com",
                "address": "user@example.com",
                "phonenumber": "+31612312300",
                "shared_password": "abcde12345"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "400": {
            "description": "Bad Request",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          },
          "403": {
            "description": "Forbidden",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {}
          }
        },
        "security": [
          {
            "api_key": []
          }
        ]
      },
      "options": {
        "responses": {
          "200": {
            "description": "200 response",
            "headers": {
              "Access-Control-Allow-Origin": {
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Methods": {
                "schema": {
                  "type": "string"
                }
              },
              "Access-Control-Allow-Headers": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Empty"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Empty": {
        "title": "Empty Schema",
        "type": "object"
      },
      "Account": {
        "required": [
          "domain",
          "reseller"
        ],
        "type": "object",
        "properties": {
          "domain": {
            "$ref": "#/components/schemas/Domain"
          },
          "reseller": {
            "$ref": "#/components/schemas/Reseller"
          },
          "org": {
            "$ref": "#/components/schemas/Organization"
          },
          "prefix": {
            "$ref": "#/components/schemas/Prefix"
          },
          "user": {
            "$ref": "#/components/schemas/User"
          },
          "contact": {
            "$ref": "#/components/schemas/Address"
          }
        },
        "description": "An account consists of an apex domain and a reseller identifier."
      },
      "AddressPhonenumber": {
        "required": [
          "address",
          "mailbox"
        ],
        "type": "object",
        "properties": {
          "mailbox": {
            "type": "string",
            "description": "Mailbox to update address assignment for"
          },
          "address": {
            "$ref": "#/components/schemas/Address"
          },
          "phonenumber": {
            "type": "string",
            "description": "Phonenumber associated with the address (will be removed if null)",
            "nullable": true
          },
          "shared_password": {
            "type": "string",
            "description": "Shared password",
            "nullable": true
          }
        },
        "description": "Address consists of a mailbox id, address to add/update and a phone number / shared password (if available)"
      },
      "Domain": {
        "type": "string",
        "description": "Sender apex (root) domain",
        "example": "example.com"
      },
      "Reseller": {
        "type": "string",
        "description": "Reseller identifier",
        "example": "info@secumailer.com"
      },
      "AccountStatus": {
        "type": "boolean",
        "description": "Whether status info needs to be provided"
      },
      "Organization": {
        "type": "string",
        "description": "Organization name",
        "example": "SecuMailer"
      },
      "Prefix": {
        "type": "string",
        "description": "Organization prefix",
        "example": "secumailer",
        "default": "secumailer"
      },
      "User": {
        "type": "string",
        "description": "Logged in user",
        "example": "webshop@secumailer.com"
      },
      "Status": {
        "type": "string",
        "description": "DNS Record status",
        "enum": [
          "Pending",
          "Success",
          "Failed",
          "TemporaryFailure",
          "NotStarted"
        ]
      },
      "AccountResponse": {
        "type": "object",
        "properties": {
          "domain": {
            "$ref": "#/components/schemas/Domain"
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          },
          "mail_from": {
            "$ref": "#/components/schemas/Record"
          },
          "ses": {
            "$ref": "#/components/schemas/Record"
          },
          "mx": {
            "$ref": "#/components/schemas/Record"
          },
          "spf": {
            "$ref": "#/components/schemas/Record"
          },
          "dmarc": {
            "$ref": "#/components/schemas/Record"
          },
          "dkim": {
            "$ref": "#/components/schemas/Dkim"
          },
          "byo_dkim": {
            "$ref": "#/components/schemas/Record"
          }
        },
        "description": "Definition of the DNS records needed to connect with SecuMailer.",
        "example": {
          "domain": "example.com",
          "status": "Pending",
          "mail_from": {
            "hostname": "secumailer.example.com",
            "value": "secumailer.example.com",
            "status": "Success",
            "current": "secumailer.example.com"
          },
          "ses": {
            "hostname": "_amazonses.example.com",
            "value": "RsDYehqnkyd6xPZ8i7i5dKawKrOWlveYmN1q6ahL9Gw=",
            "status": "Success",
            "type": "TXT",
            "current": "RsDYehqnkyd6xPZ8i7i5dKawKrOWlveYmN1q6ahL9Gw="
          },
          "mx": {
            "hostname": "secumailer.example.com",
            "type": "MX",
            "status": "Pending",
            "current": ""
          },
          "spf": {
            "value": "v=spf1 include:amazonses.com ~all",
            "hostname": "secumailer.example.com",
            "type": "TXT",
            "status": "Pending",
            "current": ""
          },
          "dmarc": {
            "value": "v=DMARC1; p=quarantine; rua=mailto:8c831832697b686@rep.dmarcanalyzer.com; ruf=mailto:8c831832697b686@for.dmarcanalyzer.com; pct=0; fo=1",
            "hostname": "secumailer.example.com",
            "type": "TXT",
            "status": "Success",
            "current": "v=DMARC1; p=quarantine; rua=mailto:8c831832697b686@rep.dmarcanalyzer.com; ruf=mailto:8c831832697b686@for.dmarcanalyzer.com; pct=0; fo=1"
          },
          "dkim": {
            "status": "Success",
            "record": [
              {
                "hostname": "iqsoatpttzwavc2yb3hq75ediqpjeeku._domainkey.example.com",
                "value": "iqsoatpttzwavc2yb3hq75ediqpjeeku.dkim.amazonses.com",
                "type": "CNAME",
                "status": "Success",
                "current": "iqsoatpttzwavc2yb3hq75ediqpjeeku.dkim.amazonses.com"
              },
              {
                "hostname": "lfcu2hicdak2vaqpbj3ugi3fphg7wpid._domainkey.example.com",
                "value": "lfcu2hicdak2vaqpbj3ugi3fphg7wpid.dkim.amazonses.com",
                "type": "CNAME",
                "current": "lfcu2hicdak2vaqpbj3ugi3fphg7wpid.dkim.amazonses.com"
              },
              {
                "hostname": "h2oen5nn35wue2xedvcitxnsxydpatst._domainkey.example.com",
                "value": "h2oen5nn35wue2xedvcitxnsxydpatst.dkim.amazonses.com",
                "type": "CNAME",
                "current": "h2oen5nn35wue2xedvcitxnsxydpatst.dkim.amazonses.com"
              }
            ]
          },
          "byo_dkim": {
            "status": "Pending",
            "hostname": "7nwj3mldh1ilf3lfjeza3fax87xcs0p2kwmh._domainkey.example.com",
            "value": "7nwj3mldh1ilf3lfjeza3fax87xcs0p2kwmh.secumail.email",
            "type": "CNAME",
            "current": ""
          }
        }
      },
      "Dkim": {
        "type": "object",
        "properties": {
          "record": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Record"
            }
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          }
        },
        "description": "DKIM configuration"
      },
      "Record": {
        "required": [
          "hostname",
          "type",
          "value"
        ],
        "type": "object",
        "properties": {
          "type": {
            "type": "string",
            "description": "Either a TXT, MX or CNAME record",
            "enum": [
              "TXT",
              "MX",
              "CNAME"
            ]
          },
          "hostname": {
            "type": "string",
            "description": "Hostname of the DNS record"
          },
          "value": {
            "type": "string",
            "description": "Value of the DNS record"
          },
          "status": {
            "$ref": "#/components/schemas/Status"
          },
          "current": {
            "type": "string",
            "description": "Current DNS value"
          }
        },
        "description": "Definition of a DNS record."
      },
      "Message": {
        "required": [
          "body",
          "recipient",
          "sender"
        ],
        "type": "object",
        "properties": {
          "sender": {
            "$ref": "#/components/schemas/Address"
          },
          "recipient": {
            "$ref": "#/components/schemas/Recipient"
          },
          "body": {
            "$ref": "#/components/schemas/Body"
          }
        },
        "description": "Definition of an email message."
      },
      "Address": {
        "type": "string",
        "description": "Email address in RFC 2822 format.",
        "format": "email"
      },
      "Recipient": {
        "type": "array",
        "description": "One or more recipient email address(es)",
        "items": {
          "$ref": "#/components/schemas/Address"
        }
      },
      "Body": {
        "type": "string",
        "description": "MIME message, formatted as escaped text."
      },
      "Created": {
        "required": [
          "CreationDateTime"
        ],
        "type": "object",
        "properties": {
          "CreationDateTime": {
            "type": "string",
            "format": "date-time"
          }
        },
        "description": "ISO 8601 datetime at which the resource was created."
      }
    },
    "securitySchemes": {
      "api_key": {
        "type": "apiKey",
        "name": "x-api-key",
        "in": "header"
      }
    }
  },
  "tags": []
}