# 1DB > Lead capture for websites. A site's form posts each submission to 1DB, which stores it, notifies the team and syncs it to HubSpot or Salesforce. ## Send a lead POST https://gallant-goshawk-513.convex.site/v1/leads Headers: `Content-Type: application/json`, `X-API-Key: ` Body: `{ "formSlug": "
", ...field values, e.g. "email", "name", "message" }` Project env vars (the CLI, MCP server and every guide use these names): ``` DB_API_ENDPOINT=https://gallant-goshawk-513.convex.site DB_API_KEY=1db_... DB_FORM_SLUG=contact ``` Post to `${DB_API_ENDPOINT}/v1/leads`. Prefer a server route; if the browser must send it, prefix the names for the framework (NEXT_PUBLIC_DB_API_KEY, VITE_DB_API_KEY). ## Let an agent set it up - `npx @1db/cli setup`: browser sign-in, then adds the 1DB MCP server to Claude Code. The user runs it once per computer in their own terminal (Node 18+), never in CI or a project. The agent token it makes (`1db_at_`) must never be written into a project; projects only get the site's ingest key (`1db_`). - Site already sends leads to 1DB: don't rewrite it. Run `npx @1db/cli@latest check` in the project root (add `--send` for one test lead) and fix only what it marks as failing. - Going live: env files are local only. The user adds DB_API_ENDPOINT, DB_API_KEY and DB_FORM_SLUG to the host's production env vars and redeploys, then submits the live form. - Test leads (send_test_lead, `1db send`, `1db check --send`) are real leads tagged source "1db-test": they run CRM sync, notifications and forwarding. Send one per check. - MCP server (Streamable HTTP): https://www.1-db.com/api/mcp with `Authorization: Bearer 1db_at_...`. Tools: onboard_website, create_form, get_website, list_websites, scan_domain, send_test_lead, list_leads, whoami, plus the configuration tools below. - Agent API: https://gallant-goshawk-513.convex.site/v1/agent/* with the same Bearer token. - Configure: MCP `update_website` (status, website-level fallback product type), `list_product_types`, `create_product_type`, `import_product_types` (a forwarding destination's published list; routing scope), `get_form`, `update_form` (name, slug, fields, default lead type and product type), `set_form_notifications`, forwarding rules (`list/create/update/delete_forwarding_rule`; `profile` is `generic` or `repackify`), `delete_form`, `delete_website` (deletes need `confirm` = the slug). CLI: `site`, `product-types [add "Name" | import ]`, `form-edit`, `notify`, `forwarding`, `delete`. New organizations start with no product types. - Token scopes: `sites` (websites, forms, settings, keys, test leads), `leads` (read leads), `routing` (forwarding, notification emails, webhooks), `delete`. A missing scope returns 403; `whoami` lists the token's scopes. - Another form on a connected site: MCP `create_form`, `npx @1db/cli form --name "Quote request"` (or `--template quote-request|pickup-request|contact`, `--product-type `, `--lead-type buy`), or `POST /v1/agent/forms { website, name?, slug?, fields?, preset?, template?, defaultLeadType?, defaultProductType? }`. Post its leads with the returned slug as `formSlug`; keep the site's `DB_API_KEY`. A lead's lead type / product type: the visitor's value, else the form default, else the website default (product type). ## Docs - [Quickstart](https://www.1-db.com/docs/quickstart): first lead in a few minutes - [Authentication](https://www.1-db.com/docs/authentication): API keys and keeping them server-side - [AI agents, MCP and CLI](https://www.1-db.com/docs/guides/ai-agents): agent setup, CLI commands, agent API - [Next.js](https://www.1-db.com/docs/guides/nextjs): route handler and server action - [React](https://www.1-db.com/docs/guides/react): hook, server route, form component - [HTML forms](https://www.1-db.com/docs/guides/html-forms): static sites and embed - [Webhooks](https://www.1-db.com/docs/guides/webhooks): lead events to your own endpoints - [Lead forwarding](https://www.1-db.com/docs/guides/lead-forwarding): destination profiles, the generic payload, form templates and defaults - [HubSpot](https://www.1-db.com/docs/guides/hubspot): CRM field mapping