Links

SendGrid

The SendGrid UI lets you create API keys with full access, but we strongly recommend creating an API key with limited scopes when connecting SendGrid to Trelica.
The specific scopes required by Trelica can't be created through the SendGrid user interface, so we recommend temporarily creating a full access API key, and then using the API to create a limited scope key, and then delete the full access key.

Creating the temporary Full Access API Key

First log in to SendGrid as an administrator and go to Settings > API Keys and click Create API Key:
Give your key a name (e.g. Temp Full Access) and choose Full Access permissions and click Create & View:
You will be shown the new API key. Click on it to paste it to the clipboard:
Now we can use the full access API key to create a limited scope key.

Creating the limited scope key

Go to the command line and run the following curl command, substituting {API_KEY} for the full access API key:
curl --location --request POST 'https://api.sendgrid.com/v3/api_keys' \
--header 'Authorization: Bearer {API_KEY}' \
--header 'Content-Type: application/json' \
--data-raw '{ "name": "Trelica", "scopes": ["teammates.read"] }' \
| jq .
If you don't have jq installed, just skip the piping in the final line. jq just formats the JSON response more neatly for you.
The command should output something like this:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 217 100 166 100 51 342 105 --:--:-- --:--:-- --:--:-- 447
{
"api_key": "SG....................................-dKdIgFgY",
"api_key_id": "ynfH3dkkSYfdvQRKIjcP5Q",
"name": "Trelica",
"scopes": [
"teammates.read"
]
}
You need the longer "api_key" attribute, not the "api_key_id" one.
Copy the value for the api_key attribute (excluding the quotation marks) and paste it into Trelica when asked, when you connect the integration.

Tidying up

Once you've generated the limited scope key, you can tidy up the full access one. Just go back to SendGrid and delete it:
Be sure to delete the temporary Full Access token you created at the start, and not the limited scope Trelica token you just created.
Last modified 8mo ago