# Margo API Reference

> Research prospects from your apps and workflows. Inspect available contact details, source evidence and limitations before choosing a next step.

Canonical: https://www.margoleads.io/docs

## Getting Started

Using Claude Code, ChatGPT or Codex? 

[/docs/mcp](https://www.margoleads.io/docs/mcp)

Read the AI agents / MCP documentation

 for setup, tools, permissions and troubleshooting. The REST API below is for developer tools and workflow automation.

The Margo API lets you programmatically generate local business leads. To get started:

[/auth/signup](https://www.margoleads.io/auth/signup)

- Create a Margo account

-  and subscribe to the 

- Business plan

-  (API access is exclusive to Business)

- Go to 

[/dashboard/api-keys](https://www.margoleads.io/dashboard/api-keys)

- Dashboard → API Keys

-  and generate a key

- Verify your email, review current credit costs, then make an API call using the example below

Set MARGO_API_KEY and a unique MARGO_REQUEST_KEY for each intended search. Use a UUID or an 8–160 character key containing letters, digits, dots, underscores, colons or hyphens. Preserve the same key and body when reconciling the same job after a timeout; do not automatically resubmit a new search.

```
curl --max-time 30 -i -X POST https://www.margoleads.io/api/v1/leads/generate \
  -H "Authorization: Bearer $MARGO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $MARGO_REQUEST_KEY" \
  -d '{
    "category": "dentist",
    "country": "US",
    "state": "Florida",
    "city": "Miami",
    "maxResults": 10
  }'
```

## Authentication

All API requests require a Bearer token in the 

Authorization

 header.

```
Authorization: Bearer margo_sk_xxxxxxxxxxxxxxxxxxxx
```

Security:

 Never expose your API key in client-side code. Store it in environment variables (e.g. 

MARGO_API_KEY

) and make API calls from your backend.

### Managing Keys

Create, view, and revoke API keys from the 

[/dashboard/api-keys](https://www.margoleads.io/dashboard/api-keys)

API Keys

 page in your dashboard. Keys are shown only once at creation — store them securely.

## Generate Leads

POST

/api/v1/leads/generate

Generate local business leads by category and location. Contact fields, source evidence and review data are returned where available. Longer searches return HTTP 202 and a job URL to poll. Read limitations, constraint coverage and terminal status.

### Request Body

### category

Business type to search for. Examples: 

"dentist"

, 

"restaurant"

, 

"plumber"

, 

"hair_salon"

### country

Country code (ISO 3166-1 alpha-2). Examples: 

"US"

, 

"GB"

, 

"DE"

, 

"AU"

### state

Region or location name, such as Florida or London. Use city or state for Maps targeting; state is not the country code.

### city

City or region name to narrow results. Examples: 

"Miami"

, 

"London"

, 

"Berlin"

### keyword

Additional keyword filter for more specific results. Example: 

"endodontist"

, 

"matcha"

### maxResults

Maximum number of leads requested. Governed API default: 

. Max: 

. Partial or empty results are possible.

### Supported Business Categories

### Supported Countries

US, GB, AU, CA, NZ, AE, AR, BE, BR, ES, IE, KR, MX, NL, PL, SE, TH, TR, FR, IT, IN, JP, DE

## Response Format

A search may finish immediately or return HTTP 202 with a durable job. Read terminal.status, not just the HTTP status. This illustrative response starts polling without starting another search:

```
{
  "jobId": "your_job_id",
  "terminal": { "status": "QUEUED", "requestedCount": 10, "deliveredCount": 0 },
  "limitations": [],
  "constraintCoverage": { "enforced": [], "notGuaranteed": [] },
  "pollUrl": "/api/v1/leads/jobs/your_job_id"
}
```

Poll 

GET /api/v1/leads/jobs/:id

 with the same API key. The response contains 

job

, 

terminal

, 

limitations

 and 

constraintCoverage

. QUEUED/RUNNING are in progress. COMPLETE, PARTIAL, EMPTY, FAILED and CANCELLED are terminal. Results are in 

job.result

 when available; an immediate generation response can contain the result at the top level.

Inspect delivered counts, stop reasons and constraints before using the records. PARTIAL is not full coverage, and EMPTY does not prove no prospects exist. Cancel an active owned job with 

POST /api/v1/leads/jobs/:id/cancel

; already delivered research may remain billable.

### Lead fields, where available

### businessName

Business name

### contactName

Contact name, where available

### email

Email address; availability is not verification

### phone

Phone number, where available

### address

Address, where available

### website

Website URL, where available

### emailVerified

Only treat an address as verified when independent verification evidence supports it

### rawData

Source-specific review fields, social profiles and source links, where supplied. These fields can be absent.

## Skill Manifest (AI Agents)

Margo provides a machine-readable skill manifest that AI agents can use to discover and interact with the API. Download it with:

```
curl -o margo-skill.json https://www.margoleads.io/api/v1/skill
```

The JSON manifest describes available endpoints, parameters, authentication and response schemas for developers. For agent tool discovery and account linking, use the 

[/docs/mcp](https://www.margoleads.io/docs/mcp)

MCP documentation

.

Tip:

 You can also download the skill file from the 

[/dashboard/api-keys](https://www.margoleads.io/dashboard/api-keys)

API Keys

 page in your dashboard.

## Rate Limits & Credits

API usage requires Business access and a verified email. Credits depend on the source and current research policy, including any disclosed search minimum. Read current tariffs in the 

[/api/v1/skill](https://www.margoleads.io/api/v1/skill)

API manifest

 or the 

[/docs/mcp#credits](https://www.margoleads.io/docs/mcp#credits)

MCP credit reference

 before starting a search.

Use a stable 

Idempotency-Key

 for each intended search and reuse it for identical retries. Use a new key only for a new search. Polling the existing job does not start another search.

HTTP 429 indicates a request or quota limit; inspect the returned error and back off rather than retrying rapidly. Research credit availability is separate from request admission. Check current allowance and purchased credits in your account; plan details are on 

[/#pricing](https://www.margoleads.io/#pricing)

Pricing

.

## Error Handling

Inspect both HTTP status and JSON body. A generation request can return HTTP 200 with a terminal FAILED result, or HTTP 202 while work continues.

- : check JSON, source inputs and the required Idempotency-Key (8–160 letters, digits, periods, underscores, colons or hyphens).

- : missing, expired or revoked API key.

- : Business access or email verification required.

- : job not found for this account.

- : conflicting retry inputs, or cancellation of an already-terminal/unknown job.

- : unsupported targeting, such as strict city targeting on a country-level source.

- : rate or quota limit; inspect the error and back off.

- 5xx

- : unavailable source or server error. Retry identical searches with their existing key; contact support if persistent.

```
{ "error": "Idempotency-Key is required." }
```

## Examples

For bounded polling with strict terminal-state handling, see the 

[/integrations/crewai](https://www.margoleads.io/integrations/crewai)

CrewAI integration guide

 and 

[/examples/margo-crewai-tool.py](https://www.margoleads.io/examples/margo-crewai-tool.py)

download its tested Python source

. For a workflow integration, follow the 

[/integrations/make](https://www.margoleads.io/integrations/make)

Make guide

.

Preserve the same ID for retries; use a new ID for each new intended search. Poll the existing job, not the generation endpoint. These examples stop after three minutes; check the same job later if it is still running.

### Python

```
import requests
import os
import time

base = "https://www.margoleads.io"
headers = {"Authorization": f"Bearer {os.environ['MARGO_API_KEY']}"}
response = requests.post(
    f"{base}/api/v1/leads/generate",
    headers={
        **headers,
        "Idempotency-Key": "london-restaurants-example-001",
    },
    json={
        "category": "restaurant",
        "country": "GB",
        "city": "London",
        "maxResults": 10,
    },
    timeout=35,
)
response.raise_for_status()
data = response.json()
for _ in range(60):
    if data.get("terminal", {}).get("status") not in ("QUEUED", "RUNNING"):
        break
    time.sleep(3)
    job_id = data.get("jobId") or data["job"]["id"]
    response = requests.get(f"{base}/api/v1/leads/jobs/{job_id}",
                            headers=headers, timeout=15)
    response.raise_for_status()
    data = response.json()
else:
    raise TimeoutError("Check this same job again later.")

if data.get("terminal", {}).get("status") in ("FAILED", "CANCELLED"):
    raise RuntimeError(f"Search ended: {data['terminal']['status']}")
print(data.get("terminal"), data.get("limitations"), data.get("constraintCoverage"))
result = data.get("job", {}).get("result") or data
for lead in result.get("leads", []):
    print(lead.get("businessName"), lead.get("email"))
```

### JavaScript / Node.js

```
const base = "https://www.margoleads.io";
const headers = { Authorization: `Bearer ${process.env.MARGO_API_KEY}` };
async function json(response) {
  const data = await response.json();
  if (!response.ok) throw new Error(data.error || `HTTP ${response.status}`);
  return data;
}
let data = await json(await fetch(base + "/api/v1/leads/generate", {
  method: "POST",
  headers: {
    ...headers,
    "Content-Type": "application/json",
    "Idempotency-Key": "new-york-plumbers-example-001",
  },
  body: JSON.stringify({
    category: "plumber",
    country: "US",
    city: "New York",
    maxResults: 10,
  }),
  signal: AbortSignal.timeout(35000),
}));
let polls = 0;
while (["QUEUED", "RUNNING"].includes(data.terminal?.status)) {
  if (++polls > 60) throw new Error("Check this same job again later.");
  await new Promise(resolve => setTimeout(resolve, 3000));
  const jobId = data.jobId || data.job.id;
  data = await json(await fetch(base + "/api/v1/leads/jobs/" + encodeURIComponent(jobId), {
    headers, signal: AbortSignal.timeout(15000),
  }));
}
if (["FAILED", "CANCELLED"].includes(data.terminal?.status)) {
  throw new Error("Search ended: " + data.terminal.status);
}
console.log(data.terminal, data.limitations, data.constraintCoverage);
const result = data.job?.result || data;
for (const lead of result.leads || []) console.log(lead.businessName, lead.email);
```

### cURL

```
curl -X POST https://www.margoleads.io/api/v1/leads/generate \
  -H "Authorization: Bearer $MARGO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: sydney-gyms-example-001" \
  -d '{"category":"gym","country":"AU","city":"Sydney","maxResults":20}'

# If still QUEUED or RUNNING, poll its jobId:
curl https://www.margoleads.io/api/v1/leads/jobs/YOUR_JOB_ID \
  -H "Authorization: Bearer $MARGO_API_KEY"
```

## Plans & Pricing

- : $

- /month

-  with 

-  credits.

Credits are work units, not a universal one-lead allowance. Discovery, enrichment and verification consume different amounts.

REST requires the Business API entitlement. MCP access is available on Professional and higher plans. Both use account credits. Source-specific tariffs and search minimums apply; a requested count is not a guarantee of complete delivery or contact availability.

[/#pricing](https://www.margoleads.io/#pricing)

View current plans, prices and included allowances →

## Support

Need help with the API?

- Email: 

[/contact](https://www.margoleads.io/contact)

- Contact us

- Website: 

[https://www.margoleads.io](https://www.margoleads.io/)

- margoleads.io

## Plans
| Plan | Monthly USD | Annual USD | Credits/month | Features |
| --- | --- | --- | --- | --- |
| Starter | 9 | 90 | 2,000 credits / month | 2,000 credits / month; Business, B2B and Shopify contact discovery; Social posts in Feed (uses credits); CSV, JSON and TSV export; Email support |
| Professional | 39 | 390 | 9,000 credits / month | 9,000 credits / month; Everything in Starter; MCP access for your AI agents; Email verification available as an approved operation; Priority support |
| Business | 129 | 1290 | 30,000 credits / month | 30,000 credits / month; Everything in Professional; Full API access; Priority support |

## Discovery pricing

Choose a channel. The ? beside each plan’s credits explains estimates and research quotes.

Google Maps

1 credit / lead

LinkedIn

10 credits / person or company

Base search rate. Small-search minimums and premium filters are quoted before approval. Enrichment, verification and monitoring are separate.

E-commerce contacts

Quoted before approval

Extra research & minimum charges

Maps small-search minimum: 23 credits. LinkedIn minimums depend on the approved request and current provider costs. E-commerce contact prices depend on batch size and required contact details; review the full quote before approval. Discovery charges follow newly delivered qualified results; unused approved credits are released. Separately approved research follows its quoted terms.

Email verification: 1 credit per decisive result. Opportunity assessment: 1 credit per lead. Website research: 5 credits per page, plus approved AI processing.

SEO Opportunities: up to 70 credits per new report on Professional and Business. Reusing a saved report is free.
