Introduction
How to use Transactional API ?
Welcome to the Transactional.dev API, your solution for managing PDFs in just a few minutes with a simple and intuitive interface. Our API is designed to be easy to use, allowing developers to generate PDF documents quickly and efficiently. Currently, the API consists of only one route, but we plan to expand this offering with specific packages for various programming languages to further simplify the developers’ tasks.
Single Route: Generate Documents
The Transactional.dev API currently offers a single route: Generate Documents. As the name suggests, this route allows you to generate PDF documents using predefined templates.
Authentication
The Transactional.dev API requires authentication via a token. This token is generated and provided in your dashboard, under the “API keys” tab. For each API request, you must include this token in the x-api-key header.
Generate a document
To use the Generate Documents route, you simply need to provide the template ID and the variables to be inserted into this template. Here is an overview of the required configuration:
- HTTP Method: POST
- URL: https://generate.transactional.dev/generate
- Headers:
- Content-Type: application/json
- x-api-key: [Your API token]
- Body:
{
"template_id": "your_template_id",
"variables": {
"variable1": "value1",
"variable2": {
"sub_variable1": "sub_value1",
"sub_variable2": ["item_value2", "item_value3"]
},
// Add as many variables as needed in your template
}
}
API Response
Documents are stored in cloudfront CDN and can be downloaded using the path provided in the response.
The API response will be a JSON object containing the following fields:
{
"requestId": "xxxxxxxxxxxxxxxxxx",
"path": "https://d2t3dpwh2k1aak.cloudfront.net/documents/xxxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxx.pdf"
}