Is it possible to actually delete a contact
from mailjet?
Their contact API doc doesn't even list delete
as a supported action.
from mailjet_rest import Client
mailjet = Client(auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3')
mailjet.contact.delete(<contact-id>).json()
{'ErrorInfo': '', 'ErrorMessage': 'Operation not allowed', 'StatusCode': 401}
I am interested in removing a contact
, not a list recipient
, and hence this question is not a duplicate of How can i delete a contact from a list with the mailjet api and php?.
The API reference does not yet seem to be updated with the DELETE method, but under API guides there seems to be information on how to delete contacts:
Retrieve a Contact
To delete a contact, you must first identify its presence in the contact database of your account.
Use GET /contact/$CONTACT_EMAIL to do it.
curl -s \
-X GET \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v3/REST/contact/$CONTACT_EMAIL
Delete the Contact
Use the {contact_ID} you retrieved to DELETE the contact with the /v4/contacts/{contact_ID} endpoint. When the deletion is successful, the API will return a 200 OK status. Any other response will indicate that the deletion was not successfully processed.
curl -s \
-X DELETE \
--user "$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE" \
https://api.mailjet.com/v4/contacts/{contact_ID} \
NB: this is a /v4 endpoint, not /v3
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With