Basic Send

Send a single transactional email instantly using the SendLiberty REST API.

To send an email, make a secure HTTP POST request to the /api/send endpoint. If you have connected multiple Gmail accounts, you can specify which one to use by passing the from field in your request body. If omitted, SendLiberty automatically defaults to your first connected Gmail account.

Example Request

curl -X POST https://api.sendliberty.com/api/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": "mysecondgmail@gmail.com",
    "to": "user@example.com",
    "subject": "Hello via REST API",
    "html": "<p>No SMTP configuration needed!</p>",
    "replyTo": "support@yourdomain.com",
    "attachments": [
      { "filename": "invoice.pdf", "content": "JVBERi0xLjQKJ..." }
    ]
  }'

Authentication Headers

You can authenticate your requests with SendLiberty in two ways:

  • Authorization Header: Send your API key as a Bearer token: Authorization: Bearer YOUR_API_KEY
  • Custom x-api-key Header: If your HTTP client or environment makes Bearer auth difficult, pass it directly: x-api-key: YOUR_API_KEY

Request Body Parameters

  • from (string, optional): The connected Gmail email address you want to send this email from (e.g. mysecondgmail@gmail.com). If not supplied, it defaults to your first connected Gmail account.
  • to (string or array of strings): The recipient's email address (or array of addresses).
  • subject (string): The subject line of the email.
  • html (string): The HTML body content of the email.
  • text (string, optional): The plain text fallback body.
  • replyTo (string, optional): Setup a reply-to email address.
  • cc (string or array of strings, optional): carbon copy recipient(s).
  • bcc (string or array of strings, optional): blind carbon copy recipient(s).
  • attachments (array of objects, optional): An array of attachments to include:
    • filename (string, required): The name of the file (e.g. invoice.pdf).
    • content (string, required): The base64-encoded file content.
    • type (string, optional): The MIME content type (e.g. application/pdf).