Skip to main content
Bolt
Bolt is an AI-powered platform that lets you build full-stack web apps from natural language prompts. You can integrate AutoSend into any Bolt project to send transactional emails like welcome emails, password resets, order confirmations, and notifications.

Prerequisites

Integration

1

Prompt Bolt to integrate AutoSend

Copy and paste this prompt into Bolt’s chat:
Integrate AutoSend email API for sending transactional emails.

API Details:
- Base URL: https://api.autosend.com/v1
- Auth: Bearer token using API key stored in environment variable AUTOSEND_API_KEY
- Endpoint: POST /mails/send
- Content-Type: application/json

Request body format:
{
  "to": { "email": "[email protected]", "name": "Jane Doe" },
  "from": { "email": "[email protected]", "name": "Your App Name" },
  "subject": "Your subject line",
  "html": "<h1>Hello!</h1><p>Your email content here.</p>"
}

Response format:
{
  "success": true,
  "data": {
    "emailId": "698afb75ff4bc5466e3a797a",
    "message": "Email queued successfully.",
    "totalRecipients": 1
  }
}

Create a server-side API route or function that:
1. Reads AUTOSEND_API_KEY from environment variables
2. Accepts to, from, subject, and html in the request body
3. Calls the AutoSend API with Bearer token auth
4. Returns the response to the client

The "from" email must use a domain verified in AutoSend.

Docs: https://docs.autosend.com/quickstart/email-using-api
Bolt will generate the backend code and wire it into your app automatically.
2

Add your API key

Add your AutoSend API key as an environment variable in your Bolt project settings with the name AUTOSEND_API_KEY.
Get your API key from the API Keys page in your AutoSend dashboard.
3

Test your integration

Trigger the email flow in your app (for example, submitting a contact form). Check your Email Activity in the AutoSend dashboard to confirm the email was delivered.

Using Email Templates

If you have created email templates in AutoSend, you can send emails using a templateId instead of inline HTML. Update the prompt to include:
Also support sending emails with a templateId and variables.

Example request body with template:
{
  "to": { "email": "[email protected]", "name": "Jane Doe" },
  "from": { "email": "[email protected]", "name": "Your App Name" },
  "subject": "Welcome!",
  "templateId": "your_template_id",
  "dynamicData": {
    "firstName": "Jane",
    "loginLink": "https://yourapp.com/login"
  }
}

Troubleshooting

Make sure your AUTOSEND_API_KEY is correctly added in your project’s environment variables. Also verify that your sending domain is verified in AutoSend by checking Settings > Domains in your dashboard.
Double-check that your code is reading the API key from environment variables correctly. The Authorization header should be Bearer YOUR_API_KEY with no extra spaces or quotes.
Make sure you have completed domain verification including SPF, DKIM, and DMARC records. We recommend using a subdomain like mail.yourdomain.com for sending. See our domain setup guide for details.

Next Steps