# Create a Google Ads Search campaign from the command line

> Create Google Ads Search campaigns from the command line or REST API with custom budgets, keywords, and copy, created paused for review.

**You can create a Google Ads Search campaign from the command line or REST API by submitting an ad change request to your project's social endpoint.** thelastapi gives you the `vibiz social campaigns create` CLI command and the `POST /v1/projects/:id/social/ads/changes` route to generate an entire campaign, ad group, budget, and ad creative in a single command. Every campaign is created paused by default so you can inspect targeting, copy, and keywords before any money is spent.

Managing ads through the same tooling you use for social publishing and phone numbers keeps your operations unified. If you automate your infrastructure with CI or AI agents, you can generate and manage ad campaigns without touching Google's browser console.

## Connect your Google Ads account

Before creating campaigns, connect your Google Ads account to your project. Run the `connect` command from the CLI:

```bash
vibiz social connect google --ads
```

This command outputs an authorization link valid for one hour. When you open the link in your browser, you sign in to thelastapi console, verify which project the ad account is joining, and click **Continue**. That redirects you to Google to log in and grant permissions. Only an owner of the project can complete this connection.

For local testing, automated scripts, or CI pipelines, pass `--dev` to create a simulated test ad account instantly without browser interaction:

```bash
vibiz social connect google --ads --dev
```

Once connected, list your available accounts to get their identifiers:

```bash
vibiz social accounts
```

You will see an account ID formatted like `sacc_123` alongside the numeric Google ad account ID. You need both to direct your campaign creation requests. You can also view connected accounts in the console's [Social](https://thelastapi.dev/docs/social) section.

## Create a Search campaign from the terminal

To create a Search campaign directly from your terminal, run `vibiz social campaigns create` with the `--type search` flag.

Here is an example for an online bakery:

```bash
vibiz social campaigns create \
  --type search \
  --name "Sourdough - Search" \
  --budget 2000 \
  --final-url "https://bakery.example/order" \
  --headline "Fresh Sourdough Daily" \
  --headline "Order Bread Online" \
  --headline "Local Bakery Near You" \
  --desc "Baked every morning with local flour." \
  --desc "Order by 10am, pick up today." \
  --keyword "sourdough bakery" \
  --keyword "fresh bread near me:phrase" \
  --keyword "buy sourdough online:exact" \
  --country US \
  --language en \
  --bidding maximize_clicks \
  --max-cpc 150
```

Notice how parameters are structured:
- `--budget 2000` sets the daily budget in the minor units of your ad account currency. In USD, `2000` is $20.00 per day.
- Multiple `--headline` and `--desc` flags supply the text assets. Google rotates these dynamically for searchers.
- Keyword match types can be passed inline: plain text defaults to broad match, `:phrase` sets phrase match, and `:exact` sets exact match.
- `--bidding maximize_clicks` pairs with `--max-cpc 150`, which caps each click at $1.50 (150 cents).

If you have a complex campaign configuration, you can put the arguments into a JSON file and pass `--file campaign.json`.

## Create a Search campaign with the REST API

You can also create campaigns using plain HTTP requests from any backend service or automation tool. Send a `POST` request to `/v1/projects/:id/social/ads/changes` with the `create_campaign` payload:

```bash
curl -X POST "https://thelastapi.dev/v1/projects/prj_123/social/ads/changes?env=production" \
  -H "Authorization: Bearer $VIBIZ_API_KEY" \
  -H "content-type: application/json" \
  -d '{
    "kind": "create_campaign",
    "account_id": "sacc_123",
    "ad_account_id": "1234567890",
    "campaign_type": "search",
    "name": "Sourdough - search",
    "daily_budget_cents": 2000,
    "final_url": "https://bakery.example/order",
    "headlines": [
      "Fresh Sourdough Daily",
      "Order Bread Online",
      "Local Bakery Near You"
    ],
    "descriptions": [
      "Baked every morning with local flour.",
      "Order by 10am, pick up today."
    ],
    "keywords": [
      "sourdough bakery",
      {"text": "fresh bread near me", "match_type": "phrase"},
      {"text": "buy sourdough online", "match_type": "exact"}
    ],
    "countries": ["US"],
    "languages": ["en"],
    "bidding": "maximize_clicks",
    "max_cpc_cents": 150,
    "confirm": true
  }'
```

Every parameter passes through input validation before reaching Google. If a headline exceeds character limits or an URL is malformed, the API responds with a `400` error detailing the exact path of every failing field (for example, `headlines.2`). You can fix all reported issues in one revision.

## Campaign rules, asset limits, and bidding

Search campaigns require specific asset counts and character lengths to ensure ads display properly on Google's search results page.

| Field | Requirement | Character Limit |
|---|---|---|
| Campaign Name | Required | Single line |
| Final URL | Required | Valid `https` URL |
| Headlines | 3 to 15 entries | 30 characters each |
| Descriptions | 2 to 4 entries | 90 characters each |
| Keywords | 1 to 1,000 entries | 80 characters each |
| Countries | Required list | ISO country codes (e.g., `US`, `CA`) |
| Languages | Optional list | Language codes (e.g., `en`, `es`) |

Google mixes and matches your headlines and descriptions for each query. Every headline must make sense when presented alone or paired with any other headline.

For bidding, search campaigns support two strategies:
1. `maximize_clicks`: Recommended for new accounts or campaigns with no historical data. You should provide `max_cpc_cents` to prevent expensive outlier clicks. A good rule of thumb is keeping your maximum CPC under a tenth of your daily budget so each day buys at least ten visits.
2. `maximize_conversions`: Optimizes for actions rather than traffic. This requires conversion tracking to already be configured inside your Google Ads account. You can optionally pass `target_cpa_cents` to guide the bidding target.

For Display or Performance Max campaigns instead of Search, review the [Social: posting, approvals and ads](https://thelastapi.dev/docs/guides/social) guide for details on required image assets.

## Why campaigns start paused

Every new campaign created through thelastapi is created in a **paused** state. 

This behavior protects your credit cards and ad budget. Because automated scripts and AI agents can construct campaigns quickly, an unreviewed campaign should not start charging your account instantly. When a campaign is submitted by an agent or a key with Limited access, it returns with `status: pending_approval` and waits for an owner to approve it in the console under **Social ▸ Needs you**.

When you are ready to start serving ads, resume the campaign using the CLI:

```bash
vibiz social campaigns           # list campaigns to get the campaign ID
vibiz social resume camp_123     # starts ad delivery
```

You can also adjust the daily spend rate whenever performance data warrants changes:

```bash
vibiz social budget camp_123 --budget 3500
vibiz social pause camp_123
```

If you specifically want a campaign to start serving impressions the moment it is confirmed, pass the `--active` flag during creation or set `start: "active"` in the API request.

## Pricing and spend structure

The cost structure for advertising through thelastapi is simple:

1. **Ad change requests**: thelastapi tracks the `social.ads_change` event on your usage dashboard. This costs **$0 today**.
2. **Ad spend**: Google bills your underlying advertising spend directly to the payment method attached to your Google Ads account. thelastapi never marks up ad spend or processes ad charges on our billing system.
3. **Sandbox testing**: Actions performed with the `--dev` flag or against `env=development` are completely free and record zero usage.

You can combine ad management with other capabilities across your project. For example, you can [post to Instagram, TikTok and LinkedIn from one API](https://thelastapi.dev/blog/post-instagram-tiktok-linkedin-one-api) to handle your organic presence, [give an AI agent a phone number: texts, calls and a voice agent](https://thelastapi.dev/blog/give-ai-agent-phone-number) to field phone inquiries from your landing page, or [deploy from CI with one command and one key](https://thelastapi.dev/blog/deploy-from-ci) to publish site updates alongside your marketing pushes.

To see all supported options for Search, Display, and Performance Max ad creation, visit the [Social docs](https://thelastapi.dev/docs/social).

## Frequently asked questions

### Does thelastapi charge a percentage of my Google Ads spend?

No. thelastapi charges $0 today for the `social.ads_change` API call, and Google bills your ad spend directly to the credit card linked to your Google Ads account.

### Can I edit ad text or targeting after the campaign is created?

thelastapi supports pausing, resuming, and changing the daily budget of existing campaigns, but updating ad copy, keywords, or audience targeting after creation is not currently offered.

### Why did my campaign get created with a pending_approval status?

Any campaign created by an AI agent or a key with Limited access is held in `pending_approval` until a project owner reviews and approves it in the console.

### What units are used for the daily budget and maximum CPC?

Budgets and bids are specified in the minor units of your ad account currency, meaning 2000 equals $20.00 for a USD account or ¥2000 for a JPY account.

---

Published 2026-11-15 · https://thelastapi.dev/blog/google-ads-search-campaign-api
