Skip to main content
Once your SendGrid provider and IP Pool are configured, you can send emails through SendGrid using the standard SendPost API.
Important: You must include the ippool parameter in your API request to route emails through SendGrid.

Basic Email Example

curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
  -H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Name"
    },
    "to": [{
      "email": "recipient@example.com",
      "name": "Recipient Name"
    }],
    "subject": "Hello from SendPost via SendGrid",
    "htmlBody": "<h1>Hello!</h1><p>This email is sent through SendGrid.</p>",
    "textBody": "Hello! This email is sent through SendGrid.",
    "ippool": "sendgrid-pool",
    "trackOpens": true,
    "trackClicks": true
  }'

Email with Personalization

curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
  -H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Company"
    },
    "to": [{
      "email": "john@example.com",
      "name": "John Doe",
      "customFields": {
        "firstName": "John",
        "accountType": "Premium"
      }
    }],
    "subject": "Welcome {{firstName}}!",
    "htmlBody": "<h1>Welcome {{firstName}}!</h1><p>Your {{accountType}} account is ready.</p>",
    "ippool": "sendgrid-pool",
    "trackOpens": true,
    "trackClicks": true
  }'

Using SendGrid IP Pools

If you have multiple IP Pools configured in your SendGrid account and want to specify which SendGrid IP Pool to use for sending, you can pass the tpspIppool parameter in your API request.
The tpspIppool field is optional. Use it when you want to route emails through a specific IP Pool on the SendGrid side, separate from the SendPost IP Pool routing.
Parameters:
  • ippool: The SendPost IP Pool that routes traffic to SendGrid (required)
  • tpspIppool: The IP Pool name configured in your SendGrid account (optional)
curl -X POST "https://api.sendpost.io/api/v1/subaccount/email/" \
  -H "X-SubAccount-ApiKey: YOUR_SENDPOST_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "from": {
      "email": "sender@yourdomain.com",
      "name": "Your Company"
    },
    "to": [{
      "email": "recipient@example.com",
      "name": "Recipient Name"
    }],
    "subject": "Hello from SendPost via SendGrid",
    "htmlBody": "<h1>Hello!</h1><p>This email is sent through a specific SendGrid IP Pool.</p>",
    "ippool": "sendgrid-pool",
    "tpspIppool": "transactional",
    "trackOpens": true,
    "trackClicks": true
  }'
In this example:
  • ippool: "sendgrid-pool" - Routes the email through SendPost’s IP Pool configured for SendGrid
  • tpspIppool: "transactional" - Sends the email via the “transactional” IP Pool in your SendGrid account

Response

Success Response (HTTP 200):
[
  {
    "messageId": "abc123-def456-ghi789",
    "errorCode": 0,
    "to": "recipient@example.com"
  }
]

Next Steps