{
  "service": "SocialPoster.pro Agent API",
  "version": "1.0",
  "base_url": "https://zqfnpnlzynhugeivtrka.supabase.co/functions/v1/agent-api",
  "docs_url": "https://socialposter.pro/agent-docs",
  "grok_bot_guide": "https://socialposter.pro/grok-bot",
  "llms_txt": "https://socialposter.pro/llms.txt",
  "auth": {
    "type": "bearer",
    "header": "Authorization",
    "format": "Bearer sp_live_<key>",
    "how_to_obtain": "User must log in at https://socialposter.pro/dashboard/account?tab=api-keys, create a key, and store it in a Grok Bot secret card or MCP Authorization header — never in chat."
  },
  "rate_limit": "120 requests per hour per key",
  "supported_agents": ["Grok Bot", "Hermes", "OpenClaw", "Claude MCP", "custom agents"],
  "grok_bot_setup": [
    "Ask the human to store the sp_live_ key in a secret card — never in chat.",
    "Read https://socialposter.pro/skills/grok-bot.md, https://socialposter.pro/pages/agent-docs.md, and https://socialposter.pro/pages/grok-bot.md.",
    "Prefer MCP at https://zqfnpnlzynhugeivtrka.supabase.co/functions/v1/mcp with Authorization: Bearer <key>.",
    "Own one named project. Draft, then wait for approval before socialposter_create_post."
  ],
  "clients": {
    "grok_bot": {
      "skill_url": "https://socialposter.pro/skills/grok-bot.md",
      "mcp_url": "https://zqfnpnlzynhugeivtrka.supabase.co/functions/v1/mcp",
      "auth": "Authorization: Bearer sp_live_..."
    }
  },
  "endpoints": [
    { "method": "GET", "path": "/me", "purpose": "Verify auth, read scopes, plan, profile" },
    { "method": "GET", "path": "/projects", "purpose": "List user's projects with full brand context (voice, audience, pillars, CTAs, hashtags, constraints)" },
    { "method": "GET", "path": "/projects/:id", "purpose": "Get one project + a ready-to-use generation_context object" },
    { "method": "GET", "path": "/projects/:id/generation-context", "purpose": "Get a system_prompt string + structured context — feed this to your model before generating a post" },
    { "method": "GET", "path": "/projects/:id/connections", "purpose": "List social platforms connected to a project" },
    { "method": "GET", "path": "/posts", "purpose": "List posts (filter: project_id, status, limit)" },
    { "method": "POST", "path": "/posts", "purpose": "Create or schedule a post. Optional: auto_image (bool), image_prompt (string), image_url (string), or inline markers in content like [image: ...] or /image ..." },
    { "method": "POST", "path": "/images", "purpose": "Generate a standalone AI image (returns a permanent https URL you can attach to a post). Body: { prompt? , post_content?, project_id? }" },
    { "method": "DELETE", "path": "/posts/:id", "purpose": "Cancel a scheduled post (cannot delete published)" }
  ],
  "project_context_fields": [
    "brand_voice { tone, do, dont }",
    "target_audience (string)",
    "primary_offer (string)",
    "primary_pain_points (string[])",
    "desired_outcomes (string[])",
    "content_pillars (string[], 3-6 themes)",
    "cta_rules { cta_types, do, dont }",
    "hashtags_policy { brand_hashtags, rules }",
    "constraints (string — banned topics, compliance)"
  ],
  "recommended_workflow": [
    "1. GET /me to confirm credentials work and read scopes",
    "2. GET /projects to discover available brands/accounts and read their context",
    "3. GET /projects/:id/generation-context to get a pre-built system_prompt",
    "4. GET /projects/:id/connections to know which platforms are available",
    "5. Generate content using the system_prompt + per-platform constraints",
    "6. POST /posts with project_id, content, platforms[], optional scheduled_at (ISO 8601 UTC) and image_url",
    "7. Optionally GET /posts to monitor publish status"
  ]
}
