> For the complete documentation index, see [llms.txt](https://developer.crmgrow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.crmgrow.com/events/lead.md).

# Lead

These are APIs for the agentfire integration for now.

## Send a Lead or related event to the Lead

<mark style="color:green;">`POST`</mark> `https://api.crmgrow.com/api/event/lead`

For now, this should be called from **agentfire**.

#### Headers

| Name                                            | Type   | Description                                                                |
| ----------------------------------------------- | ------ | -------------------------------------------------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | API key (Get this key from <https://app.crmgrow.com/settings/integration>) |

#### Request Body

| Name                                   | Type      | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                |
| -------------------------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| type<mark style="color:red;">\*</mark> | String    | <p>The type of event. Currently one of <code>Registration</code>, <code>Inquiry</code>, <code>Seller Inquiry</code>, <code>Property Inquiry</code>, <code>General Inquiry</code>, <code>Viewed Property</code>, <code>Saved Property</code>, <code>Visited Website</code>, <code>Incoming Call</code>, <code>Unsubscribed</code>, <code>Property Search</code>, <code>Saved Property Search</code>, <code>Visited Open House</code> or <code>Viewed Page</code>.</p><p><br></p> |                                |
| source                                 | String    | <p>The name of the lead source.</p><p><br></p>                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                |
| system                                 | String    | <p>The name of the system used in providing leads.</p><p><br></p>                                                                                                                                                                                                                                                                                                                                                                                                               |                                |
| message                                | String    | A message from the user about this inquiry.                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                |
| description                            | String    | Any additional information about this inquiry.                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                |
| person                                 | Object    | <p>Information about the lead who triggered this event. This would be stored as new contact in crmgrow</p><p><br></p>                                                                                                                                                                                                                                                                                                                                                           |                                |
| property                               | Object    | Information about the property this event is related to.                                                                                                                                                                                                                                                                                                                                                                                                                        |                                |
| propertySearch                         | Object    | If this event was an inquiry you may have information about what the person was searching for, you can submit this information using this field.                                                                                                                                                                                                                                                                                                                                |                                |
| campaign                               | Object    | The name of the source where the lead originated. (e.g., If the lead came to your site through an organic search on `www.google.com` the source is "Google".)                                                                                                                                                                                                                                                                                                                   |                                |
| pageTitle                              | String    | This field is to be used with the `Viewed Page` event type and indicates the title of the page viewed. (e.g., "Contact Us")                                                                                                                                                                                                                                                                                                                                                     |                                |
| pageUrl                                | String    | This field is to be used with the `Viewed Page` event type and indicates the url of the page viewed. (e.g., "[http://www.samplerealestate.com/contact-us"](http://www.samplerealestate.com/contact-us%22))                                                                                                                                                                                                                                                                      |                                |
| pageDuration                           | Int       | <p>This field is to be used with the <code>Viewed Page</code> event type and indicates the duration of the visitor on the page viewed given in seconds.</p><p><br></p>                                                                                                                                                                                                                                                                                                          |                                |
| pageReferrer                           | String    | <p>This field is to be used with the <code>Viewed Page</code> event type and indicates the referrer url where the visitor came from. (e.g., "<a href="https://www.google.com&#x22;/"><https://www.google.com>"</a>)</p><p><br></p>                                                                                                                                                                                                                                              |                                |
| personId                               | String    | This is the identifier of the lead. We can match the corresponding events with this personId                                                                                                                                                                                                                                                                                                                                                                                    |                                |
| person.assignedTo                      | String    | Full name of the agent to assign to this person.                                                                                                                                                                                                                                                                                                                                                                                                                                |                                |
| person.id                              | String    | The ID of the person the event corresponds to (optional).                                                                                                                                                                                                                                                                                                                                                                                                                       |                                |
| person.firstName                       | String    | The firstname of the person                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                |
| person.lastName                        | String    | The last name of the person                                                                                                                                                                                                                                                                                                                                                                                                                                                     |                                |
| person.stage                           | String    | Status of the person (lead or trash)                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                |
| person.source                          | String    | The source of the lead.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                |
| person.sourceUrl                       | String    | This is a direct link to the information about a person at the lead provider.                                                                                                                                                                                                                                                                                                                                                                                                   |                                |
| person.contacted                       | String    | Sets whether the person has been contacted or not.                                                                                                                                                                                                                                                                                                                                                                                                                              |                                |
| person.price                           | Int       | The estimated sell/buy price for this person.                                                                                                                                                                                                                                                                                                                                                                                                                                   |                                |
| person.emails                          | Object\[] | <p>Each element is following type</p><p>{ value: string(email), type: string(home                                                                                                                                                                                                                                                                                                                                                                                               | work), isPrimary: boolean}</p> |
| person.phones                          | Object\[] | <p>Each element is following type</p><p>{ value: string(phone), type: string(home                                                                                                                                                                                                                                                                                                                                                                                               | work), isPrimary: boolean}</p> |
| person.addresses                       | Object\[] | <p>Each element is following type.</p><p>{ street: string, city: string, state: string, code: string, country: string, type: string}</p>                                                                                                                                                                                                                                                                                                                                        |                                |
| person.tags                            | String\[] |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |                                |
| person.assignedLenderName              | String    | Full name of the lender to assign to this person.                                                                                                                                                                                                                                                                                                                                                                                                                               |                                |
| person.assignedUserId                  | Int       | ID of the agent assigned to this person.                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                |
| person.assignedLenderId                | Int       | ID of the lender assigned to this person.                                                                                                                                                                                                                                                                                                                                                                                                                                       |                                |
| property.street                        | String    | Street address. (e.g., "3595 South Higuera St, Suite B")                                                                                                                                                                                                                                                                                                                                                                                                                        |                                |
| property.city                          | String    | City name.                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                |
| property.state                         | String    | Abbreviated state code. (e.g., "CA", "NY", etc.)                                                                                                                                                                                                                                                                                                                                                                                                                                |                                |
| property.code                          | String    | Zipcode. (Only as a string, not a number. e.g., "90210")                                                                                                                                                                                                                                                                                                                                                                                                                        |                                |
| property.mlsNumber                     | String    | MLS Number for the property.                                                                                                                                                                                                                                                                                                                                                                                                                                                    |                                |
| property.price                         | Int       | The asking price or price estimate for the property.                                                                                                                                                                                                                                                                                                                                                                                                                            |                                |
| property.forRent                       | boolean   | Sets whether this property is for rent or not.                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                |
| property.url                           | String    | A URL for the property provided by the lead source.                                                                                                                                                                                                                                                                                                                                                                                                                             |                                |
| property.type                          | String    | A freeform description of property type. (e.g., "Bungalow" or "Apartment")                                                                                                                                                                                                                                                                                                                                                                                                      |                                |
| property.bedrooms                      | String    | The number of bedrooms.                                                                                                                                                                                                                                                                                                                                                                                                                                                         |                                |
| property.bathrooms                     | String    | The number of bathrooms.                                                                                                                                                                                                                                                                                                                                                                                                                                                        |                                |
| property.area                          | String    | Area of the property in square feet.                                                                                                                                                                                                                                                                                                                                                                                                                                            |                                |
| property.lot                           | String    | Area of the lot/land in acres.                                                                                                                                                                                                                                                                                                                                                                                                                                                  |                                |
| propertySearch.type                    | String    | The type of property the person was searching for. (e.g., "Residential", "Lot", "Apartment", etc.)                                                                                                                                                                                                                                                                                                                                                                              |                                |
| propertySearch.neighborhood            | String    | The neighborhood or area in which a person is searching for a property.                                                                                                                                                                                                                                                                                                                                                                                                         |                                |
| propertySearch.minPrice                | Int       | The minimum price in which a person was searching.                                                                                                                                                                                                                                                                                                                                                                                                                              |                                |
| propertySearch.maxPrice                | Int       | The maximum price in which a person was searching.                                                                                                                                                                                                                                                                                                                                                                                                                              |                                |
| propertySearch.minBedrooms             | Int       | The minimum number of bedrooms that a person was searching for.                                                                                                                                                                                                                                                                                                                                                                                                                 |                                |
| propertySearch.maxBedrooms             | Int       | The maximum number of bedrooms that a person was searching for.                                                                                                                                                                                                                                                                                                                                                                                                                 |                                |
| propertySearch.minBathrooms            | Int       | The minimum number of bathrooms that a person was searching for.                                                                                                                                                                                                                                                                                                                                                                                                                |                                |
| propertySearch.maxBathrooms            | Int       | The maximum number of bathrooms that a person was searching for.                                                                                                                                                                                                                                                                                                                                                                                                                |                                |
| propertySearch.city                    | String    | The city in which a person was searching.                                                                                                                                                                                                                                                                                                                                                                                                                                       |                                |
| propertySearch.code                    | String    | The zipcode in which a person was searching.                                                                                                                                                                                                                                                                                                                                                                                                                                    |                                |
| propertySearch.state                   | String    | The state in which a person was searching.                                                                                                                                                                                                                                                                                                                                                                                                                                      |                                |

{% tabs %}
{% tab title="200: OK " %}

{% endtab %}
{% endtabs %}

## Load the saved events

<mark style="color:blue;">`GET`</mark> `https://api.crmgrow.com/api/event/lead`

With this API, can load the events by personId or account.

#### Query Parameters

| Name     | Type   | Description                                                                                                                                                                                                                                                                                                                             |
| -------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| limit    | Int    | Limit of the loaded events (Default is 10)                                                                                                                                                                                                                                                                                              |
| offset   | Int    | Offset to load the events                                                                                                                                                                                                                                                                                                               |
| personId | String | Find all events related to a person.                                                                                                                                                                                                                                                                                                    |
| type     | String | <p>Comma separated list of one or more of the following: "Registration", "Inquiry", "Seller Inquiry", "Property Inquiry", "General Inquiry", "Viewed Property", "Saved Property", "Visited Website", "Incoming Call", "Unsubscribed", "Property Search", "Saved Property Search", "Visited Open House" or "Viewed Page".</p><p><br></p> |

#### Headers

| Name          | Type   | Description                                                                                                                               |
| ------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| Authorization | String | <p>API key (Get this key from <https://app.crmgrow.com/settings/integration>)</p><p>When integrate with crmgrow, generate the API key</p> |

{% tabs %}
{% tab title="200: OK " %}

````
```json
{
    "total": 1,
    "data": [
        {
            "_id": "656748a4f98fe324378ab17c",
            "type": "Property Inquiry",
            "message": "I am interested in 6825 Mulholland Dr, ...",
            "description": "Move-in: 12/28/2013",
            "property": {
                "street": "6825 Mulholland Dr",
                "city": "Los Angeles",
                "state": "CA",
                "code": "90068",
                "mlsNumber": "14729339",
                "price": "310000",
                "forRent": "0",
                "url": "http://www.zillow.com/homedetails/6825-Mulholland-Dr-Los-Angeles-CA-90068/2109065822_zpid/",
                "type": "Residential",
                "bedrooms": "0",
                "bathrooms": null,
                "area": null,
                "lot": null
            },
            "pageTitle": null,
            "pageUrl": null,
            "pageDuration": "0",
            "user": "5efe4378d9167f154513e76e",
            "created_at": "2023-11-29T14:20:20.682Z",
            "updated_at": "2023-11-29T14:20:20.682Z",
            "__v": 0
        }
    ]
}
```
````

{% endtab %}
{% endtabs %}

## Get the exact event detail by id

<mark style="color:blue;">`GET`</mark> `https://api.crmgrow.com/api/event/:id`

#### Path Parameters

| Name                                 | Type   | Description                 |
| ------------------------------------ | ------ | --------------------------- |
| id<mark style="color:red;">\*</mark> | String | The Id of the event to load |

#### Headers

| Name          | Type   | Description                                                                |
| ------------- | ------ | -------------------------------------------------------------------------- |
| Authorization | String | API key (Get this key from <https://app.crmgrow.com/settings/integration>) |

{% tabs %}
{% tab title="200: OK " %}

```json
{
    "_id": "656748a4f98fe324378ab17c",
    "source": "Zillow",
    "type": "Property Inquiry",
    "message": "I am interested in 6825 Mulholland Dr, ...",
    "description": "Move-in: 12/28/2013",
    "property": {
        "street": "6825 Mulholland Dr",
        "city": "Los Angeles",
        "state": "CA",
        "code": "90068",
        "mlsNumber": "14729339",
        "price": "310000",
        "forRent": "0",
        "url": "http://www.zillow.com/homedetails/6825-Mulholland-Dr-Los-Angeles-CA-90068/2109065822_zpid/",
        "type": "Residential",
        "bedrooms": "0",
        "bathrooms": null,
        "area": null,
        "lot": null
    },
    "pageTitle": null,
    "pageUrl": null,
    "pageDuration": 0,
    "user": "5efe4378d9167f154513e76e",
    "created_at": "2023-11-29T14:20:20.682Z",
    "updated_at": "2023-11-29T14:20:20.682Z",
    "__v": 0
}
```

{% endtab %}
{% endtabs %}
