Get tracking-ID of email send through API

I’m using the REST-API of Mautic quite a lot, especially for sending emails from templates to individuals. In the GUI i can go to a contact and see that the mail was sent to him and also find the tracking-ID in the URL. The API call to send the mail does not contain that ID, and i wonder how i could get it from there?

What endpoint are you calling specifically?

POST /emails/ID/contact/CONTACT_ID/send

https://developer.mautic.org/#send-email-to-contact

Hi,

sorry for late reply, I must have missed this topic a bit. I am not exactly sure which ID you are after can you attach some screenshots, please?

Thanks.

In a contact, list “History” and click on the text of one with a mail-symbol in:


you get to a web-preview with the mail sent, and i’m interested in getting this URL using the API:
27-12-_2021_07-53-59

1 Like

I will check what can be done and let you know, I hope I will be able to do it today.

Thanks.

Great! My intention is to give internal support-staff access to that preview of the mail sent to the contact.
Meanwhile i found out that the ID i was looking for is called “tracking hash” inside of Mautic and can be looked up in the database table “email_stats” using this SQL-Query:
SELECT * FROM mautic.email_stats where tracking_hash='61caf85f1fedb634381549';
But doing SQL directly to the database was not my idea, i’d really like to rely on the REST API.
If i had time i tried to look into the code myself, but i’m too limited currently.

A problem could arise if the tracking-hash was not created during the API-call to send the mail… but let’s see what you find out!