The compile resource is used to create the documents via the DynamicDocs API. Use the compile API call to send the dynamic data and receive back a protected URL link to download the document.
The compile resource has only one end point and it uses the POST method.
https://api.advicement.io/v1/templates/{templateToken}/compile?...
The templateToken corresponds to the id of the public template you are using or its the template token founds in your template's settings. It is a required path parameter which identifies the correct template files to be used to compile your PDF document.
Please see our authentication guide to see how to authenticate your API calls.
The query parameters follow the ? in the end point and follow the template settings closely. If the query parameters are omitted the template settings will be used, while in a case where the query parameter is present, it will take precedence.
Note that the query parameters in the request take precendece over the settings in the DynamicDocs API. In other words, if the setting indicates the parameter to be set to true, but in the request the parameter is set to false, the API would overwrite the settings and produce the document as if the parameter is false.
The response settings deal with what happens to the document once it has been created.
.../templates/98765/compile?doc-url-expires-in={docUrlExpiresIn}&...
The docUrlExpiresIn is a numerical parameter which takes integers and describes after how many seconds the provided URL is available to download the document. The default value is 3600 (1 hour).
The compilation parameters set the options on how the document is compiled with latex and provide various options.
.../templates/98765/compile?latex-compiler={latexCompiler}&...
The latexCompiler parameter can take the following values:
.../templates/98765/compile?latex-runs={latexRuns}&...
The latexRuns is a numerical parameter and can take values of 1, 2 and 3. Note that compiling multiple times may incur additional costs.
.../templates/98765/compile?main-file-name={mainFileName}&...
The mainFileName is a string parameter which identifies the main file to compile. For example it can be the following value: mainfile.tex.
.../templates/98765/compile?doc-file-name={docFileName}&...
The docFileName is a string parameter which determines the name of the file. Note that the extension of the file is not required. For example it can be the following value: invoiceMar2020.
The pdf security settings deal with whether the pdf should be encrypted and the settings of the password.
.../templates/98765/compile?encrypt-type={encryptType}&...
The encryptType parameter can take the following values:
Currently, RC4 algorithm with 40 and 128 bit key sizes and Advanced Encryption Standard (AES) algorithm with 128 and 256 bit key size have been implemented. For more information on the algorithms visit RC4 and AES Wikipedia pages respectively.
.../templates/98765/compile?encrypt-type=aes-128&encrypt-viewer-password={viewerPassword}&...
The viewerPassword is a string parameter which is used as the viewer password for PDF encryption.
A viewer password (or also known as user password) gives the user the ability to view the file. For more information on PDF encyption visit the PDF encryption and signatures Wikipedia page.
.../templates/98765/compile?encrypt-type=aes-128&encrypt-viewer-password-json-key={viewerPasswordKey}&...
The viewerPasswordKey is a string parameter which identifies the location of a string in the JSON payload to use as the viewer password for the encrypted PDF. For example it can be the following value: client.viewer.password.
.../templates/98765/compile?encrypt-type=aes-128&encrypt-owner-password={ownerPassword}&...
The ownerPassword is a string parameter which is used as the owner password for the encrypted PDF. For example it can be the following value: client.owner.password.
An owner password gives the user the ability to modify the file. For more information on PDF encyption visit the PDF encryption and signatures Wikipedia page.
.../templates/98765/compile?encrypt-type=aes-128&encrypt-owner-password-json-key={ownerPasswordKey}&...
The ownerPasswordKey is a string parameter which identifies the location of a string in the JSON payload to use as the owner password for the encrypted PDF. For example it can be the following value: client.owner.password.
For compile request examples visit In this section we will show you an example of a compile request.
https://api.advicement.io/v1/templates/98765/compile?doc-url-expires-in=3600&latex-runs=1
Key | Value |
---|---|
doc-url-expires-in | 3600 |
latex-runs | 1 |
Key | Value |
---|---|
Adv-Security-Token | {API Key} |
For more request examples visit DynamicDocs Public Workspace on Postman API Network or fork the collection using the button below.