{
  "openapi": "3.1.0",
  "info": {
    "title": "AutoManus Public API",
    "description": "Create AI sales agents programmatically for any business. Integrates with AI coding assistants like Cursor, Claude Code, and ChatGPT.",
    "version": "1.0.0",
    "contact": {
      "email": "support@automanus.io",
      "url": "https://automanus.io"
    }
  },
  "servers": [
    {
      "url": "https://automanus.io/api/v1/public",
      "description": "Production"
    }
  ],
  "paths": {
    "/agents": {
      "post": {
        "operationId": "createAgent",
        "summary": "Create AI Sales Agent",
        "description": "Create a new AI sales agent for a business. Provide a website URL for automatic research, or pass codebase context directly. New users receive a magic link to claim their agent.",
        "tags": ["Agents"],
        "security": [
          {},
          { "ApiKeyAuth": [] }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateAgentRequest"
              },
              "examples": {
                "website_mode": {
                  "summary": "Website URL mode",
                  "description": "Provide a website URL and we research automatically",
                  "value": {
                    "email": "founder@startup.com",
                    "company_name": "TechStartup",
                    "website_url": "https://techstartup.com",
                    "source": "cursor"
                  }
                },
                "codebase_mode": {
                  "summary": "Codebase context mode",
                  "description": "For apps not yet deployed, provide extracted content",
                  "value": {
                    "email": "dev@startup.com",
                    "company_name": "TechStartup",
                    "codebase_context": {
                      "company_description": "AI-powered platform for workflow automation",
                      "value_proposition": "10x your productivity with AI",
                      "products": [
                        {
                          "name": "Pro Plan",
                          "description": "Full access to all AI features",
                          "price": "$99/month"
                        }
                      ]
                    },
                    "source": "claude_code"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Agent created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateAgentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "examples": {
                  "missing_fields": {
                    "value": {
                      "success": false,
                      "error": "email and company_name are required"
                    }
                  },
                  "invalid_email": {
                    "value": {
                      "success": false,
                      "error": "Invalid email format"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Rate limit exceeded",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                },
                "example": {
                  "success": false,
                  "error": "Rate limit exceeded. Maximum 10 agents per day per email."
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key for authenticated users. Generate at https://automanus.io/dashboard/settings/api"
      }
    },
    "schemas": {
      "CreateAgentRequest": {
        "type": "object",
        "required": ["email", "company_name"],
        "properties": {
          "email": {
            "type": "string",
            "format": "email",
            "description": "User's email address. New users receive magic link to claim agent."
          },
          "company_name": {
            "type": "string",
            "description": "Business/company name for the agent"
          },
          "website_url": {
            "type": "string",
            "format": "uri",
            "description": "Website URL to research (Mode A). We scrape and analyze automatically."
          },
          "linkedin_url": {
            "type": "string",
            "format": "uri",
            "description": "LinkedIn company URL for enrichment"
          },
          "codebase_context": {
            "type": "object",
            "description": "Extracted content from codebase (Mode B)",
            "properties": {
              "landing_page_content": {
                "type": "string",
                "description": "Text content from landing/home page"
              },
              "readme_content": {
                "type": "string",
                "description": "Content from README.md"
              },
              "products": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "description": { "type": "string" },
                    "price": { "type": "string" },
                    "features": {
                      "type": "array",
                      "items": { "type": "string" }
                    }
                  }
                }
              },
              "pricing_tiers": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "name": { "type": "string" },
                    "price": { "type": "string" },
                    "features": {
                      "type": "array",
                      "items": { "type": "string" }
                    }
                  }
                }
              },
              "company_description": { "type": "string" },
              "value_proposition": { "type": "string" },
              "target_customers": { "type": "string" },
              "key_differentiators": {
                "type": "array",
                "items": { "type": "string" }
              },
              "contact_info": {
                "type": "object",
                "properties": {
                  "email": { "type": "string" },
                  "phone": { "type": "string" }
                }
              }
            }
          },
          "agent_name": {
            "type": "string",
            "description": "Custom agent name. Default: '{company} Assistant'"
          },
          "greeting_message": {
            "type": "string",
            "description": "Custom greeting message for the agent"
          },
          "industry": {
            "type": "string",
            "description": "Industry/vertical (e.g., 'SaaS', 'E-commerce', 'Legal')"
          },
          "deploy_channels": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": ["webchat", "whatsapp"]
            },
            "description": "Channels to deploy. Default: both"
          },
          "source": {
            "type": "string",
            "enum": ["cursor", "claude_code", "chatgpt", "lovable", "v0", "windsurf", "replit", "github_copilot", "mcp", "api", "other"],
            "description": "Source identifier for analytics"
          }
        }
      },
      "CreateAgentResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": true
          },
          "agent_id": {
            "type": "string",
            "format": "uuid",
            "description": "UUID of created agent"
          },
          "agent_name": {
            "type": "string",
            "description": "Display name of agent"
          },
          "company_name": {
            "type": "string"
          },
          "webchat_embed_code": {
            "type": "string",
            "description": "HTML script tag to embed webchat widget"
          },
          "webchat_widget_key": {
            "type": "string",
            "description": "Widget key for webchat"
          },
          "whatsapp_link": {
            "type": "string",
            "format": "uri",
            "description": "wa.me link to chat on WhatsApp"
          },
          "is_new_user": {
            "type": "boolean",
            "description": "True if email was not previously registered"
          },
          "claim_url": {
            "type": "string",
            "format": "uri",
            "description": "Magic link for new users to claim agent"
          },
          "dashboard_url": {
            "type": "string",
            "format": "uri",
            "description": "Link to agent dashboard"
          },
          "trial_info": {
            "type": "object",
            "properties": {
              "expires_in_days": {
                "type": "integer",
                "nullable": true,
                "description": "Days until trial expires. null = no expiry"
              },
              "message_limit": {
                "type": "integer",
                "description": "Number of free AI messages (credits)"
              }
            }
          },
          "knowledge_base_count": {
            "type": "integer",
            "description": "Number of knowledge base items created from research"
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "properties": {
          "success": {
            "type": "boolean",
            "example": false
          },
          "error": {
            "type": "string",
            "description": "Error message"
          }
        }
      }
    }
  },
  "tags": [
    {
      "name": "Agents",
      "description": "Create and manage AI sales agents"
    }
  ]
}
