# Complete API Endpoint Test Guide
## Git Command (Single Command)
```bash
cd garbage/linkedin-lead-mcp && git add -A && git commit -m "Production-ready campaign automation system" && git push origin master
```
## Base Configuration
```bash
export BASE_URL="https://linkedin-mcp-mocha.vercel.app"
export API_KEY="b01a98cddade43cac435ef18e6bf0ffe9937dd8fd2da7910b2b9c4b11284d471"
export CDP_URL="http://localhost:9222"
export LI_AT_COOKIE="AQEDAUiUBbYE2sYaAAABmoIQvNMAAAGbtcnXplYAKod7E5OFRQgQA9uOWhap0xQd8EPjqu_OxKnXH8moZxIkj9lIj8z0FdTE60KU12vsiuvFaO2s9jGjL1wRvRJQNUGOgENukqFaNb7kbTx88B5EJ9Da"
```
## AI Provider Configuration
### Option 1: OpenAI (Recommended - Simpler Setup)
Set in Vercel Environment Variables:
```bash
AI_PROVIDER=openai
OPENAI_API_KEY=sk-...
OPENAI_MODEL_ID=gpt-4o # Optional, defaults to gpt-4o
```
### Option 2: Vertex AI (Default)
Set in Vercel Environment Variables:
```bash
AI_PROVIDER=vertex # Optional, defaults to vertex
GOOGLE_APPLICATION_CREDENTIALS_JSON={...}
GCP_PROJECT_ID=amgn-app
GCP_LOCATION=global
ANTHROPIC_MODEL_ID=claude-opus-4-5
```
**See `OPENAI_SETUP.md` for detailed OpenAI setup instructions.**
---
## 1. Product Analysis (Deep Analysis)
```bash
curl -X POST "$BASE_URL/api/products/analyze" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"name\": \"AmroPilot\",
\"website_url\": \"https://amropilot.com\",
\"description\": \"AmroPilot is an AI-powered content creation platform that generates human-like text. It helps content creators, marketers, and SEO professionals create engaging articles that rank, convert, and dominate search results. The platform uses advanced AI agents that understand search intent and optimize content for maximum visibility.\",
\"value_proposition\": \"Transform your content strategy with AI that understands search intent, creates engaging articles, and optimizes for maximum visibility. Generate content that bypasses AI detection and ranks on Google. No more guessing game—just intelligent content that works.\",
\"target_audience\": \"Content creators, SEO professionals, digital marketers, content marketing agencies, bloggers, online businesses, e-commerce stores, SaaS companies, marketing teams\"
}" | python -m json.tool
```
---
## 2. Create Product (Manual)
```bash
curl -X POST "$BASE_URL/api/products" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"name\": \"My Product\",
\"website_url\": \"https://example.com\",
\"description\": \"Product description\",
\"value_proposition\": \"Value prop\",
\"target_audience\": \"Target audience\"
}" | python -m json.tool
```
---
## 3. Get All Products
```bash
curl -X GET "$BASE_URL/api/products?api_key=$API_KEY" | python -m json.tool
```
---
## 4. Generate ICP (From Product Analysis)
**Option 1: Using product_id (automatically fetches analysis from database)**
```bash
curl -X POST "$BASE_URL/api/icps/generate" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"product_id\": \"YOUR_PRODUCT_ID\"
}" | python -m json.tool
```
**Option 2: Passing product_analysis directly**
```bash
curl -X POST "$BASE_URL/api/icps/generate" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"product_id\": \"YOUR_PRODUCT_ID\",
\"product_analysis\": {
\"category\": \"SaaS\",
\"target_market\": \"B2B Tech Companies\"
}
}" | python -m json.tool
```
---
## 5. Create ICP (Manual)
```bash
curl -X POST "$BASE_URL/api/icps" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"product_id\": \"YOUR_PRODUCT_ID\",
\"name\": \"AI Startup CEOs Australia\",
\"description\": \"CEOs and Founders of AI startups in Australia\",
\"search_criteria\": {
\"keywords\": \"AI Startup CEO OR Founder OR CTO\",
\"locations\": [\"Australia\"],
\"industries\": [\"Technology\"],
\"job_titles\": [\"CEO\", \"Founder\", \"CTO\"]
},
\"target_characteristics\": {
\"company_stage\": [\"Seed\", \"Series A\"],
\"employee_count\": \"1-50\"
}
}" | python -m json.tool
```
---
## 6. Get All ICPs
```bash
curl -X GET "$BASE_URL/api/icps?api_key=$API_KEY" | python -m json.tool
```
---
## 7. Connect Browser (Required for LinkedIn)
**Option 1: Using Browserless.io (Cloud - Recommended)**
```bash
# Set your Browserless token
export BROWSERLESS_TOKEN="2TlVPtiYh3BfMoJbcee5cf6f186896e84ca84853c35169a3b"
export CDP_URL="https://production-sfo.browserless.io/chrome?token=$BROWSERLESS_TOKEN"
# Connect to cloud browser
curl -X POST "$BASE_URL/api/browser/connect" \
-H "Content-Type: application/json" \
-d "{\"cdp_url\": \"$CDP_URL\"}" | python -m json.tool
```
**Option 2: Using Local Chrome**
```bash
# Local Chrome with remote debugging
export CDP_URL="http://localhost:9222"
curl -X POST "$BASE_URL/api/browser/connect" \
-H "Content-Type: application/json" \
-d "{\"cdp_url\": \"$CDP_URL\"}" | python -m json.tool
```
---
## 8. Setup LinkedIn Session
```bash
curl -X POST "$BASE_URL/api/session/setup" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"li_at_cookie\": \"$LI_AT_COOKIE\"
}" | python -m json.tool
```
---
## 9. Discover Leads (Based on ICP)
```bash
curl -X POST "$BASE_URL/api/campaigns/discover" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"icp_id\": \"YOUR_ICP_ID\",
\"icp_search_criteria\": {
\"keywords\": \"AI Startup CEO OR Founder\",
\"locations\": [\"Australia\"]
},
\"limit\": 20
}" | python -m json.tool
```
---
## 10. Search Leads (Basic)
```bash
curl -X POST "$BASE_URL/api/leads/search" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"keywords\": \"CEO OR Founder OR CTO\",
\"location\": \"United States\",
\"limit\": 10
}" | python -m json.tool
```
---
## 11. Analyze Profile
```bash
curl -X POST "$BASE_URL/api/leads/analyze" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/someone\"
}" | python -m json.tool
```
---
## 12. Score Lead (AI)
```bash
curl -X POST "$BASE_URL/api/leads/score" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/someone\"
}" | python -m json.tool
```
---
## 13. Create Campaign
```bash
curl -X POST "$BASE_URL/api/campaigns" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"product_id\": \"YOUR_PRODUCT_ID\",
\"icp_id\": \"YOUR_ICP_ID\",
\"name\": \"AI Startup CEOs Australia Campaign\",
\"description\": \"Outreach campaign targeting AI startup CEOs in Australia\",
\"leads_selected\": [],
\"settings\": {
\"max_messages_per_day\": 20,
\"delay_between_messages\": 300
}
}" | python -m json.tool
```
---
## 14. Get Campaign
```bash
curl -X GET "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID?api_key=$API_KEY" | python -m json.tool
```
---
## 15. Get All Campaigns
```bash
curl -X GET "$BASE_URL/api/campaigns?api_key=$API_KEY" | python -m json.tool
```
---
## 16. Generate Dynamic Sequence
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/generate-sequence" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\"
}" | python -m json.tool
```
---
## 17. Select Leads for Campaign
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/leads/select" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"lead_ids\": [\"LEAD_ID_1\", \"LEAD_ID_2\"],
\"profile_urls\": [\"https://www.linkedin.com/in/lead1\", \"https://www.linkedin.com/in/lead2\"]
}" | python -m json.tool
```
---
## 18. Approve Campaign
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/approve" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\"
}" | python -m json.tool
```
---
## 19. Start Campaign (Automated Processing Begins)
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/start" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\"
}" | python -m json.tool
```
---
## 20. Process Campaign Messages (Manual Trigger)
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/process" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\"
}" | python -m json.tool
```
---
## 21. Pause Campaign
```bash
curl -X POST "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/pause" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\"
}" | python -m json.tool
```
---
## 22. Get Campaign Analytics
```bash
curl -X GET "$BASE_URL/api/campaigns/YOUR_CAMPAIGN_ID/analytics?api_key=$API_KEY" | python -m json.tool
```
---
## 23. Generate Personalized Message
```bash
curl -X POST "$BASE_URL/api/messages/generate" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/someone\",
\"value_proposition\": \"We help tech companies scale with AI automation\",
\"message_type\": \"connection\"
}" | python -m json.tool
```
---
## 24. Send Message
```bash
curl -X POST "$BASE_URL/api/messages/send" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/someone\",
\"message\": \"Your personalized message here\",
\"is_connection_request\": true
}" | python -m json.tool
```
---
## 25. Get All Leads
```bash
curl -X GET "$BASE_URL/api/leads?api_key=$API_KEY" | python -m json.tool
```
---
## 26. Get Usage Stats
```bash
curl -X GET "$BASE_URL/api/usage?api_key=$API_KEY" | python -m json.tool
```
---
## 27. Create Test Lead (No Browser Required)
```bash
curl -X POST "$BASE_URL/api/test/lead" \
-H "Content-Type: application/json" \
-d "{
\"api_key\": \"$API_KEY\",
\"profile_url\": \"https://www.linkedin.com/in/test-ceo\",
\"name\": \"John Doe\",
\"headline\": \"CEO at Tech Startup\",
\"company\": \"Acme Technologies\",
\"title\": \"Chief Executive Officer\",
\"location\": \"San Francisco, CA\"
}" | python -m json.tool
```
---
## Quick Test Script
Run the complete workflow test:
```bash
cd garbage/linkedin-lead-mcp
chmod +x test-campaign-workflow.sh
export API_KEY="your-api-key"
export CDP_URL="http://localhost:9222"
export LI_AT_COOKIE="your-li-at-cookie"
./test-campaign-workflow.sh
```