curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_field_types": [
"MARKETING_IMAGE",
"SQUARE_MARKETING_IMAGE"
],
"final_url": "https://example.com/spring"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images"
payload = {
"asset_field_types": ["MARKETING_IMAGE", "SQUARE_MARKETING_IMAGE"],
"final_url": "https://example.com/spring"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
asset_field_types: ['MARKETING_IMAGE', 'SQUARE_MARKETING_IMAGE'],
final_url: 'https://example.com/spring'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'asset_field_types' => [
'MARKETING_IMAGE',
'SQUARE_MARKETING_IMAGE'
],
'final_url' => 'https://example.com/spring'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images"
payload := strings.NewReader("{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}"
response = http.request(request)
puts response.read_body{
"session_id": "9c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
"assets": [],
"background_pending": true,
"background_count": 3,
"in_flight": true
}Generate Google Ads image assets
Generates ad pictures for the app and returns them as previews.
Nothing reaches Google Ads here. Each picture comes back with a session_asset_id you pass to Accept a generated Google Ads asset to put it on a live campaign.
Send exactly one of final_url and freeform_prompt. Sending both is rejected, and so is sending neither, which is the one place this endpoint differs from Generate Google Ads assets, where omitting both is allowed and grounds the pictures in the app’s home page.
Pictures are slower than copy, so the response returns once the first one is ready. assets holds what finished in time and background_pending with background_count say that more are coming. Poll List Google Ads generated assets with the returned session_id for the rest. assets can be empty while background_pending is true, which means the pictures are being generated but none landed in time.
in_flight set to true, that run’s session_id, and an empty assets. Poll the session_id you were given rather than retrying.Each shape in asset_field_types costs one of 30 picture requests a minute per app, and the retry below costs the whole shape count again. So four shapes cost 4 normally and 8 on a retry, which is three calls a minute in the worst case rather than seven, and a single shape costs 1 or 2.
curl --request POST \
--url https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"asset_field_types": [
"MARKETING_IMAGE",
"SQUARE_MARKETING_IMAGE"
],
"final_url": "https://example.com/spring"
}
'import requests
url = "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images"
payload = {
"asset_field_types": ["MARKETING_IMAGE", "SQUARE_MARKETING_IMAGE"],
"final_url": "https://example.com/spring"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
asset_field_types: ['MARKETING_IMAGE', 'SQUARE_MARKETING_IMAGE'],
final_url: 'https://example.com/spring'
})
};
fetch('https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'asset_field_types' => [
'MARKETING_IMAGE',
'SQUARE_MARKETING_IMAGE'
],
'final_url' => 'https://example.com/spring'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images"
payload := strings.NewReader("{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-images")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"asset_field_types\": [\n \"MARKETING_IMAGE\",\n \"SQUARE_MARKETING_IMAGE\"\n ],\n \"final_url\": \"https://example.com/spring\"\n}"
response = http.request(request)
puts response.read_body{
"session_id": "9c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
"assets": [],
"background_pending": true,
"background_count": 3,
"in_flight": true
}Authorizations
Personal access token, sent as Authorization: Bearer <token>. Each operation lists the permission it needs: read_only or full_access. A full-access token can call every operation. A read-only token can call only the operations that list read_only; anything else returns 403 read_only_credential_route_not_allowed.
Scopes
Path Parameters
Body
Request shape for POST /assets/generate-images.
Image-XOR: exactly one of final_url, freeform_prompt, or (PR4)
source: "product_recontext" must be supplied — validated at the
route boundary. source discriminator keeps the future
product-recontext branch backward-compatible without a breaking
schema change.
Which picture shapes to generate, from MARKETING_IMAGE, SQUARE_MARKETING_IMAGE, PORTRAIT_MARKETING_IMAGE or TALL_PORTRAIT_MARKETING_IMAGE. Send between one and four entries. Each shape costs one request against the picture rate limit, so asking for fewer gets you more calls a minute. A text field type here is rejected with a 422.
1 - 4 elementsHEADLINE, LONG_HEADLINE, DESCRIPTION, MARKETING_IMAGE, SQUARE_MARKETING_IMAGE, PORTRAIT_MARKETING_IMAGE, TALL_PORTRAIT_MARKETING_IMAGE ["MARKETING_IMAGE", "SQUARE_MARKETING_IMAGE"]
The session_id of an earlier generation to add these pictures to. List Google Ads generated assets returns the combined set for an hour. Omit it to start a new generation.
"3f9c2a7b8d1e4f6a9b0c1d2e3f4a5b6c"
Skip engines that draw several candidates per shape, and charge one request per shape against the picture rate limit. Use it to replace a single picture; a shape can still return more than one picture, so use the first. When false, some engines draw several candidates per shape and charge for each.
true
Response
The pictures that were generated.
The pictures one image generation produced.
ID of this generation. Pass it as session_id to List Google Ads generated assets to collect the pictures that are still coming.
"9c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f"
Was this page helpful?