I'm working on a app where I add the user to sendgrid during sign up using the api:
PUT /marketing/contacts
I also add the user to specific list based on the status(DB data) of the user during signup.
Say I've 3 lists in sendgrid List A, List B, List C
Now I run a cron on every hour and check the status of the user and based on the condition I want to move the user from say List A to List B
As I checked I can add the user to the new list using the same api:
PUT /marketing/contacts
And I can remove the user from the previous list I can use the api:
DELETE /marketing/lists/{id}/contacts
But to in which list the user was previously added and to get the contact id from sendgrid I need to get the contacts from sendgrid, I'm using the api:
GET /marketing/contacts
But this api is only returning last 50 data and pagination option is also not there.
I also tried the api:
GET https://api.sendgrid.com/v3/contactdb/recipients?page_size=100&page=1
But this api is also returning me error
error:
{
"errors": [
{
"field": null,
"message": "access forbidden"
}
]
}
But the api key is fine because the marketing apis works with the same api key and the api key is generated with full access.
https://sendgrid.com/docs/API_Reference/api_v3.html https://sendgrid.com/docs/API_Reference/Web_API_v3/Marketing_Campaigns/contactdb.html
Can someone please help me to get all contacts from sendgrid via any other api or if there is any params I'm missing in the above mentioned apis.