Getting started 🚀

This quick tutorial will help you with creating your first dynamic template.

Getting started takes only two steps:

  1. Upload your template and get your template ID
  2. Send data to your template with the API

Upload your template 📥

There are two main ways to upload your template: Start from a google doc or start from a microsoft word document

Start from a Google document

Create a new google document and add some arbitrary text. Also add the text {{myFavoriteWizard}} and {{myFavoriteElf}} somewhere in your document.

Now share your document with access-document@aeco-docs-production.iam.gserviceaccount.com and grant view access.

⚠️ If you are an AECO developer and you are running the API in development, the access-document@aeco-docs-develop.iam.gserviceaccount.com service account is used.

Your template ID can be found in the URL of your google document:

https://docs.google.com/document/d/TEMPLATE_ID/edit

Save this template ID somewhere and go to the next step.

⚠️ Important

The API is directly linked to your google document template. This means that if you manualy change the contents of your template in google docs, the next API call will use this modified template. If you do not want the API to be directly linked to your template, download your google doc as .docx format and follow the Starting from a Microsoft word document step.

Starting from a Microsoft word document

This feature is comming sooon!

Send your data to the API ⚡️

Now that you have your template ID it is time to merge this template with your data!

Use the API playground or use your favorite HTTP package to send the following POST request :

// API Endpoint docs.aeco.cloud/api/v0.4
//JSON BODY { "templateId": "YOUR TEMPLATE ID", "documentName": "My First Document", "textSubstitutions": [ { "placeholder": "{{myFavoriteWizard}}", "text": "Gandalf 🧙🏻‍♂️" }, { "placeholder": "{{myFavoriteElf}}", "text": "Legolas 🧝‍♂️" } ], "returnType": ["pdf"] }

This request will:

  • create a document based on your template
  • replace the {{myFavoriteWizard}} and {{myFavoriteElf}} placeholders
  • return the result as a pdf

And that's it! You can now integrate this document into any service. For a full list of options checkout the documentation.


⚠️ Important

Note that the template itself will not be overwritten: a copy of the template is temporarily created, modified and returned as pdf. If you want to overwrite the template, take a look at the copyTemplate option.