Guide
Automate ad creative with n8n and the Adlark API
Set up the n8n HTTP Request node with header auth, then build a flow: new Shopify product to ad copy and images, saved to Drive and a Google Sheet.
· 6 min read
n8n talks to the Adlark API through its standard HTTP Request node. There is no custom node to install. This guide sets up the credential once, then builds a workflow that writes ad copy and makes two ad images every time a product is added to a Shopify store, and logs the results in a Google Sheet.
Step 1: a Header Auth credential
Create an API key in the studio (Account -> API keys). In n8n, open Credentials -> Add credential -> Header Auth, then fill in:
| Field | Value |
|---|---|
| Name | Authorization |
| Value | Bearer adl_your_key_here |
Name the credential something like Adlark. Every HTTP Request node in this guide uses it, so the key lives in one place and never appears in the workflow JSON you might export or share.
Step 2: test with a credits call
Add an HTTP Request node and set:
- Method:
GET - URL:
https://adlark.alexshipit.com/api/v1/credits - Authentication: Generic Credential Type -> Header Auth -> Adlark
Execute the node. You should see credits, plan_credits, pack_credits and rank. A 401 means the credential value is wrong; check that it starts with Bearer and has a space after it.
Step 3: the workflow
The finished flow has six nodes:
- Shopify Trigger, topic
products/create. - HTTP Request: write the ad copy.
- HTTP Request: generate two images.
- Split Out on
images. - HTTP Request: download each image as a file, then Google Drive: Upload.
- Google Sheets: Append Row with the copy and the Drive links.
Node 2: ad copy
- Method
POST, URLhttps://adlark.alexshipit.com/api/v1/copy, same Header Auth credential. - Send Body: on. Body Content Type: JSON. Specify Body: Using JSON.
{
"product": "{{ $json.title }}",
"details": "{{ $json.body_html.replace(/<[^>]+>/g, ' ').slice(0, 600) }}",
"platform": "instagram",
"tone": "friendly",
"language": "English"
}The expression strips HTML from the Shopify description and caps it, so the request stays small. If product titles can contain double quotes, build the body with an expression instead ({{ JSON.stringify({ product: $json.title }) }}) so the JSON stays valid.
Node 3: images
Same setup, URL https://adlark.alexshipit.com/api/v1/images. With FLUX.2 klein at 1K this costs 9 credits per image at the API rate, so 18 for the pair.
{
"prompt": "Studio product photo of {{ $('Shopify Trigger').item.json.title }} on a soft gradient backdrop, softbox light, centered, space at the top for a headline",
"model": "klein",
"size": "1K",
"aspect": "4:5",
"count": 2
}To use the real product photo as a reference, add a node before this one that downloads $json.image.src as a binary file, then a Code node that turns it into base64 and passes it as reference_images: ["data:image/jpeg;base64,..."]. References make the result look like your product instead of a generic one, which matters for anything you will actually run. See product photo reference images.
Nodes 4 and 5: save the files
Image URLs need the bearer header, so a link in a spreadsheet will not open for your team. Save the files somewhere shared instead:
- Split Out, field
images, so each image becomes its own item. - HTTP Request: Method
GET, URL{{ $json.url }}, same Header Auth credential, Options -> Response -> Response Format: File. - Google Drive: Upload, using the binary field from the previous node, into a folder like
Ads / New products.
Node 6: log to Google Sheets
Append a row with the product title, the first two headlines, the first primary text, the first CTA, the Drive file links and the job ids. Reference earlier nodes with expressions like {{ $('Write copy').item.json.copy.headlines[0] }}. The job ids let you look anything up later with GET /api/v1/jobs/{id}.
Error handling
| Status | In n8n |
|---|---|
| 429 / 503 | Node Settings -> Retry On Fail: on, Max Tries 3, Wait Between Tries 5000 ms. |
| 402 | Not enough credits. Retries will not help. Route the error output to a Slack or email node. |
| 401 | The credential is wrong or the key was revoked. |
Turn on Settings -> On Error -> Continue (using error output) for the API nodes so one bad product does not stop the whole run, and send the error branch to a notification.
Variations worth building
- Weekly competitor review: a Schedule Trigger reads ad files from a Drive folder, sends each to
/api/v1/analyzeas multipart (Body Content Type: Form-Data, a fieldfileof type n8n Binary File, plusplatform), and writes the grade and hooks to a sheet. 56 credits per ad. - Captions on upload: a Drive trigger on a "raw videos" folder posts each MP4 to
/api/v1/captionswithstyleset tobold-popand saves the returned video and SRT. 28 credits per video. - UGC brief generator: a form trigger collects product, angle and length, calls
/api/v1/ugc-script(6 credits) and emails the script to a creator.
Prefer Make? The same flow is in Make scenarios with the API. For the full field list, see the API docs.