Generate Google Ads image assets

<Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

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.

<Note>Only one generation of each kind runs per app at a time. Calling this while one is running returns a 200 carrying in_flight set to true, that run's session_id, and an empty assets. Poll the session_id you were given rather than retrying.</Note>

Each shape in asset_field_types costs one of 10 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 one call a minute in the worst case rather than two, and a single shape costs 1 or 2.

<Note>When Google refuses the page you pointed at, Base44 retries once on the app's own published URL, and that retry costs the same again. Pace requests against the doubled figure, not the single one, or a refusal-heavy app hits a 429 part-way through its own recovery.</Note>

<Note>Generating creative does not spend credits and is not billed. It is capped by rate limits instead, so a burst gets a 429 rather than a bill.</Note>

<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time. Send only the fields documented here. Other request fields are not supported and their behavior can change.</Warning>

post/api/apps/{app_id}/google-ads/assets/generate-images

Path parameters

app_idstring required

ID of the app whose Google Ads creative you want to generate or read.

ID of the app whose Google Ads creative you want to generate or read.

Request body

channel_typestring

Campaign type the pictures are for, one of PERFORMANCE_MAX, DEMAND_GEN, SEARCH or DISPLAY. It does not restrict the shapes you may ask for.

asset_field_typesstring[]

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.

final_urlstring

Page to base the pictures on. Send exactly one of this and freeform_prompt.

freeform_promptstring

What the pictures should show, in your own words, up to 1500 characters. Send exactly one of this and final_url.

Example request

{
  "channel_type": "PERFORMANCE_MAX",
  "asset_field_types": [
    "MARKETING_IMAGE",
    "SQUARE_MARKETING_IMAGE"
  ],
  "final_url": "https://example.com/spring",
  "freeform_prompt": "Warm studio shots of handmade oak dining tables"
}

Response

The pictures that were generated.

session_idstring required

ID of this generation. Pass it as session_id to List Google Ads generated assets to collect the pictures that are still coming.

background_pendingboolean nullable

Present and true when more pictures are still being generated under this session_id, including when assets came back empty because the first one took too long. Absent on a lock-miss response.

background_countinteger nullable

How many more pictures are still being generated. Absent on a lock-miss response.

in_flightboolean nullable

Present and true only when an image generation for this app was already running, in which case session_id is that run's and assets is empty. Poll the returned session_id rather than retrying. The field is absent on every other response.

Example response

{
  "session_id": "9c1d2e3f-4a5b-6c7d-8e9f-0a1b2c3d4e5f",
  "assets": [],
  "background_pending": true,
  "background_count": 3,
  "in_flight": true
}

Changes

No recorded changes to this endpoint across all 1 revision of this API.