Sendwith REST API Reference

The Sendwith API allows you to send emails programmatically using your existing email service provider. You can use the API to send critical transactional emails that need to reach user inboxes, such as account verification emails and password reset emails.

Authentication

Sendwith uses API keys to authenticate requests. You can view and manage your API keys in the Sendwith Dashboard. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.

Authentication to the API is performed via HTTP Bearer authentication. Provide your API key as the Bearer token in the Authorization header. Please see the sample code below for an example of how to authenticate using HTTP Bearer authentication.

Sending an email

To send an email, make a POST request to the /api/send endpoint. The request body should be a JSON object with the following properties:

  • message: An object containing the following properties:

    • to (required): The email addresses of the recipients in the following format: {"email": "recipient@example.com", "name": "Optional Name"}. You can provide multiple email addresses as an array.

    • from (required): The email address of the sender in the above format. The email address must be connected and authenticated in the Sendwith Dashboard.

    • subject (required): The subject of the email.

    • body (required): The plain text content of the email.

    • HTMLbody (optional): The HTML content of the email. You can provide both plain text and HTML content. Most email clients will display the HTML content if it is available.

    • cc (optional): An array of email addresses to CC, in the same format as the to property.

    • bcc (optional): An array of email addresses to BCC, in the same format as the to property.

    • replyTo (optional): The email address to which replies should be sent, in the same format as the to property.

Attachments are supported in private beta. Please contact us to enable attachments for your account.

Code examples

Questions

If you have any questions or need help, feel free to contact us at support@sendwith.email.