API Documentation
Introduction
IndiePitcher REST API documentation
Welcome
Our REST API documentation allow you to:
- Send transactional emails
- Add SMTP email accounts to use to send emails
- Create email templates for emails of all categories
- Manage contacts of a marketing campaign.
Please note that most destructive operations are currently not supported through the REST API for resucurity reasons. Please use the IndiePitcher dashboard to perform actions like removing your SMTP account.
Authentication
- Create a free account at IndiePitcher to get your API key. API keys are tied to an organization.
- After you’ve generated your API key you can use it to authenticate your requests by including it in the
Authorization
header.
Authorization: Bearer <api_key>
Do not expose the API key and make calls to our API from your frontend code. You risk your API key being exploited by spammers and us having to reset/disable your API key.
Quick Start Guide - Sending an Email
Step 1: Link an SMTP account
Request:
curl --request POST \
--url https://api.indiepitcher.com/v1/smtp \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"email": "petr@indiepitcher.com",
"smtpHost": "smtp.google.com",
"senderName": "Petr from IndiePitcher",
"password": "yourpassword"
}'
Email aliases are supported by adding
emailAlias
param.Response:
{
"id": "db400643-c9f9-4e8b-9043-9b1528e967ff",
"email": "petr@indiepitcher.com",
"smtpHost": "smtp.google.com",
"senderName": "Petr from IndiePitcher",
"emailAlias": null,
"port": 587
}
Step 2: Send an email
Request:
curl --request POST \
--url https://api.indiepitcher.com/v1/email/transactional \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"recipientEmail": "some@email.com",
"fromEmail": "petr@indiepitcher.com",
"subject": "Welcome to IndiePitcher!",
"body": "# Hello world\n\nThis is a **markdown** email. You can use markdown to style your email. [Here](https://indiepitcher.com) is a link to our website. You can also use inline images ![alt text](https://indiepitcher.com/logo.png). And this is how you add an [Unsubscribe link]({{unsubscribeLink}}).",
"bodyType": "markdown"
}'
Response:
{
"success": true
}
That’s it!