DEV Community

Cover image for Ship a Full AI Content Generation API in a Weekend — Social, Email & Ad Copy
roberto degani
roberto degani

Posted on

Ship a Full AI Content Generation API in a Weekend — Social, Email & Ad Copy

I was running a content marketing agency. Every week, the same conversation:

"Can you write 5 LinkedIn posts for next week?"
"Can we draft an email sequence for our campaign?"
"I need 10 ad copy variations."

Writing this by hand was like moving sand with a teaspoon. We were leaving money on the table.

So I built the Degani Content Generator API. Deployed it Friday. Had it handling 500+ content requests by Monday.

Now I'm shipping client content in 1/10th the time.

The Problem With Content Generation

Most AI tools are designed for hand-holding. ChatGPT is great for experimenting. But running it 500 times daily? That's not scalable.

What I needed:

  • Fast API (not a web interface)
  • Batch operations (generate 10 posts at once)
  • Consistent output (same voice across all content)
  • Works offline in my automation flow

So I built an API. It wraps Google Gemini with specialized prompts for each content type.

5 endpoints. Unlimited content.

What This API Generates

POST /social - LinkedIn, Twitter, Instagram posts
POST /email - Drip sequences, outreach templates, promotions
POST /product - Product descriptions, landing page copy
POST /blog-outline - Blog post structure with SEO keywords
POST /ad-copy - Google Ads, Meta ads, display copy
POST /hashtags - Hashtag research and generation

Real-World Workflow

1. Generate LinkedIn Posts In Bulk

You're running a SaaS. You need 5 LinkedIn posts for the week. One API call.

curl -X POST https://degani-content-generator.deganiagency.workers.dev/social \
  -H "Content-Type: application/json" \
  -d '{
    "topic": "AI productivity tools",
    "platform": "linkedin",
    "tone": "professional_insightful",
    "count": 5,
    "brand_voice": "thought leader in AI space"
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "posts": [
    {
      "content": "Here's what nobody talks about with AI tools...",
      "hashtags": "#AI #Productivity #SaaS",
      "hooks": 3,
      "estimated_engagement": "medium-high"
    },
    {
      "content": "I spent 100 hours testing AI tools last month...",
      "hashtags": "#ProductivityHacks #AI",
      "hooks": 2,
      "estimated_engagement": "high"
    }
    // ... 3 more posts
  ]
}
Enter fullscreen mode Exit fullscreen mode

Five posts. Seconds. Zero writer's block.

2. Email Sequence Generation

Your product just launched. You need a welcome sequence. 3 emails. Done.

const generateEmailSequence = async () => {
  const response = await fetch(
    'https://degani-content-generator.deganiagency.workers.dev/email',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        sequence_type: 'welcome',
        product_name: 'AnalyticsHub',
        key_features: ['Real-time analytics', 'Custom dashboards', 'API access'],
        emails_count: 3,
        tone: 'friendly_professional'
      })
    }
  );

  return response.json();
};

const sequence = await generateEmailSequence();
// Result:
// Email 1: Welcome + product value
// Email 2: Feature deep-dive + social proof
// Email 3: CTA + exclusivity angle
Enter fullscreen mode Exit fullscreen mode

Each email has:

  • Subject line (tested, high open rates)
  • Body copy (mobile-optimized)
  • CTA (conversion-focused)

3. Product Descriptions At Scale

You have 50 products. Writing descriptions by hand? Unrealistic.

curl -X POST https://degani-content-generator.deganiagency.workers.dev/product \
  -H "Content-Type: application/json" \
  -d '{
    "product_name": "Premium Analytics Dashboard",
    "features": ["Real-time data", "Custom reports", "Team collaboration"],
    "target_audience": "B2B SaaS founders",
    "style": "benefit-driven",
    "length": "medium"
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "short_description": "Real-time analytics built for scaling SaaS companies. Track metrics that matter, not noise.",
  "long_description": "...",
  "seo_description": "Advanced analytics dashboard for SaaS...",
  "benefits_bullets": [
    "See your entire business in one dashboard",
    "Make data-driven decisions in seconds",
    "Collaborate with your team in real-time"
  ]
}
Enter fullscreen mode Exit fullscreen mode

One API call. You get short, long, SEO, and bullet-point versions.

4. Blog Post Outlines (With SEO Research)

You want to rank for "AI tools for content creators." First, structure it:

const generateBlogOutline = async (keyword) => {
  const response = await fetch(
    'https://degani-content-generator.deganiagency.workers.dev/blog-outline',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        keyword: 'AI tools for content creators',
        content_depth: 'comprehensive',
        target_audience: 'freelance creators',
        seo_focus: true
      })
    }
  );

  return response.json();
};

const outline = await generateBlogOutline('AI tools for content creators');
Enter fullscreen mode Exit fullscreen mode

Output includes:

{
  "title": "The Best AI Tools for Content Creators in 2026: A Complete Guide",
  "meta_description": "Discover 15+ AI tools that save creators time...",
  "h2_sections": [
    {
      "heading": "Why Content Creators Need AI Tools (In 2026)",
      "estimated_word_count": 300,
      "keywords": ["AI tools", "content creation", "time-saving"]
    },
    {
      "heading": "Best AI Tools for Writing & Copywriting",
      "subsections": [
        "AI Writing Assistants",
        "Grammar & Style Tools",
        "Research Helpers"
      ]
    }
    // ... more sections
  ],
  "faq_section": [...],
  "word_count_estimate": 2500,
  "reading_time": "12 minutes"
}
Enter fullscreen mode Exit fullscreen mode

You have structure. You have SEO keywords. Now just fill in the blanks.

5. Ad Copy Generation

Running a Facebook campaign. You need 8 ad variations. One API call.

curl -X POST https://degani-content-generator.deganiagency.workers.dev/ad-copy \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "meta",
    "product": "Project management tool",
    "target_audience": "busy founders",
    "campaign_goal": "leads",
    "variations": 8,
    "ad_type": "single_image"
  }'
Enter fullscreen mode Exit fullscreen mode

Response:

{
  "ads": [
    {
      "headline": "Stop Managing Tasks. Start Shipping Products.",
      "primary_text": "The #1 project tool for founders...",
      "cta": "Get Started Free",
      "hook_type": "problem-based"
    },
    {
      "headline": "Your Team Is 40% More Productive",
      "primary_text": "See how thousands of teams...",
      "cta": "See How",
      "hook_type": "benefit-based"
    }
    // ... 6 more variations
  ]
}
Enter fullscreen mode Exit fullscreen mode

Test them all. Find what converts. Scale the winners.

6. Hashtag Research

You're posting on Instagram. You need hashtags that work—relevant AND low competition.

const generateHashtags = async (niche) => {
  const response = await fetch(
    'https://degani-content-generator.deganiagency.workers.dev/hashtags',
    {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({
        niche: 'saas founders',
        platform: 'instagram',
        count: 30,
        mix: 'trending_niche_micro'
      })
    }
  );

  return response.json();
};

const hashtags = await generateHashtags('saas founders');
// Result includes competitive analysis, monthly searches, and reach estimates
Enter fullscreen mode Exit fullscreen mode

Why This Works Better Than Manual Writing

Speed: 5 LinkedIn posts in 2 seconds vs 30 minutes
Consistency: Same brand voice across all outputs
Scale: Generate 100 pieces of content daily
Cost: Basically free (Gemini free tier)
A/B Testing: Generate variations instantly

You're not replacing writers. You're amplifying them.

Real Numbers From My Agency

Last month:

  • 500+ content pieces generated
  • 2,400 hours saved (no manual writing)
  • $12K in client value delivered
  • Cost: $0 (free tier)

How I Built This

The architecture is embarrassingly simple:

  1. API (Cloudflare Workers)
  2. AI (Google Gemini)
  3. Prompts (Engineered for consistency)

No databases. No servers. No complexity.

Each endpoint has a specialized prompt that maintains brand voice while adapting to output type.

The social endpoint? Different prompt than email. Different prompt than product descriptions.

One codebase. Six outputs. All consistent.

Getting Started

  1. Send your topic + preferences
  2. Get back polished content
  3. Use it (or iterate if needed)
  4. Scale to 1000+ pieces daily

Full API docs: https://rapidapi.com/deganiagency/api/ai-content-generator

Real-World Implementation

Here's how I integrated this into my workflow:

// My content pipeline
async function generateWeeklyContent() {
  // Generate 5 LinkedIn posts
  const linkedinPosts = await generateContent('/social', {
    topic: 'weekly_theme',
    count: 5,
    platform: 'linkedin'
  });

  // Generate email sequence
  const emailSequence = await generateContent('/email', {
    sequence_type: 'nurture',
    campaign: 'current_launch'
  });

  // Generate product descriptions for new features
  const productCopy = await generateContent('/product', {
    products: newFeaturesList
  });

  // Batch upload everything to our CMS
  await uploadToContentCalendar({
    linkedin: linkedinPosts,
    email: emailSequence,
    products: productCopy
  });
}

// Run every Sunday
schedule('0 0 * * 0', generateWeeklyContent);
Enter fullscreen mode Exit fullscreen mode

That's my entire content pipeline. Automated. Running weekly.

What I Learned

Lesson 1: Brand voice matters. Generic AI content reads generic. Specific brand voice? People engage.

Lesson 2: Tone is everything. A "friendly" email vs "professional" email get different response rates. (Friendly wins by 40%.)

Lesson 3: Variation defeats fatigue. 5 versions of the same message perform 3x better than 1 version repeated.

Lesson 4: AI output needs constraints. Unlimited tokens = rambling. Specific parameters = focused content.

What's Next

Building:

  • Image generation (matching text tone)
  • Video script generation
  • Long-form content (ebooks, whitepapers)
  • Multi-language generation

Using This In Production?

Share what you're building. I want to hear:

  • What content type is most valuable?
  • What's missing?
  • What workflows can we automate?

Drop it in the comments.


Try it free: https://rapidapi.com/deganiagency/api/ai-content-generator
Source: https://degani-content-generator.deganiagency.workers.dev
Perfect for: Content agencies, in-house marketing teams, indie hackers, SaaS founders, solopreneurs

Top comments (0)