'get sent or recieved emails from sendgrid

We're using SendGrid for email service for a project backend.

Now, we want to set up e2e tests for the project. To get a well-verified user, we have to know the verification code sent to the user's email at the time of the registration.

I've tried with the messages endpoint as:

curl --request GET \
  --url https://api.sendgrid.com/v3/messages \
  --header 'Authorization: Bearer SG.xxxxxxxxxxxxxxxxxxxxxxxxx' \
  --header 'Content-Type: application/json'

But the response says:

{"errors":[{"message":"authorization required"}]}

Is there any way that we can get the sent emails using the SendGrid API?

Thank you in advance.



Solution 1:[1]

At the top of the documentation for the email activity API it says:

In order to gain access to the Email Activity Feed API, you must purchase additional email activity history.

I would guess that you are receiving that error because your account does not have that additional email activity history add-on.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 philnash