Generate Google Ads text assets

Changed on

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

Writes ad copy for the app and returns it as previews.

Nothing reaches Google Ads here. Each line comes back with a session_asset_id you pass to Accept a generated Google Ads asset to put it on a live campaign. Use Generate Google Ads assets instead when you want copy and pictures in one call.

Pick the lines you want with asset_field_types. SEARCH campaigns do not take LONG_HEADLINE, so Google rejects that combination.

Grounding is flexible here, unlike image generation. You may send final_url and freeform_prompt together, and sending neither grounds the copy in the app's own home page.

The copy is written in language_code when you send it, then in the campaign's language when you send campaign_id, and otherwise in the language of the app's own site. The response reports which one in language.

<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>

This endpoint costs 2 of 20 copy requests a minute per app, shared with the other Google Ads endpoints that write copy, and up to 4 when the retry below happens.

<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-text

Request

  • Base URL
    https://app.base44.com
  • URL
    https://app.base44.com/api/apps/{app_id}/google-ads/assets/generate-text
  • Auth
    HTTP bearer

Path parameters

app_idstring required

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

Request body

channel_typestring

Campaign type the copy is for, one of PERFORMANCE_MAX, DEMAND_GEN, SEARCH or DISPLAY.

asset_field_typesstring[]

Which kinds of line to write, from HEADLINE, LONG_HEADLINE or DESCRIPTION. Send between one and three entries. An image field type here is rejected with a 422.

final_urlstring

Page to base the copy on. Unlike image generation you may send this together with freeform_prompt, and sending neither grounds the copy in the app's own home page.

freeform_promptstring

What the copy should say, in your own words, up to 1500 characters.

keywordsstring[]

Keywords to work into the copy. Send between 1 and 15 of them, and none of them blank. Omit the field entirely rather than sending an empty list.

language_codestring

Two-letter code of the language to write the copy in, for example de. A regional tag such as pt-BR is reduced to pt. Omit it to use the campaign's language when you send campaign_id, and otherwise the language of the app's own site. A language Google Ads doesn't support returns a 400.

campaign_idstring

The id of a campaign from List campaigns whose language to write in when you don't send language_code. Nothing is attached to the campaign.

single_assetboolean

Set to true for a quick replacement of one line. The copy comes back in seconds and counts as one copy request instead of two, at somewhat lower quality. Several lines can still come back, so use the first.

session_idstring

The session_id of an earlier generation to add these previews to. List Google Ads generated assets returns the combined set for an hour. Omit it to start a new generation.

Example request

{
  "channel_type": "PERFORMANCE_MAX",
  "asset_field_types": [
    "HEADLINE",
    "DESCRIPTION"
  ],
  "final_url": "https://example.com/spring",
  "freeform_prompt": "Lead with free delivery across Germany",
  "keywords": [
    "oak furniture",
    "handmade table"
  ],
  "language_code": "de",
  "campaign_id": "6886b8d390dc7e2f4a2c91b3",
  "single_asset": true,
  "session_id": "3f9c2a7b8d1e4f6a9b0c1d2e3f4a5b6c"
}

Response

The copy that was generated.

session_idstring required

ID of this generation. Pass it as session_id to List Google Ads generated assets, or to Accept a generated Google Ads asset with one of the returned session_asset_id values.

languagestring nullable

Language the copy was written in, as a lowercase two-letter code: language_code when you sent it, then the campaign's language when you sent campaign_id, and otherwise the language of the app's own site. The field is absent on a lock-miss response unless you sent language_code or campaign_id.

in_flightboolean nullable

Present and true only when a text 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": [],
  "language": "de",
  "in_flight": true
}

Changes

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the new optional request property

    • info

      added the non-success response with the status

    • info

      the endpoint scheme security PersonalAccessTokenAuth was added to the API