Email API Endpoints
Send Email
POST /api/send-email
Send a single email using plain text or HTML content.
Request Headers
{
'Content-Type': 'application/json',
'x-api-key': 'your_api_key'
}
Request Body
{
to: string;
subject: string;
name: string;
message: string; // Plain text or HTML
}
Response
{
data?: {
messageId: string;
status: 'sent';
};
error?: string;
}
Send Email from Template
POST /api/send-email-from-template
Send an email using a pre-built template.
Request Headers
{
'Content-Type': 'application/json',
'x-api-key': 'your_api_key'
}
Request Body
{
to: string;
from: string;
templateId: string;
variables: Record<string, string>;
}
Response
{
data?: {
messageId: string;
status: 'sent';
};
error?: string;
}
Test Endpoints
POST /api/test/send-email
Test endpoint for sending emails without affecting your quota. Uses the same request/response format as /api/send-email
.
Rate Limits
- No quota impact
- Limited to 10 requests per hour
- Only available in development environment
POST /api/test/send-email-from-template
Test endpoint for sending template emails without affecting your quota. Uses the same request/response format as /api/send-email-from-template
.
Rate Limits
- No quota impact
- Limited to 10 requests per hour
- Only available in development environment
Error Responses
All endpoints may return the following error responses:
{
error: string;
status: string;
}
Common error status codes:
400
: Bad Request - Invalid request body401
: Unauthorized - Invalid API key403
: Forbidden - Quota exceeded429
: Too Many Requests - Rate limit exceeded500
: Internal Server Error - Temporary server issue
Next Steps
- Learn how to start sending emails
- Learn how to create and use email templates