{
  "openapi": "3.1.0",
  "info": {
    "title": "FeraEmail API",
    "version": "1.0.0",
    "contact": {
      "name": "Feradel Support",
      "url": "https://www.feradel.com/contact/"
    },
    "description": "Public customer contract for SMTP profiles, templates, message submission, preflight, and retained receipts."
  },
  "externalDocs": {
    "description": "FeraEmail API reference and guides",
    "url": "https://help.feradel.com/feraemail-api-reference/"
  },
  "servers": [
    {
      "url": "https://api.mail.feradel.com"
    }
  ],
  "paths": {
    "/api/v1/configurations": {
      "post": {
        "operationId": "email_post_configurations",
        "summary": "POST controller.createOrUpdate",
        "description": "Requires an active FeraEmail workspace and `EDIT.CONFIGURATION`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "configurations"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Source-traced Email JSON command.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailConfiguration"
              },
              "example": {
                "owner": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                "name": "PRIMARY",
                "host": "smtp.example.test",
                "port": 587,
                "secure": false,
                "user": "smtp-user",
                "password": "environment-managed-password"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      },
      "get": {
        "operationId": "email_get_configurations",
        "summary": "GET controller.get",
        "description": "Requires an active FeraEmail workspace and `VIEW.CONFIGURATION`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "configurations"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/configurations/n/{name}": {
      "get": {
        "operationId": "email_get_configurationsNName",
        "summary": "GET controller.get",
        "description": "Requires an active FeraEmail workspace and `VIEW.CONFIGURATION`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "configurations"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "name",
            "in": "path",
            "required": true,
            "description": "Exact template or configuration name.",
            "schema": {
              "type": "string"
            },
            "example": "PASSWORD.RESET"
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/configurations/{uuid}": {
      "delete": {
        "operationId": "email_delete_configurationsUuid",
        "summary": "DELETE controller.destroy",
        "description": "Requires an active FeraEmail workspace and `EDIT.CONFIGURATION`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "configurations"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "Stable owner-scoped configuration or template UUID selected by this route.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/templates": {
      "post": {
        "operationId": "email_post_templates",
        "summary": "POST controller.createOrUpdate",
        "description": "Requires an active FeraEmail workspace and `EDIT.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Source-traced Email JSON command.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplate"
              },
              "example": {
                "category": "SECURITY",
                "name": "PASSWORD.RESET",
                "from": "security@example.com",
                "replyTo": "support@example.com",
                "subject": "Reset your password",
                "html": "<p>Use the secure reset link.</p>",
                "meta": {
                  "version": 1
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      },
      "get": {
        "operationId": "email_get_templates",
        "summary": "GET controller.get",
        "description": "Requires an active FeraEmail workspace and `VIEW.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/templates/r/i/{uuid}": {
      "post": {
        "operationId": "email_post_templatesRIUuid",
        "summary": "POST controller.register",
        "description": "Requires an active FeraEmail workspace and `EDIT.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "Stable owner-scoped configuration or template UUID selected by this route.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Source-traced Email JSON command.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EmailTemplate"
              },
              "example": {
                "category": "SECURITY",
                "name": "PASSWORD.RESET",
                "from": "security@example.com",
                "replyTo": "support@example.com",
                "subject": "Reset your password",
                "html": "<p>Use the secure reset link.</p>",
                "meta": {
                  "version": 1
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/templates/n/{named}/o/{owner}/f/{fields}": {
      "get": {
        "operationId": "email_get_templatesNNamedOOwnerFFields",
        "summary": "GET controller.search",
        "description": "Requires an active FeraEmail workspace and `VIEW.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "named",
            "in": "path",
            "required": true,
            "description": "Exact template or configuration name.",
            "schema": {
              "type": "string"
            },
            "example": "PASSWORD.RESET"
          },
          {
            "name": "owner",
            "in": "path",
            "required": true,
            "description": "Owner namespace value retained by the legacy search path.",
            "schema": {
              "type": "string"
            },
            "example": "PASSWORD.RESET"
          },
          {
            "name": "fields",
            "in": "path",
            "required": true,
            "description": "JSON field-selection array or ALL for template search.",
            "schema": {
              "type": "string"
            },
            "example": "ALL"
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/templates/g": {
      "get": {
        "operationId": "email_get_templatesG",
        "summary": "GET controller.global",
        "description": "Requires an active FeraEmail workspace and `VIEW.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/templates/{uuid}": {
      "get": {
        "operationId": "email_get_templatesUuid",
        "summary": "GET controller.get",
        "description": "Requires an active FeraEmail workspace and `VIEW.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "Stable owner-scoped configuration or template UUID selected by this route.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      },
      "delete": {
        "operationId": "email_delete_templatesUuid",
        "summary": "DELETE controller.destroy",
        "description": "Requires an active FeraEmail workspace and `EDIT.TEMPLATE`. Use the authenticated workspace as the resource owner.",
        "tags": [
          "templates"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "uuid",
            "in": "path",
            "required": true,
            "description": "Stable owner-scoped configuration or template UUID selected by this route.",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "example": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
          }
        ],
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailResult"
                },
                "example": {
                  "success": true,
                  "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                  "items": [],
                  "data": {
                    "uuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df",
                    "parentUuid": "715c9ebb-0470-11f1-a928-0ed2cd1b87df"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/send": {
      "post": {
        "operationId": "email_post_send",
        "summary": "POST controller.send",
        "description": "Requires `CAN.SEND`. Submit raw HTML or a named template with XML data through your SMTP profile. Use a new operationId for each logical message. After an uncertain response, read the receipt before any retry. Exact accepted retries return the existing receipt.",
        "tags": [
          "send"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          }
        ],
        "requestBody": {
          "required": true,
          "description": "Source-traced Email JSON command.",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SendRequest"
              },
              "examples": {
                "raw": {
                  "value": {
                    "operationId": "16c6a875-d2b7-48cd-ae02-40e5e6de611f",
                    "configuration": "CAPTURE",
                    "from": "notifications@example.invalid",
                    "to": "capture@example.invalid",
                    "subject": "FeraEmail test",
                    "body": "<p>Hello from FeraEmail.</p>"
                  }
                },
                "template": {
                  "value": {
                    "operationId": "1a57bb3b-5622-410d-b367-e5c57d1e086e",
                    "configuration": "CAPTURE",
                    "name": "WELCOME_TEST",
                    "recipient": "capture@example.invalid",
                    "xml": "<data><name>Avery</name></data>"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The source-traced Email handler completed and returned its profile, template, send, lifecycle, or shared-owner result.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SendResult"
                },
                "example": {
                  "success": true,
                  "info": {
                    "messageId": "<fictional-message@example.test>",
                    "accepted": [
                      "developer@example.com"
                    ]
                  },
                  "rendered": {
                    "template": "PASSWORD.RESET",
                    "from": "security@example.com",
                    "to": "developer@example.com",
                    "subject": "Reset your password",
                    "attachments": [
                      {
                        "filename": "instructions.pdf",
                        "cid": null
                      }
                    ]
                  }
                }
              }
            }
          },
          "400": {
            "description": "Validation, sender/recipient, template registration, fields JSON, or payload rules rejected the request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "403": {
            "description": "Send/view/edit, managed-product, owner, or lifecycle sender permission is missing.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "409": {
            "description": "Operation already dispatching or bound to different actor, owner or content; do not resend under a new operation ID.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "502": {
            "description": "SMTP or dependent delivery infrastructure did not accept the message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/send/operations/{operationId}": {
      "get": {
        "operationId": "email_get_send_operation_receipt",
        "summary": "Read retained SMTP acceptance",
        "description": "Requires `CAN.SEND` and the original actor. Reads the recorded state without sending. accepted indicates SMTP relay acceptance. dispatching requires reconciliation with the provider.",
        "tags": [
          "send"
        ],
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "operationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Retained actor-owned state and optional positive SMTP receipt; this read never sends a message.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailOperationReceipt"
                }
              }
            }
          },
          "401": {
            "description": "The FeraAuth token is missing or invalid.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "404": {
            "description": "The owner-scoped configuration, template, or import source was not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          },
          "500": {
            "description": "Persistence, template build, SMTP transport, lifecycle, or provisioning failed unexpectedly.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                },
                "example": {
                  "success": false,
                  "message": "The email operation could not be completed.",
                  "error": {
                    "stage": "validation"
                  }
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    },
    "/api/v1/send/preflight": {
      "get": {
        "operationId": "email_send_preflight",
        "summary": "Check a profile and optional template without sending",
        "tags": [
          "send"
        ],
        "description": "Requires `CAN.SEND`. Looks up the profile and optional template in the authenticated workspace. It does not connect to SMTP, validate credentials, create a receipt, or send.",
        "parameters": [
          {
            "name": "instance",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "FeraEmail workspace UUID bound to the FeraAuth token."
          },
          {
            "name": "configuration",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "SMTP profile name."
          },
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string",
              "minLength": 1
            },
            "description": "Template name. An unrecognized template produces templateAvailable=false."
          }
        ],
        "responses": {
          "200": {
            "description": "The profile exists.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success",
                    "configurationReady",
                    "templateAvailable"
                  ],
                  "additionalProperties": false,
                  "properties": {
                    "success": {
                      "const": true
                    },
                    "configurationReady": {
                      "const": true
                    },
                    "templateAvailable": {
                      "type": "boolean"
                    }
                  }
                },
                "example": {
                  "success": true,
                  "configurationReady": true,
                  "templateAvailable": false
                }
              }
            }
          },
          "401": {
            "description": "Authentication required.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                }
              }
            }
          },
          "403": {
            "description": "Permission or workspace access denied.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                }
              }
            }
          },
          "404": {
            "description": "SMTP profile not found.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                }
              }
            }
          },
          "500": {
            "description": "The lookup failed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EmailError"
                }
              }
            }
          }
        },
        "security": [
          {
            "authToken": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "EmailConfiguration": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable owner-scoped SMTP profile UUID."
          },
          "owner": {
            "type": "string",
            "format": "uuid",
            "description": "Owner UUID; defaults to authenticated instance."
          },
          "name": {
            "type": "string",
            "description": "Owner-scoped profile name."
          },
          "host": {
            "type": "string",
            "description": "SMTP hostname."
          },
          "port": {
            "type": "integer",
            "minimum": 1,
            "maximum": 65535,
            "description": "SMTP port; 465/2465 use secure transport and 25/587/2587 require TLS."
          },
          "secure": {
            "type": "boolean",
            "description": "Stored secure transport preference."
          },
          "user": {
            "type": "string",
            "description": "SMTP account username."
          },
          "password": {
            "type": "string",
            "writeOnly": true,
            "description": "SMTP password accepted on write and never returned."
          },
          "success": {
            "type": "boolean",
            "description": "Whether profile mutation completed."
          }
        }
      },
      "EmailResult": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Whether the operation completed."
          },
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "Affected configuration/template UUID."
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EmailTemplate"
            },
            "description": "Ordered templates."
          },
          "data": {
            "type": "object",
            "additionalProperties": true,
            "description": "Imported template representation."
          }
        }
      },
      "EmailTemplate": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "uuid": {
            "type": "string",
            "format": "uuid",
            "description": "Stable template UUID."
          },
          "category": {
            "type": "string",
            "description": "Template grouping category."
          },
          "name": {
            "type": "string",
            "description": "Owner-scoped template name."
          },
          "from": {
            "type": "string",
            "format": "email",
            "description": "Template sender address."
          },
          "replyTo": {
            "type": "string",
            "format": "email",
            "description": "Template reply-to address."
          },
          "subject": {
            "type": "string",
            "description": "Subject template."
          },
          "html": {
            "type": "string",
            "description": "HTML template body."
          },
          "meta": {
            "type": "object",
            "additionalProperties": true,
            "description": "Product-owned template metadata."
          }
        }
      },
      "EmailError": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean",
            "const": false,
            "description": "Indicates that email work failed."
          },
          "message": {
            "type": "string",
            "description": "Safe failure text."
          },
          "error": {
            "type": [
              "string",
              "object"
            ],
            "description": "Safe structured failure details."
          }
        }
      },
      "SendRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "configuration"
        ],
        "properties": {
          "configuration": {
            "type": "string",
            "description": "Name of the SMTP profile in the authenticated workspace."
          },
          "name": {
            "type": "string",
            "description": "Template name; omit for raw email mode."
          },
          "xml": {
            "type": "string",
            "description": "XML data used to build the selected template."
          },
          "recipient": {
            "type": "string",
            "description": "Template-mode recipient or raw-mode alias for to."
          },
          "to": {
            "type": "string",
            "description": "Raw-mode recipient address/list."
          },
          "cc": {
            "type": "string",
            "description": "Optional carbon-copy address/list."
          },
          "bcc": {
            "type": "string",
            "description": "Optional blind-carbon-copy address/list."
          },
          "from": {
            "type": "string",
            "format": "email",
            "description": "Raw-mode sender; falls back to latest owner template sender."
          },
          "display": {
            "type": "string",
            "description": "Raw-mode sender display name."
          },
          "subject": {
            "type": "string",
            "description": "Raw-mode subject."
          },
          "body": {
            "type": "string",
            "description": "Raw-mode HTML body."
          },
          "unsubscribeUrl": {
            "type": "string",
            "format": "uri",
            "description": "Optional campaign opt-out URL appended once to rendered HTML."
          },
          "attachments": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Attachment"
            },
            "description": "Use inline attachment content with a filename and an optional UTF-8 or base64 encoding."
          },
          "operationId": {
            "type": "string",
            "format": "uuid",
            "description": "Optional durable dispatch identity. Reuse the exact body for retries. Changed actor, owner or payload returns 409; an uncertain dispatch is never automatically resent."
          }
        }
      },
      "Attachment": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "filename": {
            "type": "string",
            "description": "Attachment filename presented to recipient."
          },
          "content": {
            "type": "string",
            "description": "Inline attachment content, commonly base64 with an encoding option."
          },
          "contentType": {
            "type": "string",
            "description": "Attachment media type."
          },
          "encoding": {
            "type": "string",
            "description": "Encoding of inline string content.",
            "enum": [
              "utf8",
              "base64"
            ]
          },
          "cid": {
            "type": "string",
            "description": "Content-ID for inline HTML references."
          }
        },
        "required": [
          "filename",
          "content"
        ]
      },
      "SendResult": {
        "type": "object",
        "additionalProperties": true,
        "properties": {
          "success": {
            "type": "boolean",
            "description": "Whether build and SMTP send completed."
          },
          "info": {
            "type": "object",
            "additionalProperties": true,
            "description": "Provider delivery acceptance metadata."
          },
          "rendered": {
            "type": "object",
            "additionalProperties": true,
            "description": "Final sender, recipients, subject, body, and safe attachment names/cids."
          },
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "duplicate": {
            "type": "boolean"
          }
        }
      },
      "EmailOperationReceipt": {
        "type": "object",
        "additionalProperties": true,
        "required": [
          "success",
          "operationId",
          "state",
          "payloadSha256"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "operationId": {
            "type": "string",
            "format": "uuid"
          },
          "state": {
            "type": "string",
            "enum": [
              "dispatching",
              "accepted"
            ]
          },
          "payloadSha256": {
            "type": "string",
            "pattern": "^[a-f0-9]{64}$"
          },
          "info": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "messageId",
              "accepted",
              "rejected",
              "response"
            ],
            "properties": {
              "messageId": {
                "type": "string"
              },
              "response": {
                "type": "string"
              },
              "accepted": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rejected": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "securitySchemes": {
      "authToken": {
        "type": "apiKey",
        "in": "header",
        "name": "x-auth-token",
        "description": "FeraAuth JWT with managed-product and operation-specific Email permission checks."
      }
    }
  }
}
