API Keys management

List all API Keys belonging to the authenticated user [GET]

Request

1

GEThttps://api.sendgrid.com/v3/api_keysHTTP/1.1

Response

123456789

HTTP/1.1200{"result":[{"name":"A New Hope","api_key_id":"xxxxxxxx"}]}

Generate a new API Key for the authenticated user [POST]

This will create a new random API Key for the user with permissions assigned. A JSON request body containing a "name" property is required. If number of maximum keys is reached, HTTP 403 will be returned. Optionally, you can specify "scopes" to limit what permissions an API Key is given. If no API Key is provided, it will assign all of the parent account's assignable scopes to the API Key. For a list of all scopes, please look at the API Keys Permissions List

Request

Response

Revoke an existing API Key [DELETE]

Authentications using this API Key will fail
after this request is made, with some small propagation delay. For a list of permissions that can be assigned to API Keys, please see our API Keys Permissions List.

Response

Update the name of an existing API Key [PATCH]

A JSON request body with a "name" property is required. For a list of permissions that can be assigned to API Keys, please see our API Keys Permissions List.

Request

1

PATCHhttps://api.sendgrid.com/v3/api_keys/{api_key_id}HTTP/1.1

Request Body

123

{"name":"A New Hope"}

Response

12345

HTTP/1.1200{"api_key_id":"qfTQ6KG0QBiwWdJ0-pCLCA","name":"A New Hope"}

Update the name & scopes of an API Key [PUT]

A JSON request body with a "name" property is required.
Most provide the list of all the scopes an api key should have. For a list of permissions that can be assigned to API Keys, please see our API Keys Permissions List.

Request

1

PUThttps://api.sendgrid.com/v3/api_keys/{api_key_id}HTTP/1.1

Request Body

1234567

{"name":"A New Hope","scopes":["user.profile.read","user.profile.update"]}

Response

123456789

HTTP/1.1200{"api_key_id":"qfTQ6KG0QBiwWdJ0-pCLCA","name":"A New Hope","scopes":["user.profile.read","user.profile.update"]}

Request

Response

API Key usage

The API Keys feature adds a new "Bearer" scheme for HTTP authentication
for both v3 WebAPI and the mail.send API.This is an example. This endpoint does not exist.Returns HTTP 401 if authentication fails.