unloopa-api

ClawSkills 作者 unloopa

Make your agent sell websites to local businesses on autopilot. Finds leads from Google Maps, builds a custom AI website for each one, sends outreach emails, and can even call them. Use when the user wants to find leads, generate websites, send emails, or make voice calls.

安装 / 下载方式

TotalClaw CLI推荐
totalclaw install clawskills:clawskills~echris6-unloopa-api
cURL直接下载,无需登录
curl -fsSL https://skills.taituai.com/api/skills/clawskills%3Aclawskills~echris6-unloopa-api/file -o echris6-unloopa-api.md
# Unloopa API

You control the Unloopa platform through its REST API. All requests go to `https://dashboard.unloopa.com/api/v1/` with Bearer token authentication.

## Authentication

Every request needs the header:
```
Authorization: Bearer $UNLOOPA_API_KEY
```
The API key is set in the `UNLOOPA_API_KEY` environment variable. Keys start with `unlpa_live_`.

If the user hasn't configured their key yet, tell them:
1. Go to https://dashboard.unloopa.com/settings and click the "API" tab
2. Click "Create API Key" and copy the key (it's only shown once)
3. Configure it in your OpenClaw settings, or set the environment variable: `export UNLOOPA_API_KEY=unlpa_live_...`

If you get a 401 `unauthorized` error, the key is missing or invalid — ask the user to check their key.

## First Call: Always Start With GET /quota

**Before doing anything else**, call `GET /quota` to discover:
- What **plan** the user is on (starter or pro)
- Whether **voice** and **video** features are enabled
- How many **leads** and **credits** remain
- **Purchase links** if they need to upgrade or buy credits

This single call tells you everything about what the user can and can't do. Adapt your behavior based on the response:

| quota field | What it means |
|---|---|
| `voice_enabled: false` | Don't offer voice calling — they need Pro plan. Share `purchase_links.upgrade` |
| `video_enabled: false` | Don't offer video generation — they need Pro plan |
| `voice_credits: 0` | Can't make calls — share `purchase_links.voice_credits` |
| `websites.remaining: 0` | Can't generate leads — quota resets at `resets_at` |

## Error Format

All errors return:
```json
{ "error": { "code": "error_code", "message": "Human-readable message", "details": {} } }
```

Error codes: `unauthorized` (401), `invalid_input` (400), `not_found` (404), `plan_required` (403), `insufficient_credits` (402), `quota_exceeded` (429), `rate_limited` (429), `setup_required` (400), `limit_reached` (400), `invalid_state` (400), `internal_error` (500).

When you get `plan_required` (403), share the upgrade link from quota. When you get `insufficient_credits` (402), share the credit purchase links. When rate limited, check the `Retry-After` header (seconds).

## Plans

- **Starter** ($47/mo): 1,000 leads/month, email outreach, templates
- **Pro** ($97/mo): 5,000 leads/month, 200 videos/month, voice calling, AI agents, phone numbers

---

## Workflows

### 1. Full Lead Pipeline (any plan)
The `/command` endpoint runs the **entire pipeline automatically**: scrape leads → generate websites → enrich emails → send outreach. Just describe what you want.
```
1. GET  /quota                    → check websites.remaining > 0
2. POST /command                  → submit natural language command (full pipeline runs automatically)
3. GET  /jobs/{job_id}            → poll every 5-10s until status=completed
4. GET  /leads?job_id={job_id}    → view generated leads with websites, emails, etc.
```

### 2. Email Outreach (any plan)
```
1. GET  /outreach/status          → verify configured=true, remaining_today > 0
2. GET  /leads?has_email=true     → find leads with emails
3. GET  /outreach/templates       → pick a template
4. POST /outreach/send            → queue emails
```
If `configured=false`, tell the user to connect an email account at the `setup_url` in the response.

### 3. Voice Calling (Pro plan only)
**Skip this workflow entirely if `voice_enabled=false` in /quota.** Tell the user they need Pro and share the upgrade link.

Prerequisites: voice_enabled=true + voice_credits > 0 + at least 1 phone number + at least 1 voice agent.
```
1. GET  /quota                    → voice_enabled? voice_credits > 0?
   If voice_credits=0 → share purchase_links.voice_credits
2. GET  /phone-numbers            → count > 0? (max 3)
   If empty → POST /phone-numbers/search + POST /phone-numbers/buy
3. GET  /voice/agents             → count > 0? (max 3)
   If empty → POST /voice/agents (create one)
4. POST /voice/call               → single call, OR:
5. POST /voice/campaigns          → bulk campaign (starts as draft)
6. PATCH /voice/campaigns/{id}    → action=activate, then action=trigger
```

### 4. Full Funnel
The `/command` endpoint now handles steps 1-3 automatically. Voice calling is the only manual step.
```
1. GET  /quota                    → know the plan, adapt accordingly
2. POST /command → poll /jobs/{id} → GET /leads  (scrape + websites + emails + outreach all automatic)
3. Voice (Pro only): /phone-numbers → /voice/agents → /voice/campaigns
```

---

## Endpoints Reference

### POST /command
Submit a natural language lead generation command. The API automatically runs the **full pipeline**: scrape → generate websites → enrich emails/socials → send outreach. No need to mention each step in the command.

**Body:**
```json
{
  "command": "Find 50 plumbers in Miami",
  "max_results": 50,
  "with_video": false,
  "with_vsl": false
}
```
- `command` (required, string, max 1000 chars) — just describe the niche and location. **Any number mentioned in the command is ignored** — use `max_results` to control lead count.
- `max_results` (optional, 1-100, default: **100**, or **10** when `with_video`/`with_vsl` is true)
- `with_video` (optional, bool, Pro plan only)
- `with_vsl` (optional, bool, Pro plan only)

**Default behavior:** The API always overrides what's in the command text. It scrapes up to `max_results` leads (default 100), generates a website for each, finds email addresses, enriches social profiles, and sends outreach emails — all automatically. Numbers in the command like "Find 15 plumbers" are ignored; use `max_results` instead.

**Response:** `{ job_id, status: "processing", defaults: { max_results, generate_websites, enrich_emails, send_outreach, with_video, with_vsl }, quota: { used, limit, remaining } }`

---

### GET /jobs
List submitted commands.

**Query:** `?limit=20&offset=0` (limit max 100)

**Response:** `{ jobs: [{ job_id, command, intent, status, error, created_at, updated_at }], total, limit, offset }`

---

### GET /jobs/{id}
Poll a job for progress and results.

**Response:**
```json
{
  "job_id": "uuid",
  "status": "processing|completed|failed",
  "progress": 75,
  "current_step": "Generating websites...",
  "steps": [{ "name": "scraping", "status": "completed", "message": "Found 50 leads", "count": 50 }],
  "result": {
    "websites": [{ "id": "uuid", "url": "https://...", "business_name": "...", "city": "...", "industry": "..." }],
    "leads_scraped": 50,
    "emails_sent": 0
  },
  "error": null
}
```
Poll every 5-10 seconds. Jobs take 30s to 5 minutes depending on count and video.

---

### GET /leads
List and filter leads.

**Query params (all optional):**
- `limit` (1-100, default 50), `offset` (default 0)
- `city` — partial match (e.g. "miami")
- `industry` — partial match (e.g. "plumber")
- `has_phone=true` — only leads with phone numbers
- `has_email=true` — only leads with email addresses
- `min_rating` — minimum Google rating (e.g. 4.0)
- `min_reviews` — minimum review count
- `job_id` — leads from a specific command
- `search` — free text search across name, city, industry
- `created_after` — ISO date (e.g. "2025-01-15")
- `created_before` — ISO date
- `has_website=true` — only leads with generated website URLs
- `has_video=true` — only leads with video
- `video_status` — pending|generating|completed|failed

**Response:**
```json
{
  "leads": [{
    "id": "uuid",
    "business_name": "Acme Plumbing",
    "city": "Miami",
    "industry": "Plumber",
    "phone": "+13055551234",
    "email": "info@acme.com",
    "rating": 4.8,
    "reviews": 127,
    "url": "https://unlora.com/acme-plumbing-miami",
    "language": "en",
    "video_url": "https://...",
    "video_status": "completed",
    "vsl_url": "https://...",
    "vsl_status": "completed",
    "socials": { "instagram": "...", "facebook": "...", "linkedin": "...", "twitter": "..." },
    "created_at": "2025-01-15T..."
  }],
  "total": 50, "limit": 50, "offset":