From 2aad4031501a9ee8ee90bbb96739708bce1d4262 Mon Sep 17 00:00:00 2001 From: "quantstruct-dev-newman[bot]" <194458996+quantstruct-dev-newman[bot]@users.noreply.github.com> Date: Tue, 11 Feb 2025 06:05:05 +0000 Subject: [PATCH] Add new file: docs/Document the Email API Endpoints.md --- docs/Document the Email API Endpoints.md | 121 +++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 docs/Document the Email API Endpoints.md diff --git a/docs/Document the Email API Endpoints.md b/docs/Document the Email API Endpoints.md new file mode 100644 index 0000000..e4fca02 --- /dev/null +++ b/docs/Document the Email API Endpoints.md @@ -0,0 +1,121 @@ + +# Email API Endpoints + +This document provides detailed information about the email-related API endpoints, enabling developers to effectively integrate email functionality into their applications. + +## API Reference + +This section describes the available email endpoints, their parameters, request and response schemas, and provides example requests and responses. + +### Email Endpoints + +#### 1. Create Email + +* **Endpoint:** `/v1/emails/{accountId}/create-email` +* **Method:** `POST` +* **Description:** Creates a new email draft associated with the specified account. The email is not sent until the `/v1/emails/{accountId}/send` endpoint is called. + +##### Request Parameters + +| Parameter | Type | Description +##### Request Schema + +```json +{ + "type": "object", + "properties": { + "to": { + "type": "string", + "format": "email", + "description": "Recipient email address." + }, + "subject": { + "type": "string", + "description": "Email subject." + }, + "body": { + "type": "string", + "description": "Email body (HTML or plain text)." + }, + "cc": { + "type": "string", + "format": "email", + "description": "CC email address (optional)." + }, + "bcc": { + "type": "string", + "format": "email", + "description": "BCC email address (optional)." + } + }, + "required": [ + "to", + "subject", + "body" + ] +} +``` + +##### Example Request + +```json +{ + "to": "recipient@example.com", + "subject": "Test Email", + "body": "

Hello, World!

This is a test email.

", + "cc": "cc@example.com", + "bcc": "bcc@example.com" +} +``` + +##### Response Schema + +```json +{ + "type": "object", + "properties": { + "emailId": { + "type": "string", + "description": "Unique identifier for the created email." + }, + "status": { + "type": "string", + "description": "Status of the email creation (e.g., 'created')." + } + } +} +``` + +##### Example Response + +```json +{ + "emailId": "a1b2c3d4-e5f6-7890-1234-567890abcdef", + "status": "created" +} +``` + +##### Example cURL Request + +```bash +curl -X POST \ + 'https://api.example.com/v1/emails/123/create-email' \ + -H 'Content-Type: application/json' \ + -d '{ + "to": "recipient@example.com", + "subject": "Test Email", + "body": "

Hello, World!

This is a test email.

", + "cc": "cc@example.com", + "bcc": "bcc@example.com" + }' +``` + +#### 2. Send Email + +* **Endpoint:** `/v1/emails/{accountId}/send` +* **Method:** `POST` +* **Description:** Sends a previously created email. + +##### Request Parameters + +| Parameter | Type | Description \ No newline at end of file