# Leads

## Get all leads for a specific chatflow

> Retrieve all leads associated with a specific chatflow

```json
{"tags":[{"name":"leads"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the lead"},"name":{"type":"string","description":"Name of the lead"},"email":{"type":"string","description":"Email address of the lead"},"phone":{"type":"string","description":"Phone number of the lead"},"chatflowid":{"type":"string","description":"ID of the chatflow the lead is associated with"},"chatId":{"type":"string","description":"ID of the chat session the lead is associated with"},"createdDate":{"type":"string","format":"date-time","description":"Date and time when the lead was created"}}}}},"paths":{"/leads/{id}":{"get":{"tags":["leads"],"summary":"Get all leads for a specific chatflow","description":"Retrieve all leads associated with a specific chatflow","operationId":"getAllLeadsForChatflow","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"string"},"description":"Chatflow ID"}],"responses":{"200":{"description":"Successful operation","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Lead"}}}}},"400":{"description":"Invalid ID provided"},"404":{"description":"Leads not found"},"500":{"description":"Internal server error"}}}}}}
```

## Create a new lead in a chatflow

> Create a new lead associated with a specific chatflow

```json
{"tags":[{"name":"leads"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}},"schemas":{"Lead":{"type":"object","properties":{"id":{"type":"string","format":"uuid","description":"Unique identifier for the lead"},"name":{"type":"string","description":"Name of the lead"},"email":{"type":"string","description":"Email address of the lead"},"phone":{"type":"string","description":"Phone number of the lead"},"chatflowid":{"type":"string","description":"ID of the chatflow the lead is associated with"},"chatId":{"type":"string","description":"ID of the chat session the lead is associated with"},"createdDate":{"type":"string","format":"date-time","description":"Date and time when the lead was created"}}}}},"paths":{"/leads":{"post":{"tags":["leads"],"operationId":"createLead","summary":"Create a new lead in a chatflow","description":"Create a new lead associated with a specific chatflow","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}},"required":true},"responses":{"200":{"description":"Lead created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Lead"}}}},"400":{"description":"Invalid request body"},"422":{"description":"Validation error"},"500":{"description":"Internal server error"}}}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flowiseai.com/api-reference/leads.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
