Bouncewise

Bouncewise › Guides › SendGrid API key permissions: full, custom and read-only

SendGrid guide

SendGrid API key permissions: full, custom and read-only

Updated · 3 min read

Short answer

SendGrid API keys come in Full Access (every endpoint except billing), Custom Access (only the permissions you pick, stored as scopes such as mail.send or stats.read) and Billing Access (billing endpoints only, never combined with anything else). For an app that only sends, give a Custom Access key Mail Send and nothing more; for a dashboard or monitoring tool, give only read permissions. The key is shown once, when you create it, and you can check what any key can do with GET /v3/scopes.

The key types

TypeWhat it can doUse it for
Full AccessAll API endpoints, full access to your account (not billing)Admin scripts you control; avoid in apps
Custom AccessOnly the endpoints and access levels you chooseAlmost everything: sending, monitoring, webhooks setup
Billing AccessAll billing endpointsBilling integrations only
Email Address Validation AccessValidation API, plus read access to the reporting consoleEmail validation (a separate paid feature)

A key can cover either billing permissions or any other set of permissions, never both. And you can't give a key more permissions than your own teammate account has, so a key created by a restricted teammate is limited too.

Create and edit keys under Settings > API Keys. You can change a key's name and permission levels later from its action menu (Edit API Key), so you don't need a new key to add a missing permission. An account can have at most 100 API keys.

Connect SendGrid screen with a field for the API key and a choice of Global or EU region
A monitoring app only needs a read-only Custom Access key.

Scopes: what the console's checkboxes become

Behind the console, each permission is a scope string on the key. A few you'll meet most:

AreaScopes
Sendingmail.send
Statsstats.read, stats.global.read
Email Activity / Email Logsemail_activity.read
Suppressionssuppression.bounces.read, suppression.blocks.read, suppression.spam_reports.read, suppression.invalid_emails.read, suppression.unsubscribes.read (each also has .create, .update, .delete)
Domain authenticationwhitelabel.read (and .create, .update, .delete)
Templatestemplates.read and friends
API keysapi_keys.read and friends: don't give these to an app

A missing scope shows up as HTTP 403 with access forbidden in errors[].message, not as 401. A 401 means the key itself is wrong, deleted or missing.

Check what a key can do

Ask SendGrid for the key's scopes:

curl -s https://api.sendgrid.com/v3/scopes \
  -H "Authorization: Bearer $SENDGRID_API_KEY"
{"scopes":["mail.send","alerts.create","alerts.read"]}

If mail.send is missing, the key can't send; if it's present on a key you gave to a reporting tool, that tool can send mail as you. EU regional subusers call https://api.eu.sendgrid.com instead.

  • Your app or server, sending only: Custom Access with Mail Send. Nothing else. If it leaks, the attacker can send mail but can't read your lists, change DNS settings or create more keys.
  • Dashboards, monitoring and phone apps: Custom Access with read access to Stats, Email Activity, Suppressions and Sender Authentication. No Mail Send, no delete scopes. It can show you everything and change nothing.
  • A tool that cleans suppressions: add the .delete scope only for the list it manages. Removing an address from bounces or spam reports means SendGrid will mail it again.
  • One key per integration, named after it. When one leaks or a contractor leaves, you delete that key and nothing else breaks.

Lost, leaked or deleted keys

The console displays the key only once, at creation. If you didn't copy it, you can't see it again: create a new key and update the app. After you delete a key, SendGrid rejects every API call that uses it, and a deleted key can't be restored, so roll the replacement out first.

If a key with Mail Send leaks, delete it straight away. Sending keys are a favourite target for spammers, and the damage lands on your domain's and your account's reputation.

Questions

Is there a read-only API key in SendGrid?

Not as a separate type. Create a Custom Access key and give it only read access to the categories you need; check the result with GET /v3/scopes.

Why does my SendGrid key get 403 access forbidden?

The key, or the teammate who created it, lacks the scope for that endpoint. Edit the key under Settings > API Keys and add the permission, or use a key that has it.

Can I see an existing SendGrid API key again?

No. It is shown once at creation; if it's lost, create a new key and delete the old one.

Why does Email Activity return 403 even with full access?

The legacy Email Activity API at /v3/messages also needs the paid additional Email Activity history add-on on the account.

Sources