Benchmark email api documentation
Here is a sample benchmark email API documentation:
Benchmark Email API Documentation
Overview
The Benchmark Email API allows developers to integrate email marketing automation into their applications. With our API, you can send targeted campaigns, track engagement, and analyze results.
API Endpoints
Send Email
- POST /emails
- Send a single email campaign to a list of recipients.
- Request Body:
{ "subject": string, "body": string, "from_name": string, "from_email": string, "to": array of strings, "template_id": integer (optional) }
- Response:
{ "email_id": integer, "status": string }
Get Email Status
- GET /emails/{email_id}
- Retrieve the status of a previously sent email campaign.
- Path Parameter:
email_id
(integer) - Response:
{ "status": string, "sent_count": integer, "opened_count": integer, "clicked_count": integer, "unsubscribed_count": integer }
Get Email Statistics
- GET /emails/{email_id}/stats
- Retrieve detailed statistics about a previously sent email campaign.
- Path Parameter:
email_id
(integer) - Response:
{ "sent_count": integer, "opened_count": integer, "clicked_count": integer, "unsubscribed_count": integer, "bounce_count": integer, "complaint_count": integer, "spam_count": integer }
Get Email Templates
- GET /templates
- Retrieve a list of available email templates.
- Response:
[ { "id": integer, "name": string, "description": string }, ... ]
Create Email Template
- POST /templates
- Create a new email template.
- Request Body:
{ "name": string, "description": string, "html": string, "text": string }
- Response:
{ "id": integer, "name": string, "description": string }
Update Email Template
- PUT /templates/{template_id}
- Update an existing email template.
- Path Parameter:
template_id
(integer) - Request Body:
{ "name": string, "description": string, "html": string, "text": string }
- Response:
{ "id": integer, "name": string, "description": string }
Delete Email Template
- DELETE /templates/{template_id}
- Delete an existing email template.
- Path Parameter:
template_id
(integer) - Response:
{ "message": string }
Authentication
The Benchmark Email API uses API keys for authentication. You can obtain an API key by creating an account on our website and going to the API settings page.
Rate Limiting
The Benchmark Email API has a rate limit of 100 requests per minute per account. If you exceed this limit, you will receive a 429 Too Many Requests
error.
Error Handling
The Benchmark Email API returns errors in the following format:
{
"error": {
"code": integer,
"message": string
}
}
API Key
To use the Benchmark Email API, you need to include your API key in the Authorization
header of your requests. The format is Bearer YOUR_API_KEY
.
Example
Here is an example of how to send an email campaign using the Benchmark Email API:
curl -X POST \
https://api.benchmarkemail.com/emails \
-H 'Authorization: Bearer YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"subject": "Hello World",
"body": "This is a test email",
"from_name": "John Doe",
"from_email": "[email protected]",
"to": ["[email protected]", "[email protected]"],
"template_id": 123
}'
This will send a single email campaign to the specified recipients using the specified template. The response will contain the email ID and status.