Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.mavera.io/llms.txt

Use this file to discover all available pages before exploring further.

Scenario

You need blog content that targets real search demand, not guesswork. You use Google Ads’ KeywordPlanIdeaService to discover keyword opportunities with volume and competition data, then feed the top keywords into Mavera’s Generate endpoint to produce full SEO blog post drafts. The result is a content pipeline where every article is backed by search data.

Architecture

Code

import os, requests
from google.ads.googleads.client import GoogleAdsClient

MV = os.environ["MAVERA_API_KEY"]
CUSTOMER_ID = os.environ["GOOGLE_ADS_CUSTOMER_ID"]
MB = "https://app.mavera.io/api/v1"
MH = {"Authorization": f"Bearer {MV}", "Content-Type": "application/json"}

client = GoogleAdsClient.load_from_env()
kw_service = client.get_service("KeywordPlanIdeaService")

request = client.get_type("GenerateKeywordIdeasRequest")
request.customer_id = CUSTOMER_ID
request.language = "languageConstants/1000"  # English
request.geo_target_constants = ["geoTargetConstants/2840"]  # US
request.keyword_plan_network = client.enums.KeywordPlanNetworkEnum.GOOGLE_SEARCH
request.keyword_seed.keywords.extend([
    "marketing automation", "content marketing software", "AI marketing tools"
])

ideas = kw_service.generate_keyword_ideas(request=request)

keywords = []
for idea in ideas:
    m = idea.keyword_idea_metrics
    if m.avg_monthly_searches and m.avg_monthly_searches > 100:
        keywords.append({
            "keyword": idea.text,
            "volume": m.avg_monthly_searches,
            "competition": idea.keyword_idea_metrics.competition.name,
            "low_bid": m.low_top_of_page_bid_micros / 1_000_000 if m.low_top_of_page_bid_micros else 0,
            "high_bid": m.high_top_of_page_bid_micros / 1_000_000 if m.high_top_of_page_bid_micros else 0,
        })

keywords.sort(key=lambda k: k["volume"], reverse=True)
top_kw = keywords[:15]

print(f"Found {len(keywords)} keywords, generating content for top {len(top_kw)}")

for kw in top_kw[:5]:
    gen = requests.post(f"{MB}/generations", headers=MH, json={
        "prompt": (
            f"Write an SEO-optimized blog post outline and 300-word introduction for the keyword: \"{kw['keyword']}\". "
            f"Monthly search volume: {kw['volume']}. Competition: {kw['competition']}. "
            f"Target audience: B2B marketing professionals. "
            f"Include: H1, meta description, 5+ H2 subheadings, introduction paragraph. "
            f"Naturally incorporate the primary keyword and 2-3 related long-tail variations."
        ),
    }).json()

    print(f"\n{'='*50}")
    print(f"Keyword: {kw['keyword']} | Vol: {kw['volume']} | Comp: {kw['competition']}")
    print(f"Bid range: ${kw['low_bid']:.2f}–${kw['high_bid']:.2f}")
    print(f"{'='*50}")
    print(gen.get("output", gen.get("content", ""))[:600])

Example Output

Found 142 keywords, generating for top 5

==================================================
Keyword: marketing automation software | Vol: 14800 | Comp: HIGH
Bid: $8.50–$24.00
==================================================
# H1: Marketing Automation Software: The 2026 Buyer's Guide

Meta: Compare the top marketing automation platforms by features, pricing,
and fit. Data-driven guide for B2B teams.

## H2 Outline
1. What Marketing Automation Software Actually Does
2. 7 Features That Separate Good Platforms from Great Ones
3. Marketing Automation Pricing: What to Expect in 2026
4. How to Evaluate Platforms for Your Team Size
5. Implementation Timeline and Common Pitfalls
6. Our Testing Framework: How We Ranked 12 Platforms

## Introduction (300 words)
Marketing automation software promises to do more with less — but the
category has 200+ vendors, and choosing wrong costs 6 months of migration...

Error Handling

You must provide at least one of keyword_seed, url_seed, or site_seed. An empty request returns INVALID_ARGUMENT.
Keywords with fewer than 10 monthly searches return null metrics. The code filters for > 100 to ensure statistical relevance.
Use languageConstants/1000 for English, geoTargetConstants/2840 for US. Find IDs via GET /v23/geoTargetConstants:suggest.

All Google Ads jobs

View all 7 Google Ads integration jobs

Generate API

Full reference for POST /api/v1/generations