AI Agent Integration

PageGun is designed for AI agents to create and manage websites autonomously. Every feature is accessible via REST API with structured JSON — the format AI agents work best with.

Why PageGun for AI Agents

  • Structured input/output — Pages are JSON configs, not WYSIWYG. AI agents can generate valid page configs natively.
  • Full API coverage — Create, update, publish, and manage pages without ever touching a UI.
  • Semantic sections — Section types like hero, features, faq map directly to content concepts AI understands.
  • Predictable responses — Consistent JSON responses make error handling straightforward.

Quick Start for Agents

1. Set Up Authentication

export PAGEGUN_API_KEY="pgk_live_your_key"

2. Discover Projects

curl -s "https://api.pagegun.com/projects" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" | jq '.data[].{id, name}'

3. Create a Page

curl -X POST "https://api.pagegun.com/pages" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "page_name": "AI Generated Landing Page", "slug": "ai-landing", "subroute": "pages", "type": "page", "project_id": "PROJECT_ID", "config": { "sections": [ { "type": "hero", "heading": "Built by AI, Loved by Humans", "description": "This page was created entirely by an AI agent.", "ctaText": "Learn More", "ctaHref": "/about" }, { "type": "features", "heading": "Why It Works", "features": [ { "title": "Fast", "description": "Pages created in seconds.", "icon": "Zap" }, { "title": "Consistent", "description": "Every page follows best practices.", "icon": "CheckCircle" }, { "title": "Scalable", "description": "Create thousands of pages programmatically.", "icon": "TrendingUp" } ] } ] } }'

4. Publish

curl -X POST "https://api.pagegun.com/pages/PAGE_ID/publish" \ -H "Authorization: Bearer $PAGEGUN_API_KEY"

What AI Agents Can Do

TaskAPI CallsExample
Create a landing pagePOST /pagesPOST /pages/:id/publishGenerate pages from product descriptions
Manage a blogPOST /pages (type: article)Auto-publish SEO articles on a schedule
Build documentationPOST /pages (type: docs)Generate docs from code comments
Run a directoryPOST /pages (type: item)Curate tool/resource listings
Update contentPUT /pages/:idPOST /pages/:id/publishRefresh outdated content
A/B test pagesCreate variants, publish/unpublishTest different headlines or layouts

Idempotent Operations

Agents running on loops should avoid creating duplicates:

# Check if page exists before creating EXISTING=$(curl -s "https://api.pagegun.com/pages?project_id=$PROJECT_ID" \ -H "Authorization: Bearer $PAGEGUN_API_KEY" \ | jq -r ".data[] | select(.slug == \"$SLUG\") | .id") if [ -n "$EXISTING" ]; then # Update curl -X PUT "https://api.pagegun.com/pages/$EXISTING" ... else # Create curl -X POST "https://api.pagegun.com/pages" ... fi

Building an Agent Skill

For agents that use skill-based architectures (like OpenClaw), you can create a PageGun skill:

name: pagegun description: Create and manage pages via PageGun API tools: [exec, web_fetch]

Full Skill Template →

Best Practices

  1. Store API key securely — Never hardcode in prompts or skill files
  2. Discover before creating — Always check existing pages to avoid duplicates
  3. Respect rate limits — 100 req/min; add sleep 0.7 between batch operations
  4. Validate before publishing — Check that required fields exist
  5. Use meaningful slugs — AI-generated slugs should be readable and SEO-friendly

Full Best Practices Guide →

© 2026 PageGun. All rights reserved.