n8n
Render a PDF or image from an oJo template in any n8n workflow, with the HTTP Request node and your API key. There is no oJo node to install.
Before you start
- An oJo API key .
- A saved template and its ID. See Create Template, or start from the gallery.
1. Add your API key to n8n
Create a credential of type Header Auth:
| Field | Value |
|---|---|
| Name | Authorization |
| Value | Bearer <your API key> |
2. Paste the node
Copy this and paste it on your workflow canvas with Ctrl+V (Cmd+V on a Mac):
{
"nodes": [
{
"parameters": {
"method": "POST",
"url": "https://api.ojo.so/v1/pdf/template",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ templateId: '<Template ID>', modify: { invoice: { number: $json.number }, customer: { name: $json.customer } } }) }}",
"options": {}
},
"name": "oJo: render PDF",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [0, 0]
}
],
"connections": {}
}Then open the node, pick your Header Auth credential, connect it after the step that holds your data, and edit the body:
- Replace
<Template ID>with your template’s ID. - Shape
modifylike your template’s variables.$json.numberreads the fieldnumberfrom the step before.get_templateor Get Template lists every field a template reads.
The body is one JSON.stringify expression, so quotes and line breaks in your data stay valid JSON.
For a PNG, use https://api.ojo.so/v1/image/template with the same body. The
response then holds imageUrl. See Create Image from Template.
3. Use the file
The node returns the JSON response. pdfUrl has no scheme, so later nodes use
https://{{ $json.pdfUrl }}. Send it in an email or a Slack message, or fetch it with a second HTTP
Request node set to Response Format: File to attach the PDF itself.
When it fails
| Status | Meaning |
|---|---|
| 400 | The body is not valid JSON. |
| 401 | The credential’s value is not Bearer followed by a valid key. |
| 402 | Out of credits. |
| 422 | The request was refused before rendering, for example a missing templateId. The message says why. |
| 429 | Too many requests. Add a Wait node or batch the items. |
Tested with n8n 2.44.7. Want an oJo node in n8n’s list instead? Tell us.