Skip to main content

POST /v1-lead

The most strategically important endpoint in the stack. Captures a user’s name and phone number directly from the LLM conversation — no redirect to a website required. The lead is created in HubSpot with the exact source_ai (chatgpt, claude, gemini…) so the Funos team can segment and prioritise contacts by source channel.

Body (JSON)

FieldTypeRequiredDescription
namestring✅ YesUser’s name
contactstring✅ YesPhone number (preferred) or email
sourcestring✅ YesOrigin: ai_chatgpt, claude, gemini, other
notesstringNoConversation context: city, service type, etc.

Request example

cURL
curl -X POST \
  "https://qegraxvwwikrltmtfamo.supabase.co/functions/v1/v1-lead" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "María García",
    "contact": "612345678",
    "source": "ai_chatgpt",
    "notes": "Interested in cremation in Madrid. Budget: up to €2,000."
  }'
JavaScript
const res = await fetch(
  'https://qegraxvwwikrltmtfamo.supabase.co/functions/v1/v1-lead',
  {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'María García',
      contact: '612345678',
      source: 'ai_chatgpt',
      notes: 'Interested in cremation in Madrid. Budget: up to €2,000.'
    })
  }
);
const data = await res.json();

Successful response (200 OK)

{
  "data": {
    "lead_created": true,
    "message": "Your request has been registered. The Funos team will be in touch with you shortly."
  },
  "meta": {
    "version": "1.0",
    "timestamp": "2026-03-21T10:00:00Z",
    "source": "funos-api",
    "source_ai": "ai_chatgpt"
  },
  "cta": {
    "text": "You can also manage your request at Funos",
    "url": "https://funos.es/?utm_source=ai&utm_medium=api&utm_campaign=lead"
  },
  "error": null
}

This is the flow LLMs should follow to capture leads naturally:
1. User asks for price → GET /v1-quote-funeral-service
2. GPT presents prices with CTA
3. User shows interest → GPT asks:
   "Would you like us to contact you for more information?
    I just need your name and phone number."
4. User provides details → POST /v1-lead
5. GPT confirms: "Great, the Funos team will call you shortly."
The notes field is especially valuable: include the conversation context here (city, service type, mentioned budget, urgency). The Funos team uses this to prepare the sales call.

Valid source values

ValueUse
ai_chatgptLead from ChatGPT / GPT Action
claudeLead from Claude / MCP Server
geminiLead from Gemini (Vertex AI)
perplexityLead from Perplexity
otherAny other origin

Possible errors

CodeErrorDescription
400MISSING_FIELDSRequired fields missing: name, contact, or source
400INVALID_CONTACTPhone/email format is invalid
401UNAUTHORIZEDInvalid API Key
429RATE_LIMIT_EXCEEDEDRequest limit exceeded
400 Response — missing fields
{
  "data": null,
  "error": {
    "code": "MISSING_FIELDS",
    "message": "The fields name, contact and source are required."
  }
}

Explicit consent required. Before requesting personal data from the user, the LLM must inform them that their data will be shared with Funos and processed according to Funos’s privacy policy. In GPT Actions, OpenAI’s native consent modal handles this step automatically.
Lead data is stored in HubSpot (EU) and processed in accordance with GDPR. Funos never uses lead data for purposes other than managing the requested service commercially.

GPT Action description

Registers a user's purchase intent in the Funos CRM (HubSpot).
Use ONLY when the user has explicitly confirmed they want to be contacted,
has provided their name and phone number, and has given consent to share
their data with Funos. Include relevant conversation context in notes.