{
  "openapi": "3.1.0",
  "info": {
    "title": "ResenderMail API",
    "version": "1.0.0",
    "description": "Developer API for sending transactional email with ResenderMail.\n\nAuthenticate send and status lookup with the `X-API-Key` header (not Bearer).\n\nA successful `POST /api/v1/emails` returns **200** with `{ id, status: \"Queued\" }`. That means the message was accepted and queued; delivery is asynchronous. Look up progress with `GET /api/v1/emails/{id}`. Status strings use PascalCase enum names (same as GET)."
  },
  "servers": [
    {
      "url": "https://api.resendermail.com",
      "description": "Production"
    }
  ],
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/api/v1/emails": {
      "post": {
        "operationId": "sendEmail",
        "summary": "Send an email",
        "description": "Queues a transactional email for delivery. The `from` address must be a sender identity on the API key's verified domain. Include `html`, `text`, or both.\n\n**200** means accepted/queued — delivery is asynchronous.",
        "tags": ["Emails"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendEmailRequest"
              },
              "example": {
                "from": "hello@yourdomain.com",
                "to": ["customer@example.com"],
                "subject": "Your receipt",
                "html": "<p>Thanks for your order.</p>",
                "text": "Thanks for your order."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Email accepted and queued for asynchronous delivery.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendEmailResponse"
                },
                "example": {
                  "id": "em_01hxyzexample",
                  "status": "Queued"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Unverified account, domain/sender mismatch, or missing permission.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "422": {
            "description": "Invalid payload (for example all recipients on the suppression list).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/emails/{id}": {
      "get": {
        "operationId": "getEmail",
        "summary": "Get email status",
        "description": "Returns details and delivery status for a previously queued email. Use the same API key that sent the message (or a dashboard bearer session).",
        "tags": ["Emails"],
        "security": [
          {
            "ApiKeyAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Public email id returned from send.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Email detail and current status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailDetail"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid API key (or unauthenticated session).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Email not found for this organization.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Rate limited.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API key from the ResenderMail dashboard. Required for developer send and status endpoints. Do not use Bearer for these calls."
      }
    },
    "schemas": {
      "SendEmailRequest": {
        "type": "object",
        "required": ["from", "to", "subject"],
        "additionalProperties": false,
        "properties": {
          "from": {
            "type": "string",
            "description": "Sender address (must be a sender identity on the key's verified domain). Display-name form is supported, e.g. `Your App <noreply@yourdomain.com>`."
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "minItems": 1,
            "description": "Recipient addresses."
          },
          "subject": {
            "type": "string"
          },
          "html": {
            "type": ["string", "null"],
            "description": "HTML body. Provide `html`, `text`, or both."
          },
          "text": {
            "type": ["string", "null"],
            "description": "Plain-text body. Provide `html`, `text`, or both."
          },
          "cc": {
            "type": ["array", "null"],
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": ["array", "null"],
            "items": {
              "type": "string"
            }
          },
          "replyTo": {
            "type": ["string", "null"],
            "description": "Optional Reply-To address (camelCase)."
          }
        }
      },
      "SendEmailResponse": {
        "type": "object",
        "required": ["id", "status"],
        "additionalProperties": false,
        "properties": {
          "id": {
            "type": "string",
            "description": "Public email id for status lookup."
          },
          "status": {
            "type": "string",
            "const": "Queued",
            "description": "Always `Queued` on a successful send (PascalCase enum name, same as GET). Delivery continues asynchronously."
          }
        }
      },
      "EmailDetail": {
        "type": "object",
        "required": [
          "id",
          "from",
          "to",
          "cc",
          "bcc",
          "subject",
          "status",
          "createdAt",
          "events"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "from": {
            "type": "string"
          },
          "fromName": {
            "type": ["string", "null"]
          },
          "to": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "cc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "bcc": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "subject": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "description": "Current message status from the API (enum name, e.g. Queued, Processing, Sent, Failed)."
          },
          "failureReason": {
            "type": ["string", "null"]
          },
          "createdAt": {
            "type": "string",
            "format": "date-time"
          },
          "updatedAt": {
            "type": ["string", "null"],
            "format": "date-time"
          },
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailEvent"
            }
          },
          "recipients": {
            "type": ["array", "null"],
            "items": {
              "$ref": "#/components/schemas/EmailRecipient"
            }
          }
        }
      },
      "EmailEvent": {
        "type": "object",
        "required": ["eventType", "occurredAt"],
        "properties": {
          "eventType": {
            "type": "string"
          },
          "occurredAt": {
            "type": "string",
            "format": "date-time"
          },
          "details": {
            "type": ["string", "null"]
          }
        }
      },
      "EmailRecipient": {
        "type": "object",
        "required": ["address", "type", "status"],
        "properties": {
          "address": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "description": "Recipient role: to, cc, or bcc."
          },
          "status": {
            "type": "string"
          },
          "details": {
            "type": ["string", "null"]
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "string",
            "description": "Human-readable error message."
          },
          "correlationId": {
            "type": ["string", "null"],
            "description": "Include this when contacting support."
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Emails",
      "description": "Send and look up transactional email."
    }
  ]
}
