Actions7
- Account Actions
- Image Actions
- PDF Actions
- Transaction Actions
Overview
This node integrates with the CraftMyPDF API to generate images based on templates. Specifically, the Image - Create operation allows users to create an image by providing a template ID and JSON data to populate that template. The generated image can be returned either as a JSON object referencing a CDN-hosted image or as a binary file for secure and private use.
Common scenarios include:
- Dynamically generating customized images such as certificates, badges, or promotional graphics from predefined templates.
- Automating image creation workflows where input data changes frequently.
- Exporting images in different formats (JPEG or PNG) and delivery methods (CDN link or direct file).
Example: A marketing team could automate the generation of personalized event invitations by supplying attendee data to a template, then receiving the finished invitation image directly in their workflow.
Properties
| Name | Meaning |
|---|---|
| Region | Selects the API endpoint region to use. Options include Default, Australia, Europe (Frankfurt), US East (N. Virginia), alternative endpoints for these regions, and a staging environment. |
| Template ID | The identifier of the image template to use for generation. This must correspond to a valid template in the CraftMyPDF system. |
| Data | JSON data used to populate the template. Can be provided as a stringified JSON or a JSON object. This data drives the dynamic content within the image template. |
| Version | Specifies which version of the template to use. Defaults to the latest version if not specified. |
| Export Type | Determines the output format: json returns a JSON object with a CDN URL to the image (expires after a set time), while file returns the actual binary image data for secure and private usage. |
| Expiration | Time in minutes before the generated image expires and is removed from the CDN or storage. Valid range is 1 to 10080 minutes (7 days). |
| Output File | Filename to assign to the output image when exporting as a file. For example, "output.jpg". |
| Output Type | Image file format for export. Options are JPEG or PNG. |
Output
The node outputs an array of JSON objects corresponding to each input item processed.
- If Export Type is
json, the output JSON contains metadata about the generated image including a URL hosted on a CDN that is valid until expiration. - If Export Type is
file, the output includes the binary data of the generated image file, allowing downstream nodes to handle it securely (e.g., save to disk, upload elsewhere). The HTTP response header will indicate the file attachment disposition.
The exact structure depends on the export type but generally includes fields like:
{
"template_id": "...",
"url": "...", // Present if export_type=json
"expiration": 5,
"output_file": "output.jpg",
"output_type": "jpeg"
}
or binary data representing the image file.
Dependencies
- Requires an active connection to the CraftMyPDF API via an API key credential configured in n8n.
- Network access to the selected regional API endpoint.
- Properly formatted JSON data matching the template's expected schema.
Troubleshooting
- Invalid JSON Data: If the
dataproperty contains malformed JSON, the node throws an error indicating invalid JSON. Ensure the JSON is correctly formatted and matches the template requirements. - API Authentication Errors: Missing or incorrect API credentials will cause authentication failures. Verify the API key is correctly configured.
- Unsupported Export Type or Output Type: Selecting unsupported combinations may cause errors. Use only the documented options.
- Expiration Limits: Setting expiration outside the allowed range (1 to 10080 minutes) may result in errors.
- Template Not Found: Using an invalid or non-existent template ID will cause the API to return an error.
- Network Issues: Connectivity problems to the chosen regional endpoint can cause request failures.
To resolve errors, check the input parameters carefully, validate JSON data, confirm API credentials, and ensure network connectivity.