> ## Documentation Index
> Fetch the complete documentation index at: https://docs.openfunnel.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Headless primitives for GTM engineering.

> Robust, durable and benchmarked primitives to power your in-house GTM engineering at scale.

## Onboard your Agent

Paste this into Claude Code, Cursor, Windsurf, or any coding agent — it'll read the full API index and set itself up:

```
Read https://docs.openfunnel.dev/llms.txt
Follow setup instructions to authenticate and start using OpenFunnel APIs.
```

***

## Authentication

Every request authenticates with a single header:

| Header | Value |
| - | - |
| `X-API-Key` | Your API key (`of_...`) |
| `Content-Type` | `application/json` |

No OAuth, no dashboard — agents and humans get a key the same way.

### Get a key

**1. Sign up / sign in**

`POST /api/v1/agent/sign-up` sends a 6-digit code to your email. New users get an account; existing users use this to recover a lost key.

```bash theme={"dark"}
curl -X POST https://api.openfunnel.dev/api/v1/agent/sign-up \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'
```

**2. Verify**

`POST /api/v1/agent/verify` with the code returns your key.

```bash theme={"dark"}
curl -X POST https://api.openfunnel.dev/api/v1/agent/verify \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com", "otp_code": "123456"}'
```

```json theme={"dark"}
{
  "email": "you@example.com",
  "api_key": "of_1234567890abcdef...",
  "is_new_user": true
}
```

> [!WARNING]
>
> The key is only returned at verification time and is not retrievable later. Store it securely. To recover a lost key, call sign-up again with the same email.

### Authenticate requests

Send the key as `X-API-Key` on every endpoint:

```bash cURL theme={"dark"}
curl https://api.openfunnel.dev/api/v1/credits/balance \
  -H "X-API-Key: $OPENFUNNEL_API_KEY" \
  -H "Content-Type: application/json"
```

```python Python theme={"dark"}
import os, requests

resp = requests.get(
    "https://api.openfunnel.dev/api/v1/credits/balance",
    headers={"X-API-Key": os.environ["OPENFUNNEL_API_KEY"]},
)
resp.raise_for_status()
```

```typescript TypeScript theme={"dark"}
const resp = await fetch(
  "https://api.openfunnel.dev/api/v1/credits/balance",
  {
    method: "GET",
    headers: {
      "X-API-Key": process.env.OPENFUNNEL_API_KEY!,
      "Content-Type": "application/json",
    },
  },
);
```

### Errors

| Status | `error_code` | Meaning |
| - | - | - |
| 400 | `OTP_EXPIRED` | No pending code, call sign-up again. |
| 400 | `OTP_INVALID` | Wrong code (`details.remaining_attempts` shows how many tries are left). |
| 429 | `RATE_LIMITED` | Too many sign-up attempts (`details.retry_after_seconds`). |
| 429 | `OTP_MAX_ATTEMPTS` | Code exhausted after 10 tries, call sign-up again. |
| 500 | `INTERNAL_ERROR` | Transient server error, retry. |

Verification codes expire after 24 hours and allow up to 10 attempts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.