> ## Documentation Index
> Fetch the complete documentation index at: https://api.smartlead.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Send Single Email

> Send one-off transactional email outside of campaigns with attachments

## Path Parameters

<Note>No path parameters</Note>

## Query Parameters

<ParamField query="api_key" type="string" required>
  Your SmartLead API key
</ParamField>

## Request Body

<ParamField body="to" type="string" required>
  Recipient email address
</ParamField>

<ParamField body="subject" type="string" required>
  Email subject line
</ParamField>

<ParamField body="body" type="string" required>
  Email body content (HTML or plain text)
</ParamField>

<ParamField body="fromEmail" type="string">
  Sender email address. Either `fromEmail` or `fromEmailId` is required
</ParamField>

<ParamField body="fromEmailId" type="number">
  ID of the sender email account. Either `fromEmail` or `fromEmailId` is required
</ParamField>

<ParamField body="fromName" type="string">
  Display name for the sender (optional)
</ParamField>

<ParamField body="replyTo" type="string">
  Reply-to email address (optional)
</ParamField>

<ParamField body="attachments" type="array">
  Array of attachment objects (optional). Each attachment requires:

  * `filename` (string): Name of the file
  * `content` (string): Base64-encoded file content
  * `mimeType` (string): MIME type of the file (e.g., "application/pdf")
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST "https://server.smartlead.ai/api/v1/send-email/initiate?api_key=YOUR_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "to": "recipient@example.com",
      "subject": "Welcome to SmartLead",
      "body": "<h1>Hello!</h1><p>This is your welcome email.</p>",
      "fromEmail": "sender@example.com",
      "fromName": "SmartLead Team",
      "replyTo": "support@example.com",
      "attachments": []
    }'
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "YOUR_API_KEY"

  payload = {
      "to": "recipient@example.com",
      "subject": "Welcome to SmartLead",
      "body": "<h1>Hello!</h1><p>This is your welcome email.</p>",
      "fromEmail": "sender@example.com",
      "fromName": "SmartLead Team",
      "replyTo": "support@example.com",
      "attachments": []
  }

  response = requests.post(
      "https://server.smartlead.ai/api/v1/send-email/initiate",
      params={"api_key": API_KEY},
      json=payload
  )

  result = response.json()
  print(result)
  ```

  ```javascript JavaScript theme={null}
  const API_KEY = 'YOUR_API_KEY';

  const payload = {
    to: 'recipient@example.com',
    subject: 'Welcome to SmartLead',
    body: '<h1>Hello!</h1><p>This is your welcome email.</p>',
    fromEmail: 'sender@example.com',
    fromName: 'SmartLead Team',
    replyTo: 'support@example.com',
    attachments: []
  };

  const response = await fetch(
    `https://server.smartlead.ai/api/v1/send-email/initiate?api_key=${API_KEY}`,
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify(payload)
    }
  );

  const result = await response.json();
  console.log(result);
  ```
</RequestExample>

## Response Codes

<ResponseField name="200" type="Success">
  Request successful
</ResponseField>

<ResponseField name="400" type="Bad Request">
  Invalid request parameters or malformed request body
</ResponseField>

<ResponseField name="401" type="Unauthorized">
  Invalid or missing API key. Check your authentication.
</ResponseField>

<ResponseField name="404" type="Not Found">
  The requested resource (campaign, lead, email account, etc.) does not exist or you don't have access to it
</ResponseField>

<ResponseField name="422" type="Validation Error">
  Request validation failed. Check parameter types, required fields, and value constraints.
</ResponseField>

<ResponseField name="429" type="Rate Limit Exceeded">
  Too many requests. Please slow down and retry after the rate limit resets.
</ResponseField>

<ResponseField name="500" type="Internal Server Error">
  Server error occurred. Please try again or contact support if the issue persists.
</ResponseField>

<ResponseField name="503" type="Service Unavailable">
  API is temporarily unavailable or under maintenance. Please try again later.
</ResponseField>

<ResponseExample>
  ```json 200 - Success theme={null}
  {
    "success": true,
    "data": {
      "message": "Email sent successfully",
      "message_id": "msg_67890abcde"
    }
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "message": "Invalid API Key"
  }
  ```

  ```json 404 - Not Found theme={null}
  {
    "error": "Resource not found"
  }
  ```

  ```json 422 - Validation Error theme={null}
  {
    "error": "Invalid parameters provided"
  }
  ```
</ResponseExample>

## Related Endpoints

* [Related endpoint](#)
