SendGrid
Authorization grant is invalid is a SendGrid 535 SMTP or 401 API auth failure. Set SMTP username to apikey, use a full-permission API key, and use TLS 1.2.
Updated Jul 1, 2026
The short answer
"The provided authorization grant is invalid, expired, or revoked" is the message SendGrid returns with a 535 SMTP (or 401 API) authentication failure. Despite the OAuth-sounding wording, it means SendGrid rejected your credentials. Fix it by setting the SMTP username to the literal string apikey, the password to a valid full-permission API key, and using TLS 1.2+.
SendGrid returns "535 Authentication failed: The provided authorization grant is invalid, expired, or revoked" (or a 401 Unauthorized on the Web API v3) when it rejects the credentials you presented. The OAuth-style phrasing is misleading: SendGrid SMTP and the v3 API authenticate with a single API key, not an OAuth authorization grant. The message simply means "the key you sent is not a valid, active, sufficiently-permissioned key."
SG.. A trailing space, a line break, or copying only part of the key will fail. The key is shown only once at creation — if you lost it you must create a new one.apikey. For SMTP relay, the username must be the literal lowercase string apikey for every account — not your SendGrid login, email, or account name. The password is the full API key. Using your account username here is the single most common cause.smtp.sendgrid.net. Valid ports are 587, 25, or 2525 (STARTTLS) and 465 (implicit TLS). A firewall/ISP blocking these can present as an auth/connection failure.SG.-prefixed string immediately.smtp.sendgrid.net587 (or 465 / 2525 / 25)apikey (literal)Authorization: Bearer SG.xxxxxxxxxxxxxxxxxxxxxx
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;.openssl s_client -starttls smtp -connect smtp.sendgrid.net:587 -crlf
Then issue AUTH LOGIN with base64-encoded apikey and your key.
With Courier
References
FAQ
No. Although the wording comes from OAuth2's invalid_grant family, SendGrid SMTP and the v3 API authenticate with an API key, not an OAuth grant. The message is SendGrid's way of saying the API key (or SMTP credentials) you presented is invalid, expired, revoked, or lacks Mail Send permission.
One API, every provider
Courier connects to your email, SMS, and push providers, handles retries and failover, and surfaces delivery errors in plain language.
Reply-code definitions per RFC 4954 (535 5.7.8). Last reviewed Jul 1, 2026. Courier is not affiliated with third-party providers; error behavior may vary by implementation.
© 2026 Courier. All rights reserved.