How to use Email Templates from the API?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • leonbbb
    Junior Member
    • Sep 2025
    • 1

    #1

    How to use Email Templates from the API?

    Hello all,

    I want to send Emails using an API User. I can do that easily, however, I do not find the right settings to apply a template by id?
    Is there a way to POST to api/v1/email and have a emailtemplateId in the request body?

    All help is very much appreciated!

    Thank you very much


    EDIT:
    To clarify, I want to do what I can do in the UI, select a template for for example an opportunity and then send that email with the body from the template.
    Last edited by leonbbb; 11-23-2025, 11:39 AM.
  • lazovic
    Super Moderator
    • Jan 2022
    • 1193

    #2
    Hi leonbbb,

    You can use two HTTP requests:

    POST {ESPO_URI}/api/v1/EmailTemplate/email-template-id/prepare

    Payload:
    Code:
    {
      "emailAddress": "to-email-address",
      "parentId": "parent-id",
      "parentType": "parent-type" // like Contact or Account
    }
    In response to this request, you'll receive the following values generated by the email template:
    • subject
    • body
    • isHtml
    • attachmentsIds
    • attachmentsNames
    Then, you can use these values in the following HTTP request:

    POST {ESPO_URI}api/v1/Email​

    Comment

    • jamie
      Senior Member
      • Aug 2025
      • 169

      #3
      you can also access the espo pdf generation directly via folumlas and from php

      Comment

      Working...