{
  "openapi": "3.0.3",
  "info": {
    "title": "SecuMailer MailGun-compatible Mail API",
    "version": "0.1"
  },
  "servers": [
    {
      "url": "https://test-api.secumailer.com",
      "description": "Acceptance environment"
    },
    {
      "url": "https://api.secumailer.com",
      "description": "Production environment"
    }
  ],
  "paths": {
    "/mailgun/v1/send": {
      "post": {
        "tags": [
          "Mail Send"
        ],
        "summary": "Send e-mail with SecuMailer.",
        "description": "*The Mail Send operation allows you to send e-mail over SecuMailers REST API*",
        "operationId": "PostMailSend",
        "parameters": [
          {
            "name": "Content-Encoding",
            "in": "header",
            "description": "[IGNORED] This option is accepted but will not yield any result.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "gzip"
              ]
            }
          }
        ],
        "requestBody": {
          "$ref": "#/components/requestBodies/PostMailSend"
        },
        "responses": {
          "200": {
            "description": "Successful operation.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Sent"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "text/plain": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-001"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-002"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-003"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-004"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-005"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-006"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse400-007"
                    }
                  ]
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized.",
            "content": {
              "text/plain": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse401-001"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse401-002"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse401-003"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse401-004"
                    }
                  ]
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Content.",
            "content": {
              "text/plain": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse422-001"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse422-002"
                    }
                  ]
                }
              }
            }
          },
          "500": {
            "content": {
              "text/plain": {
                "schema": {
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/ErrorResponse500-001"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse500-002"
                    },
                    {
                      "$ref": "#/components/schemas/ErrorResponse500-003"
                    }
                  ]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Attachments": {
        "type": "array",
        "description": "An array of attachments.",
        "items": {
          "$ref": "#/components/schemas/Attachment"
        }
      },
      "Attachment": {
        "description": "An attachment.",
        "anyOf": [
          {
            "type": "object"
          }
        ]
      },
      "Sent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "The message ID assigned by SecuMailer to the e-mail.",
            "example": "9ba7df33-b5b7-4476-9ce8-fdd800064a5d@secumailer.com"
          },
          "message": {
            "type": "string",
            "description": "A success description",
            "example": "Queued. Thank you."
          }
        },
        "description": "An array of recipient addresses and message identifiers."
      },
      "Error": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string"
          }
        },
        "description": "An error object containing a human-readable error message."
      },
      "ErrorResponse400-001": {
        "description": "Bad Request - Missing required field&#58; from",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-002": {
        "description": "Bad Request - Missing required field&#58; to",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-003": {
        "description": "Bad Request - Missing required field&#58; subject",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-004": {
        "description": "Bad Request - Missing required field&#58; html",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-005": {
        "description": "Bad Request - Missing Authorization header",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-006": {
        "description": "Bad Request - Malformed Authorization header",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse400-007": {
        "description": "Bad Request - Too many recipients [max = INT]",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse401-001": {
        "description": "Unauthorized - Invalid API key",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse401-002": {
        "description": "Unauthorized - Sender not authorized",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse401-003": {
        "description": "Unauthorized - Invalid API ID",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse401-004": {
        "description": "Unauthorized - Invalid credential",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse422-001": {
        "description": "Unprocessable Content - blocked attachment file extension",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse422-002": {
        "description": "Unprocessable Content - blocked attachment content type",
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse500-001": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse500-002": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      },
      "ErrorResponse500-003": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Error"
          }
        ]
      }
    },
    "parameters": {
      "MailBodyCompression": {
        "name": "Content-Encoding",
        "in": "header",
        "description": "[IGNORED] This option is accepted but will not yield any result.",
        "required": false,
        "schema": {
          "type": "string",
          "enum": [
            "gzip"
          ]
        }
      }
    },
    "requestBodies": {
      "PostMailSend": {
        "content": {
          "multipart/form-data": {
            "schema": {
              "required": [
                "from, to, subject, html"
              ],
              "type": "object",
              "properties": {
                "from": {
                  "type": "string",
                  "description": "E-mail address for From header.",
                  "format": "email",
                  "example": "Yoda <master.yoda@thejediorder.org>"
                },
                "to": {
                  "type": "string",
                  "description": "E-mail address of the recipient(s) (e.g.) Luke Skywalker <luke@thejediorder.org>, <qui-gon.jinn@thejediorder.org>, <obi-wan.kenobi@thejediorder.org>. You can use commas to separate multiple recipients.",
                  "example": "Luke Skywalker <luke@thejediorder.org>, <qui-gon.jinn@thejediorder.org>, <obi-wan.kenobi@thejediorder.org>"
                },
                "subject": {
                  "type": "string",
                  "description": "Message subject.",
                  "example": "Daily stand-up at 9:30AM"
                },
                "html": {
                  "type": "string",
                  "description": "Body of the message (HTML version)",
                  "example": "<p>Hello, world!</p>"
                },
                "cc": {
                  "type": "string",
                  "description": "Same as To but for Cc",
                  "example": "Mace Windu <mace.windu@thejediorder.org>"
                },
                "bcc": {
                  "type": "string",
                  "description": "Same as To but for Bcc",
                  "example": "Padmé Amidala <padmae@therepublic.gov>"
                },
                "text": {
                  "type": "string",
                  "description": "Body of the message (text version)",
                  "example": "Hello, world!"
                },
                "attachment": {
                  "description": "File attachment. You can post multiple attachment values. Important - You must use multipart/form-data encoding for sending attachments.",
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Attachment"
                    },
                    {
                      "$ref": "#/components/schemas/Attachments"
                    }
                  ]
                },
                "inline": {
                  "description": "Attachment with inline disposition. Can be used to send inline images. You can post multiple inline values.",
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/Attachment"
                    },
                    {
                      "$ref": "#/components/schemas/Attachments"
                    }
                  ]
                },
                "anyOf": {
                  "type": "object",
                  "description": "Key-value pairs of e-mail headers. Header names must be prefixed with h&#58; followed by an arbitrary value. For example, sending h&#58;Reply-To allows you to specify the Reply-To address."
                }
              }
            }
          }
        }
      }
    }
  },
  "tags": []
}