Sending

SendGrid-compatible email API: keep your SDK, change the host

Short answer

A SendGrid-compatible email API accepts the same POST /v3/mail/send request body, so your existing SendGrid SDK keeps working after you change the base URL and the key. Mailcandor accepts personalizations, from, reply_to, subject, content, attachments, headers, categories and send_at. Dynamic templates, custom_args, unsubscribe groups, IP pools, mail_settings and tracking_settings do not carry over, and webhooks use Mailcandor's own events.

Last checked 16 November 2026

A SendGrid-compatible email API accepts SendGrid’s POST /v3/mail/send request as it is. You keep the SendGrid SDK, the code that builds the request and your tests, and change two things: the base URL and the API key. This page lists exactly which fields Mailcandor carries over, which it ignores or refuses, and shows working code before and after the switch.

What “compatible” means here

Mailcandor runs SendGrid’s Mail Send endpoint at https://api.mailcandor.com/v3/mail/send. It reads the SendGrid body, turns each personalization into one Mailcandor email, and answers the way SendGrid does: 202 Accepted with an empty body and an X-Message-Id header.

Only Mail Send is compatible. The rest of the SendGrid v3 API (suppression groups, stats, Marketing Campaigns, subusers, template management) is not there. For those jobs you use Mailcandor’s own API and dashboard.

Before you send, verify your domain in Mailcandor. Until a domain is verified, your team is in the sandbox and can only send to its own members, whatever SDK you use.

Before and after: Node.js

Before, with SendGrid:

import sgMail from '@sendgrid/mail';

sgMail.setApiKey(process.env.SENDGRID_API_KEY);

await sgMail.send({
  to: 'sam@example.com',
  from: { email: 'hello@acme.com', name: 'Acme' },
  subject: 'Your receipt for order 1042',
  html: '<p>Thanks for your order.</p>',
  categories: ['receipt'],
});

After, with Mailcandor:

import sgMail from '@sendgrid/mail';

sgMail.setApiKey(process.env.MAILCANDOR_KEY);
sgMail.client.setDefaultRequest('baseUrl', 'https://api.mailcandor.com');

await sgMail.send({
  to: 'sam@example.com',
  from: { email: 'hello@acme.com', name: 'Acme' },
  subject: 'Your receipt for order 1042',
  html: '<p>Thanks for your order.</p>',
  categories: ['receipt'],
});

Set the base URL after setApiKey, because setting the key also sets the default base URL. The client may log a warning that the key does not start with SG.. That warning is harmless: the key is sent as a bearer token and Mailcandor reads it the same way.

Before and after: Python

import os
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail

# Before: SendGridAPIClient(os.environ["SENDGRID_API_KEY"])
sg = SendGridAPIClient(
    api_key=os.environ["MAILCANDOR_KEY"],
    host="https://api.mailcandor.com",
)

message = Mail(
    from_email="hello@acme.com",
    to_emails="sam@example.com",
    subject="Your receipt for order 1042",
    html_content="<p>Thanks for your order.</p>",
)
response = sg.send(message)
print(response.status_code, response.headers.get("X-Message-Id"))

Before and after: curl

curl https://api.mailcandor.com/v3/mail/send \
  -H "Authorization: Bearer $MAILCANDOR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "personalizations": [{ "to": [{ "email": "sam@example.com" }] }],
    "from": { "email": "hello@acme.com", "name": "Acme" },
    "subject": "Your receipt for order 1042",
    "content": [{ "type": "text/html", "value": "<p>Thanks for your order.</p>" }]
  }'

The only change from a SendGrid curl call is the host and the key.

Fields that carry over

SendGrid field What Mailcandor does with it
personalizations[] Each entry becomes one email, as SendGrid sends them
personalizations[].to, cc, bcc Recipients, with names kept as Name <email>
personalizations[].subject Subject for that email, falling back to the top-level subject
personalizations[].send_at, send_at Scheduled send time (Unix seconds), up to 30 days ahead
from Sender, email plus optional name
reply_to, reply_to_list Reply-To address or addresses
subject Default subject
content The first text/plain and the first text/html value
attachments[] content (base64), filename, type, content_id for inline images
headers Custom headers on every email in the request
categories Tags named category, returned in webhooks

Each email is checked like any other Mailcandor send: the from domain must be verified, and each email can have at most 50 recipients across to, cc and bcc.

Fields that do not carry over

SendGrid field What happens
template_id, dynamic_template_data Refused with a 400 error. Send rendered HTML instead
personalizations[].substitutions, dynamic_template_data Ignored
personalizations[].headers, custom_args Ignored. Use top-level headers
custom_args Ignored
asm (unsubscribe groups) Ignored
ip_pool_name, batch_id Ignored
mail_settings (including sandbox_mode) Ignored, so a sandbox request sends a real email
tracking_settings Ignored
attachments[].disposition Ignored. A content_id makes the file usable inline

The sandbox_mode row matters most. If your test suite relies on SendGrid’s sandbox to validate requests without sending, those tests will send real mail through Mailcandor. Strip the setting, use a separate team for tests, or point tests at Mailcandor’s POST /v1/emails/check, which checks content without sending.

Responses and errors

A good request returns 202 with no body and an X-Message-Id header. When one request has several personalizations, the header carries the id of the first email only. If you need every id, send one personalization per request or use Mailcandor’s native POST /v1/emails/batch, which returns all of them.

Validation errors come back as 400 in SendGrid’s shape:

{ "errors": [{ "message": "SendGrid dynamic templates are not supported. Send the rendered html in content, or use a Mailcandor template.", "field": "template_id", "help": null }] }

Other failures keep their status: 403 when the domain is not verified or a key is locked to another domain, 429 when you pass your team’s per-second rate limit.

Webhooks, events and SMTP

SendGrid’s Event Webhook format does not carry over. Mailcandor sends its own webhooks for email.delivered, email.bounced, email.complained and the rest, signed with Standard Webhooks and retried up to 8 times over about 28 hours. Plan a small handler change alongside the host change.

If you send through SendGrid’s SMTP relay instead of the API, change the host to smtp.mailcandor.com, the username from apikey to mailcandor, and the password to your Mailcandor key. Do not rely on SendGrid’s X-SMTPAPI header features such as substitutions.

A safe way to switch

  1. Add and verify your sending domain in Mailcandor. Leave your SendGrid DNS records in place.
  2. Create a sending-only key, locked to that domain if one service sends from one domain.
  3. Change the base URL and key in one environment, send a test, and check it in the Mailcandor log.
  4. Move webhook handling to Mailcandor events.
  5. Keep SendGrid as a fallback for a few weeks. The same request body works against both hosts, which makes a failover setup cheap.

The full checklist lives on the switch from SendGrid page. Mailcandor access is by request: see pricing for the plans and the request button.

Questions

Can I keep using the @sendgrid/mail package?

Yes. Call setApiKey with a Mailcandor key, then set the client's baseUrl to https://api.mailcandor.com. The package sends the same v3 request, and Mailcandor answers it with 202 and an X-Message-Id header.

Do SendGrid dynamic templates work?

No. A request with template_id is refused with a 400 error. Render the HTML in your app and send it in content, or recreate the template as a Mailcandor stored template and send it through the native API.

Does sandbox_mode stop the email from sending?

No. mail_settings is ignored, including sandbox_mode, so a request that would have been a dry run on SendGrid sends a real email. Remove sandbox_mode from tests or point tests at a separate team.

Do SendGrid Event Webhooks keep working?

No. Mailcandor sends its own webhook events (email.delivered, email.bounced and so on) in its own JSON shape, signed with Standard Webhooks. Point a new handler at those events.

What about SendGrid SMTP?

Change the host to smtp.mailcandor.com, the username from apikey to mailcandor, and the password to a Mailcandor API key. Ports 465 and 587 both work.

Related

Send with someone on your side.

Unlimited domains on every plan, a person before any block, and 3,000 emails a month free. Tell us what you send and we set you up within one business day.