openapi: 3.2.0 info: title: SendClean Email Messages API description: 'The SendClean Email API is a RESTful HTTP API for sending transactional emails, managing SMTP users, sending/tracking domains, webhooks, and account information. ## Base URL All API calls are relative to: ``` https://api.sendclean.net/v1.0 ``` ## Authentication Every request requires `owner_id` and `token` fields in the request body (JSON POST). ## Request Format - All API calls use **HTTP POST** (except `sendTemplateHTTPGet` which uses HTTP GET). - Request bodies must be `Content-Type: application/json`. - Any non-200 HTTP response code indicates an error. ## Response Format All responses return JSON with a `status` field of either `"success"` or `"error"`. ## Error Types | Type | Description | |------|-------------| | `ValidationError` | Invalid or missing required parameters | | `GeneralError` | Unexpected server-side error | | `AuthenticationError` | `owner_id` and `token` did not match | ' version: 1.0.0 contact: email: support@sendclean.com servers: - url: https://api.sendclean.net/v1.0 description: Production API server tags: - name: Messages description: Send transactional emails and retrieve message info paths: /messages/sendMail: post: tags: - Messages summary: Send a transactional email description: 'Sends a new transactional email via the specified SMTP sub-user. Either `html` or `text` content is required in the message body (both may be provided). Use the `headers` object to control tracking, signing, and routing behaviour. Use `X-Unique-Id` in headers to tag messages for later retrieval via `/messages/getMessageInfo`. ' operationId: sendMail requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SendMailRequest' example: owner_id: example id token: example token smtp_user_name: smtp12345 message: html:
Your order is confirmed.
text: Hello! Your order is confirmed. subject: Order Confirmation from_email: noreply@yourdomain.com from_name: Your Company to: - email: customer@example.com name: Customer Name type: to headers: Reply-To: support@yourdomain.com X-Unique-Id: order-12345 attachments: - type: application/pdf name: invoice.pdf content: ZXhhbXBsZSBmaWxl responses: '200': description: Message queued for delivery content: application/json: schema: oneOf: - $ref: '#/components/schemas/SendMailResponse' - $ref: '#/components/schemas/ErrorResponse' examples: success: value: status: success message: message have been Queued ... error: value: status: error code: -1 name: AuthenticationError message: Token MissMatch /messages/sendTemplate: post: tags: - Messages summary: Send email using a saved template description: 'Sends a transactional email using a pre-created template. Use `dynamic_value` to replace template placeholders (case-sensitive field names). ' operationId: sendTemplate requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/SendTemplateRequest' example: owner_id: example id token: example token smtp_user_name: smtp12345 message: template_id: Template_Id_123 subject: Welcome to our service from_email: noreply@yourdomain.com from_name: Your Company to: - email: customer@example.com name: Customer Name type: to dynamic_value: NAME: John Email: customer@example.com headers: Reply-To: support@yourdomain.com X-Unique-Id: welcome-john-001 responses: '200': description: Template message queued content: application/json: schema: oneOf: - $ref: '#/components/schemas/SendMailResponse' - $ref: '#/components/schemas/ErrorResponse' examples: success: value: status: success message: 250 Message Queued... /messages/sendTemplateHTTPGet: get: tags: - Messages summary: Send template email via HTTP GET description: "Sends a transactional email using a template via HTTP GET. Designed for simple integrations\nsuch as IVR webhooks where POST with JSON body is not practical.\n\n**All parameter values must be URL-encoded.**\n\nExample:\n```\nGET https://api.sendclean.net/v1.0/messages/sendTemplateHTTPGet?owner_id=YOUR_ID&token=YOUR_TOKEN\n &smtp_user_name=smtp12345&template_id=TMPL_ID&subject=Hello\n &from_email=info%40example.com&to=customer%40example.com\n &dynamic_value%5BNAME%5D=John&dynamic_value%5BEmail%5D=john%40example.com\n```\n" operationId: sendTemplateHTTPGet parameters: - name: owner_id in: query required: true schema: type: string description: A valid SendClean User ID - name: token in: query required: true schema: type: string description: A valid API token - name: smtp_user_name in: query required: true schema: type: string description: A valid SMTP user name example: smtp12345 - name: template_id in: query required: true schema: type: string description: Previously created template ID - name: subject in: query required: true schema: type: string description: URL-encoded email subject - name: from_email in: query required: true schema: type: string description: URL-encoded sender email address - name: to in: query required: true schema: type: string description: URL-encoded recipient email address - name: dynamic_value[NAME] in: query required: false schema: type: string description: URL-encoded dynamic value for NAME placeholder - name: dynamic_value[Email] in: query required: false schema: type: string description: URL-encoded dynamic value for Email placeholder responses: '200': description: Template message queued content: application/json: schema: oneOf: - $ref: '#/components/schemas/SendMailResponse' - $ref: '#/components/schemas/ErrorResponse' examples: success: value: status: success message: 250 Message Queued... /messages/getMessageInfo: post: tags: - Messages summary: Get message delivery and engagement info description: 'Retrieves delivery status, open data, and click data for messages matching a given `X-Unique-Id`. Supports pagination via `skip_page`. ' operationId: getMessageInfo requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/MessageInfoRequest' example: owner_id: example id token: example token x_unique_id: order-12345 skip_page: 0 responses: '200': description: Message info records content: application/json: schema: oneOf: - $ref: '#/components/schemas/MessageInfoResponse' - $ref: '#/components/schemas/ErrorResponse' components: schemas: OpenData: type: object properties: ip: type: array items: type: string example: - 0.0.0.0 - 0.0.0.0 ua: type: array items: type: string description: User-agent strings of the openers time: type: array items: type: integer format: int64 description: Timestamps of each open event MessageInfoResponse: type: object properties: status: type: string enum: - success message_data: type: array items: $ref: '#/components/schemas/MessageInfoEntry' SendMailMessage: type: object description: The message payload for sendMail properties: html: type: string description: Full HTML content of the email. Either html or text is required. example: