> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sendpost.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Troubleshooting & FAQs

> Common issues, solutions, and frequently asked questions for SendGrid integration with SendPost.

## Common Issues

<AccordionGroup>
  <Accordion title="Emails Not Sending" icon="envelope">
    **Symptoms**: Emails are not being delivered through SendGrid

    **Checklist**:

    * Verify your SendGrid API key is valid and has Mail Send permissions
    * Check that the TPSP is active in SendPost
    * Review the SendPost event logs for errors
    * Confirm your SendGrid account is in good standing

    **Test Your API Key**:

    ```bash theme={null}
    curl -X GET "https://api.sendgrid.com/v3/user/profile" \
      -H "Authorization: Bearer YOUR_SENDGRID_API_KEY"
    ```

    If this returns 401, your API key is invalid.
  </Accordion>

  <Accordion title="Events Not Appearing" icon="bell-slash">
    **Symptoms**: Emails are sent but opens/clicks/bounces not showing

    **Checklist**:

    * Verify webhook is registered in SendGrid Dashboard
    * Check webhook URL is correct
    * Ensure webhook events are enabled
    * Wait a few minutes (events are batched for processing)

    **Verify Webhook in SendGrid**:

    1. Go to SendGrid → Settings → Mail Settings → Event Webhook
    2. Confirm URL shows: `https://api.sendpost.io/tpsp/sendgrid/account/{account-id}`
    3. Verify all event checkboxes are enabled
  </Accordion>

  <Accordion title="Bounces Not Processing" icon="rotate-left">
    **Symptoms**: Bounced emails not reflected in analytics

    **Check**:

    * Review SMTP codes in event details
    * Hard bounces (5xx codes) = permanent failures
    * Soft bounces (4xx codes) = temporary failures
    * Ensure bounce events are enabled in webhook settings
  </Accordion>

  <Accordion title="API Key Errors" icon="key">
    | Error Code | Meaning                  | Solution                           |
    | ---------- | ------------------------ | ---------------------------------- |
    | 401        | Invalid API key          | Regenerate API key in SendGrid     |
    | 403        | Insufficient permissions | Update API key permissions         |
    | 429        | Rate limit exceeded      | Wait and retry, or increase limits |
  </Accordion>

  <Accordion title="SendGrid-Compatible API Errors" icon="code">
    **400 Bad Request with field error**:

    ```json theme={null}
    {
      "errors": [{
        "message": "Field 'template_id' is not supported...",
        "field": "template_id"
      }]
    }
    ```

    **Solution**: Remove the unsupported field from your request

    **413 Payload Too Large**:
    **Solution**: Reduce request size below 30MB
  </Accordion>
</AccordionGroup>

***

## Getting Help

If you're still experiencing issues:

1. **Check Logs**: Review detailed event logs in SendPost dashboard
2. **Contact Support**: Reach out to SendPost support with:
   * Your account ID
   * TPSP ID
   * Message ID (if available)
   * Error messages
   * Timestamp of the issue

***

## FAQs

<AccordionGroup>
  <Accordion title="Can I use multiple SendGrid accounts?">
    Yes! Create a separate TPSP for each SendGrid account. Each will have its own webhook and configuration.
  </Accordion>

  <Accordion title="Does SendPost store my SendGrid API key securely?">
    Yes, all API keys are encrypted at rest and never exposed in logs or API responses.
  </Accordion>

  <Accordion title="Can I use SendGrid for some emails and SendPost IPs for others?">
    Yes, SendPost supports intelligent routing. You can configure rules to route specific traffic through SendGrid.
  </Accordion>

  <Accordion title="What happens if the webhook endpoint is temporarily unavailable?">
    SendGrid will retry webhook delivery. Events will be processed once connectivity is restored.
  </Accordion>

  <Accordion title="Are duplicate events possible?">
    SendGrid may occasionally send duplicate events. SendPost handles deduplication using the `sg_event_id`.
  </Accordion>

  <Accordion title="Will my existing SendGrid templates work?">
    SendGrid templates (`template_id`) are not supported through the compatible API. You'll need to include the content directly or use SendPost's native template system.
  </Accordion>

  <Accordion title="Can I gradually migrate traffic?">
    Yes! You can run both systems in parallel during migration. Route a percentage of traffic to SendPost while keeping some on SendGrid directly.
  </Accordion>

  <Accordion title="What's the latency for event processing?">
    Events are typically processed within 1-5 seconds of being received from SendGrid.
  </Accordion>

  <Accordion title="Is there a limit on emails per day?">
    SendPost doesn't impose hard limits, but your SendGrid plan limits still apply. Configure throttling to match your SendGrid limits.
  </Accordion>
</AccordionGroup>
