# Quickstart

> Send your first lead to the REST API with an API key, or connect an AI client to the MCP server.

Two paths. Send data in from your own code with the REST API, or connect an
AI client such as Claude to the MCP server.

## REST: send your first lead

### 1. Turn on the REST API and get an API key

A workspace admin opens **Integrations**, then **Workspace integrations**, then **MCP & API**
in Funnel One.

1. Under **Workspace switches** on the **Overview**, turn on **REST API**. It is
   off for every workspace until an admin turns it on; until then every call
   answers `403 api_disabled`.
2. Open **API keys** and choose **+ Add key**. Keep the **Leads** write box
   ticked (it is on by default); this is the `leads.manage` scope. The key is
   shown once. Copy it into your secret store.

> **Keys are secrets:**
>
> Send a key only in the `Authorization` header, from your server. Never put it
> in a URL, in browser code or in a repository.

### 2. Send a lead

**curl**

```sh
curl -X POST https://app.funnelone.ai/api/v1/leads \
  -H "Authorization: Bearer $F1_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: signup-8f2c1a" \
  -d '{"email":"sam@example.com","first_name":"Sam","last_name":"Rivera","company":{"domain":"example.com","name":"Example"}}'
```

**TypeScript**

```ts
const res = await fetch('https://app.funnelone.ai/api/v1/leads', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.F1_API_KEY}`,
    'Content-Type': 'application/json',
    'Idempotency-Key': 'signup-8f2c1a',
  },
  body: JSON.stringify({
    email: 'sam@example.com',
    first_name: 'Sam',
    last_name: 'Rivera',
    company: { domain: 'example.com', name: 'Example' },
  }),
});
console.log(res.status, await res.json()); // 201 { lead_id: ..., ... }
```

**Python**

```python
import os, requests

res = requests.post(
    "https://app.funnelone.ai/api/v1/leads",
    headers={
        "Authorization": f"Bearer {os.environ['F1_API_KEY']}",
        "Idempotency-Key": "signup-8f2c1a",
    },
    json={
        "email": "sam@example.com",
        "first_name": "Sam",
        "last_name": "Rivera",
        "company": {"domain": "example.com", "name": "Example"},
    },
)
print(res.status_code, res.json())  # 201 {"lead_id": ..., ...}
```

### 3. Read the response

A new lead answers `201` with `lead_id`, `status`, and the `company_id` and
`contact_id` it was matched to when Funnel One could match it. Sending the
same `Idempotency-Key` again within 24 hours returns the first answer, and
after that answers `409 duplicate_request`, so a retry never creates a second
lead. See [the REST overview](https://dev.funnelone.ai/rest/) for every field and
[Errors](https://dev.funnelone.ai/rest/errors/) for what can go wrong.

## MCP: connect an AI client

A workspace admin first turns on **MCP server** under **Workspace switches**
in **Integrations**, then **Workspace integrations**, then **MCP & API**. It is off by
default.

The fastest way: let your AI agent do it.

To have your AI agent set this up, paste this sentence into it:

```text
Fetch and follow the instructions to connect me to Funnel One from https://dev.funnelone.ai/agent-setup/prompt.md
```

Or do it yourself. In Claude Code:

```sh
claude mcp add --transport http funnelone https://app.funnelone.ai/mcp
```

Then type `/mcp` in Claude Code, pick `funnelone` and sign in to Funnel One in
the browser. Every other client, step by step: [Connect a client](https://dev.funnelone.ai/mcp/connect/).

## Next steps

- [Authentication](https://dev.funnelone.ai/get-started/authentication/): the credentials, and how sign-in works.
- [Scopes](https://dev.funnelone.ai/get-started/scopes/): every permission a credential can carry.
- [MCP overview](https://dev.funnelone.ai/mcp/): what an AI client can and cannot do.

Source: https://dev.funnelone.ai/get-started/quickstart/
