How to use the genAndConvertEnvelope endpoint with Apex?

  • 4 April 2024
  • 1 reply


We have a request to automatically generate a docusign gen template that contains merge fields from an opportunity then automatically send it.

I found this video on YouTube

Which uses the genAndConvertEnvelope endpoint and provides a code example in the link but I’m new to Apex and stuck as to how to use the genAndSendEnvelope end point to go one step further and send the generated document via the api.

Does anyone have any apex code examples they could share or any advice on how to do it please?

I would like to do it with combination of flow and invocable apex where flow passes recordId, docusign templateId (with merge fields), recipient name and email as invocable variables to the apex class then use an at future method to make the callout to generate the document, create envelope, add generated document to envelope, set recipients and then send to recipient.

Has anyone done something similar?

1 reply



My name is Conar and I'm with DocuSign Developer Support.
Thanks for reaching out, with regards to how to use the CreateGenAndSendEnvelopes endpoint, you can use the explorer tool (URL below) to test how to create the call:

To get advice on how to build your custom solution you would need to reach out to our Professional Services team.
The Professional Services team is a team that can assist with more in depth construction of projects that fall outside of the break fix nature of support.
This service would come at an added cost.

I'm not sure if that is something you are interested in so I'll just leave the contact information and links to learn more about this team below:

- General Information:

Please confirm if this case can be closed.

Best regards,
Conar | DocuSign Developer Support