# /send

Sends an email based on the specified email template and structured JSON parameters. This endpoint is designed for programmatic execution where data is passed as a standard JSON payload.

# Resource URL

POST https://api.emailjs.com/api/v1.0/email/send

# Request Information

Content type is 'application/json'

# Rate Limit

1 request per second

# Parameters

NAME REQUIRED DESCRIPTION
service_id Yes Service ID of the service through which the email should be sent. Reserved keyword primary_service is supported, and should be used to use the default service, which can be set and changed via EmailJS dashboard.
template_id Yes Template ID of the email
user_id Yes Public Key of the account
template_params No Template parameters of the template
accessToken No Private Key of the account

# Response Information

Response formats is JSON or Text

# Example Response

Success status:

200 "OK"

Failure status:

422 "The recipients address is corrupted"

# Code Example

The following examples demonstrate how to interact with the REST API. These snippets are provided for illustration purposes only; you can use any programming language or HTTP client capable of sending standard JSON payloads.

# cURL (CLI)

curl -X POST https://emailjs.com/api/v1.0/email/send \
  -H "Content-Type: application/json" \
  -d '{
    "service_id": "YOUR_SERVICE_ID",
    "template_id": "YOUR_TEMPLATE_ID",
    "user_id": "YOUR_PUBLIC_KEY",
    "template_params": {
      "username": "James"
    }
  }'

# TypeScript (Fetch API)

const params = {
  service_id: 'YOUR_SERVICE_ID',
  template_id: 'YOUR_TEMPLATE_ID',
  user_id: 'YOUR_PUBLIC_KEY',
  template_params: {
    username: 'James',
  }
};

try {
  const response = await fetch('https://api.emailjs.com/api/v1.0/email/send', {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify(params)
  });

  if (!response.ok) {
    throw response.status;
  }

  console.log('Email sent successfully');
} catch (error) {
  console.error('Error sending email:', error);
}