What can you do with it?

The SendGrid API allows you to send transactional and marketing emails programmatically. You can send emails to multiple recipients, use dynamic templates, attach files, schedule emails for future delivery, manage sender verification, and handle all aspects of email delivery with high reliability and scalability.

How to use it?

Basic Command Structure

/your-sendgrid-connection [action] [required-parameters] [optional-parameters]

Parameters

Required:

  • action - The action to perform (send, list, get, verify)
  • entity - The entity type (email, template, sender)
  • to - Recipient email address
  • from - Sender email address
  • subject - Email subject line
  • content - Email content

Optional:

  • cc - Carbon copy recipients
  • bcc - Blind carbon copy recipients
  • template_id - Template ID for template-based emails
  • attachments - File attachments
  • send_at - Scheduled send time (Unix timestamp)
  • personalizations - Personalization data

Tools

Send Basic Email

Send a basic email to multiple recipients including CC and BCC.

Parameters:

  • to (required) - Primary recipient email address
  • from (required) - Sender email address
  • subject (required) - Email subject line
  • content (required) - Email content with type
  • cc (optional) - Carbon copy recipients
  • bcc (optional) - Blind carbon copy recipients

Example:

/your-sendgrid-connection
action: send
entity: email
to: recipient@example.com
from: sender@example.com
subject: Hello, World!
content: {"type": "text/plain", "value": "Heya!"}
cc: ["recipient2@example.com", "recipient3@example.com"]

Response:

{
  "status": 202,
  "message": "Accepted"
}

Send Template Email

Send an email using a pre-built dynamic template.

Parameters:

  • to (required) - Recipient email address
  • from (required) - Sender email address
  • subject (required) - Email subject line
  • template_id (required) - Template ID
  • content (optional) - Default content if template fails
  • personalizations (optional) - Template variables

Example:

/your-sendgrid-connection
action: send
entity: template_email
to: recipient@example.com
from: sender@example.com
subject: Hello, World!
template_id: YOUR_TEMPLATE_ID
content: {"type": "text/plain", "value": "Heya!"}
personalizations: {"name": "John", "company": "Example Corp"}

Response:

{
  "status": 202,
  "message": "Accepted"
}

Send Email with Attachment

Send an email with file attachments.

Parameters:

  • to (required) - Recipient email address
  • from (required) - Sender email address
  • subject (required) - Email subject line
  • content (required) - Email content
  • attachments (required) - Array of attachment objects with content, type, filename, and disposition

Example:

/your-sendgrid-connection
action: send
entity: email_with_attachment
to: recipient@example.com
from: sender@example.com
subject: Hello, World!
content: {"type": "text/html", "value": "Hey, Please find attachment."}
attachments: [
  {
    "content": "[base64_encoded_file_content]",
    "type": "application/pdf",
    "filename": "document.pdf",
    "disposition": "attachment"
  }
]

Response:

{
  "status": 202,
  "message": "Accepted"
}

Send Scheduled Email

Send an email at a specific scheduled time.

Parameters:

  • to (required) - Recipient email address
  • from (required) - Sender email address
  • subject (required) - Email subject line
  • content (required) - Email content
  • send_at (required) - Unix timestamp for scheduled send time

Example:

/your-sendgrid-connection
action: send
entity: scheduled_email
to: recipient@example.com
from: sender@example.com
subject: Scheduled Email!
content: {"type": "text/plain", "value": "This email was scheduled."}
send_at: 1702560000

Response:

{
  "status": 202,
  "message": "Accepted"
}

Get Sender ID

Retrieve sender ID information by email address.

Parameters:

  • email (required) - Sender email address to look up

Example:

/your-sendgrid-connection
action: get
entity: sender
email: sender@yourdomain.com

Response:

{
  "results": [
    {
      "id": "s1234567",
      "email": "sender@yourdomain.com",
      "nickname": "Marketing Team",
      "verified": true,
      "verification_status": "approved"
    }
  ]
}

List Dynamic Templates

Retrieve a list of dynamic templates available in your SendGrid account.

Parameters:

  • generations (optional) - Filter by template generation (dynamic, legacy)
  • page_size (optional) - Number of templates per page

Example:

/your-sendgrid-connection
action: list
entity: templates
generations: dynamic
page_size: 50

Response:

{
  "result": [
    {
      "id": "d-template123456",
      "name": "Welcome Email",
      "generation": "dynamic",
      "updated_at": "2024-01-20T15:30:00Z",
      "versions": [
        {
          "id": "v-version123456",
          "template_id": "d-template123456",
          "active": 1,
          "name": "Version 1",
          "subject": "Welcome to Our Platform",
          "updated_at": "2024-01-20T15:30:00Z"
        }
      ]
    }
  ]
}

Notes

All emails return HTTP 202 status for successful acceptance into the delivery queue. Content types include “text/plain” and “text/html”. Attachments must be base64 encoded. Scheduled emails use Unix timestamps for send_at parameter. Template IDs start with “d-” prefix for dynamic templates. Sender verification is required for “from” addresses. Supports both PinkConnect and Paragon proxy connections. Personalizations allow dynamic content insertion in templates. File attachments support various MIME types including application/pdf, image/jpeg, and application/octet-stream.