# Lead Capture API Docs

## Capture leads using a known lead channel ID (webhook).

> Integrate Rechat's lead capture functionality into your website using your \`lead\_channel\` id (which you can get through Rechat's \[\*\*Lead Routing\*\*]\(<https://help.rechat.com/guides/crm/contacts/adding-contacts/lead-routing>) interface).<br>

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"tags":[{"name":"Lead Capture","description":"Integrate Rechat's lead capture functionality into your website."}],"servers":[{"url":"https://api.rechat.com"}],"paths":{"/leads/channels/{lead_channel}/webhook":{"post":{"summary":"Capture leads using a known lead channel ID (webhook).","tags":["Lead Capture"],"parameters":[{"in":"path","name":"lead_channel","schema":{"type":"string","format":"uuid"},"required":true,"description":"Your lead channel ID. This serves as both the endpoint identifier and authentication key.\n"}],"description":"Integrate Rechat's lead capture functionality into your website using your `lead_channel` id (which you can get through Rechat's [**Lead Routing**](https://help.rechat.com/guides/crm/contacts/adding-contacts/lead-routing) interface).\n","requestBody":{"description":"The Rechat API accepts lead data in JSON, XML (LTS format), or URL-encoded formats. For this example, we'll use a JSON payload with the following potential fields, such as those that might be captured in a website form.\n","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LeadCapturePayload"}}}},"operationId":"leadCaptureIntegration","responses":{"200":{"description":"OK","content":{"application/json":{"schema":{"type":"object","properties":{"code":{"type":"string"},"data":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"contact":{"type":"string","format":"uuid"},"lead_channel":{"type":"string","format":"uuid"},"raw_payload":{"type":"object"},"parsed_payload":{"type":"object"},"created_at":{"type":"number","format":"double","description":"Unix timestamp representing creation time, including fractional seconds since the Unix epoch (January 1, 1970 UTC)\n"}}}}}}}},"204":{"description":"Successful operation (no content returned)"}}}}},"components":{"schemas":{"LeadCapturePayload":{"title":"Rechat Lead Capture JSON Payload","type":"object","description":"JSON payload for Rechat's lead capture API. All fields are optional.\n","properties":{"first_name":{"type":"string","description":"Contact's first name"},"last_name":{"type":"string","description":"Contact's last name"},"email":{"type":"string","format":"email","description":"Contact's email address"},"phone_number":{"type":"string","description":"Contact's phone number"},"tag":{"type":"array","items":{"type":"string"},"description":"Array of tags for categorization"},"lead_source":{"type":"string","description":"Source of the lead"},"note":{"type":"string","description":"Additional notes or messages"},"listing":{"$ref":"#/components/schemas/Listing"},"referer_url":{"type":"string","format":"uri","description":"Referring URL"},"assignees":{"type":"array","items":{"$ref":"#/components/schemas/Assignee"},"description":"Array of assignee(s) for the lead"}}},"Listing":{"title":"Listing Information","type":"object","description":"Property listing information associated with the lead","properties":{"price":{"type":"number","description":"Property price"},"mls_number":{"type":"string","description":"MLS listing number"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"property":{"$ref":"#/components/schemas/Property"}}},"Property":{"title":"Property Details","type":"object","description":"Detailed property information","properties":{"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"title":"Address","type":"object","description":"Structured address information for the property","properties":{"street_number":{"type":"string","description":"Street number"},"street_dir_prefix":{"type":"string","description":"Street direction prefix (N, S, E, W)"},"street_name":{"type":"string","description":"Street name"},"street_suffix":{"type":"string","description":"Street suffix (St, Ave, Blvd, etc.)"},"street_dir_suffix":{"type":"string","description":"Street direction suffix (NE, SW, etc.)"},"unit_number":{"type":"string","description":"Unit or apartment number"},"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"Two-letter state code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"country":{"type":"string","description":"Country name"},"direction":{"type":"string","description":"General direction"},"street_address":{"type":"string","description":"Complete street address (auto-generated or manual)"},"full_address":{"type":"string","description":"Complete formatted address (auto-generated or manual)"}}},"Assignee":{"title":"Assignee","type":"object","description":"Agent or team member assigned to the lead","properties":{"email":{"type":"string","format":"email","description":"Assignee's email address"},"phone_number":{"type":"string","description":"Assignee's phone number"},"first_name":{"type":"string","description":"Assignee's first name"},"last_name":{"type":"string","description":"Assignee's last name"},"mls":{"type":"string","description":"MLS board name"},"mls_id":{"type":"string","description":"Assignee's MLS ID"}}}}}}
```

## Post activity to a lead's timeline

> Track contact activities such as viewing listings, creating searches, signing up, and other interactions. This endpoint allows you to post various activity types to a contact's timeline for better engagement tracking.<br>

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"tags":[{"name":"Activity Tracking","description":"Track contact activities and interactions on your website."}],"servers":[{"url":"https://api.rechat.com"}],"paths":{"/leads/{lead_id}/timeline":{"post":{"summary":"Post activity to a lead's timeline","tags":["Activity Tracking"],"parameters":[{"in":"path","name":"lead_id","schema":{"type":"string","format":"uuid"},"required":true,"description":"The UUID of the lead/contact"}],"description":"Track contact activities such as viewing listings, creating searches, signing up, and other interactions. This endpoint allows you to post various activity types to a contact's timeline for better engagement tracking.\n","requestBody":{"description":"Activity data to post to the timeline","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ActivityPayload"}}}},"operationId":"postContactActivity","responses":{"200":{"description":"Activity posted successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}}}}}},"400":{"description":"Bad request - invalid activity type or missing required fields"},"404":{"description":"Lead not found"}}}}},"components":{"schemas":{"ActivityPayload":{"title":"Activity Timeline Payload","type":"object","required":["action"],"description":"Payload for posting activities to a contact's timeline. Different activity types require different fields.\n","properties":{"action":{"type":"string","enum":["ContactViewedListing","ContactSharedListing","ContactFavoritedListing","ContactRemovedFavoriteListing","ContactValuedListing","ContactSignedUp","ContactLoggedIn","ContactCreatedSearch","ContactRemovedSearch","ContactSearchedListings"],"description":"The type of activity being reported"},"listing":{"$ref":"#/components/schemas/ActivityListing"},"search":{"$ref":"#/components/schemas/SearchData"},"notes":{"type":"string","description":"Optional notes about the activity"}}},"ActivityListing":{"title":"Activity Listing Data","type":"object","description":"Listing information for activity tracking. Required for listing-related activities (ContactViewedListing, ContactSharedListing, etc.)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the listing page"},"mls_number":{"type":"string","description":"MLS listing number"},"mls":{"type":"string","description":"MLS board identifier"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"price":{"type":"number","description":"Property price"},"property":{"type":"object","properties":{"address":{"type":"object","properties":{"street_address":{"type":"string","description":"Street address of the property"}}}}}}},"SearchData":{"title":"Search Data","type":"object","description":"Search criteria information. Required for search-related activities (ContactCreatedSearch, ContactRemovedSearch, ContactSearchedListings)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the saved search"},"title":{"type":"string","description":"Title or name of the saved search"},"minimum_bedrooms":{"type":"number","description":"Minimum number of bedrooms"},"maximum_bedrooms":{"type":"number","description":"Maximum number of bedrooms"},"minimum_bathrooms":{"type":"number","description":"Minimum number of bathrooms"},"maximum_bathrooms":{"type":"number","description":"Maximum number of bathrooms"},"minimum_price":{"type":"number","description":"Minimum price filter"},"maximum_price":{"type":"number","description":"Maximum price filter"},"property_types":{"type":"array","items":{"type":"string"},"description":"Array of property types"},"pool":{"type":"boolean","description":"Whether pool is required"}}}}}}
```

## Reassign a lead to different agents or team members

> Reassign an existing lead to different agents or team members. This endpoint updates the assignees for a lead, replacing the current assignees with the new ones provided in the request body.<br>

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"tags":[{"name":"Lead Capture","description":"Integrate Rechat's lead capture functionality into your website."}],"servers":[{"url":"https://api.rechat.com"}],"paths":{"/leads/{lead_id}/assignees":{"put":{"summary":"Reassign a lead to different agents or team members","tags":["Lead Capture"],"parameters":[{"in":"path","name":"lead_id","schema":{"type":"string","format":"uuid"},"required":true,"description":"The UUID of the lead/contact to reassign"}],"description":"Reassign an existing lead to different agents or team members. This endpoint updates the assignees for a lead, replacing the current assignees with the new ones provided in the request body.\n","requestBody":{"description":"Array of assignees to assign to the lead","required":true,"content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Assignee"}}}}},"operationId":"reassignLead","responses":{"200":{"description":"Lead reassigned successfully","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"},"message":{"type":"string"}}}}}},"400":{"description":"Bad request - invalid assignee data or missing required fields"},"404":{"description":"Lead not found"}}}}},"components":{"schemas":{"Assignee":{"title":"Assignee","type":"object","description":"Agent or team member assigned to the lead","properties":{"email":{"type":"string","format":"email","description":"Assignee's email address"},"phone_number":{"type":"string","description":"Assignee's phone number"},"first_name":{"type":"string","description":"Assignee's first name"},"last_name":{"type":"string","description":"Assignee's last name"},"mls":{"type":"string","description":"MLS board name"},"mls_id":{"type":"string","description":"Assignee's MLS ID"}}}}}}
```

## The LeadCapturePayload object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"LeadCapturePayload":{"title":"Rechat Lead Capture JSON Payload","type":"object","description":"JSON payload for Rechat's lead capture API. All fields are optional.\n","properties":{"first_name":{"type":"string","description":"Contact's first name"},"last_name":{"type":"string","description":"Contact's last name"},"email":{"type":"string","format":"email","description":"Contact's email address"},"phone_number":{"type":"string","description":"Contact's phone number"},"tag":{"type":"array","items":{"type":"string"},"description":"Array of tags for categorization"},"lead_source":{"type":"string","description":"Source of the lead"},"note":{"type":"string","description":"Additional notes or messages"},"listing":{"$ref":"#/components/schemas/Listing"},"referer_url":{"type":"string","format":"uri","description":"Referring URL"},"assignees":{"type":"array","items":{"$ref":"#/components/schemas/Assignee"},"description":"Array of assignee(s) for the lead"}}},"Listing":{"title":"Listing Information","type":"object","description":"Property listing information associated with the lead","properties":{"price":{"type":"number","description":"Property price"},"mls_number":{"type":"string","description":"MLS listing number"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"property":{"$ref":"#/components/schemas/Property"}}},"Property":{"title":"Property Details","type":"object","description":"Detailed property information","properties":{"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"title":"Address","type":"object","description":"Structured address information for the property","properties":{"street_number":{"type":"string","description":"Street number"},"street_dir_prefix":{"type":"string","description":"Street direction prefix (N, S, E, W)"},"street_name":{"type":"string","description":"Street name"},"street_suffix":{"type":"string","description":"Street suffix (St, Ave, Blvd, etc.)"},"street_dir_suffix":{"type":"string","description":"Street direction suffix (NE, SW, etc.)"},"unit_number":{"type":"string","description":"Unit or apartment number"},"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"Two-letter state code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"country":{"type":"string","description":"Country name"},"direction":{"type":"string","description":"General direction"},"street_address":{"type":"string","description":"Complete street address (auto-generated or manual)"},"full_address":{"type":"string","description":"Complete formatted address (auto-generated or manual)"}}},"Assignee":{"title":"Assignee","type":"object","description":"Agent or team member assigned to the lead","properties":{"email":{"type":"string","format":"email","description":"Assignee's email address"},"phone_number":{"type":"string","description":"Assignee's phone number"},"first_name":{"type":"string","description":"Assignee's first name"},"last_name":{"type":"string","description":"Assignee's last name"},"mls":{"type":"string","description":"MLS board name"},"mls_id":{"type":"string","description":"Assignee's MLS ID"}}}}}}
```

## The Listing object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"Listing":{"title":"Listing Information","type":"object","description":"Property listing information associated with the lead","properties":{"price":{"type":"number","description":"Property price"},"mls_number":{"type":"string","description":"MLS listing number"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"property":{"$ref":"#/components/schemas/Property"}}},"Property":{"title":"Property Details","type":"object","description":"Detailed property information","properties":{"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"title":"Address","type":"object","description":"Structured address information for the property","properties":{"street_number":{"type":"string","description":"Street number"},"street_dir_prefix":{"type":"string","description":"Street direction prefix (N, S, E, W)"},"street_name":{"type":"string","description":"Street name"},"street_suffix":{"type":"string","description":"Street suffix (St, Ave, Blvd, etc.)"},"street_dir_suffix":{"type":"string","description":"Street direction suffix (NE, SW, etc.)"},"unit_number":{"type":"string","description":"Unit or apartment number"},"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"Two-letter state code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"country":{"type":"string","description":"Country name"},"direction":{"type":"string","description":"General direction"},"street_address":{"type":"string","description":"Complete street address (auto-generated or manual)"},"full_address":{"type":"string","description":"Complete formatted address (auto-generated or manual)"}}}}}}
```

## The Property object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"Property":{"title":"Property Details","type":"object","description":"Detailed property information","properties":{"address":{"$ref":"#/components/schemas/Address"}}},"Address":{"title":"Address","type":"object","description":"Structured address information for the property","properties":{"street_number":{"type":"string","description":"Street number"},"street_dir_prefix":{"type":"string","description":"Street direction prefix (N, S, E, W)"},"street_name":{"type":"string","description":"Street name"},"street_suffix":{"type":"string","description":"Street suffix (St, Ave, Blvd, etc.)"},"street_dir_suffix":{"type":"string","description":"Street direction suffix (NE, SW, etc.)"},"unit_number":{"type":"string","description":"Unit or apartment number"},"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"Two-letter state code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"country":{"type":"string","description":"Country name"},"direction":{"type":"string","description":"General direction"},"street_address":{"type":"string","description":"Complete street address (auto-generated or manual)"},"full_address":{"type":"string","description":"Complete formatted address (auto-generated or manual)"}}}}}}
```

## The Address object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"Address":{"title":"Address","type":"object","description":"Structured address information for the property","properties":{"street_number":{"type":"string","description":"Street number"},"street_dir_prefix":{"type":"string","description":"Street direction prefix (N, S, E, W)"},"street_name":{"type":"string","description":"Street name"},"street_suffix":{"type":"string","description":"Street suffix (St, Ave, Blvd, etc.)"},"street_dir_suffix":{"type":"string","description":"Street direction suffix (NE, SW, etc.)"},"unit_number":{"type":"string","description":"Unit or apartment number"},"city":{"type":"string","description":"City name"},"state_code":{"type":"string","description":"Two-letter state code"},"postal_code":{"type":"string","description":"Postal/ZIP code"},"country":{"type":"string","description":"Country name"},"direction":{"type":"string","description":"General direction"},"street_address":{"type":"string","description":"Complete street address (auto-generated or manual)"},"full_address":{"type":"string","description":"Complete formatted address (auto-generated or manual)"}}}}}}
```

## The Assignee object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"Assignee":{"title":"Assignee","type":"object","description":"Agent or team member assigned to the lead","properties":{"email":{"type":"string","format":"email","description":"Assignee's email address"},"phone_number":{"type":"string","description":"Assignee's phone number"},"first_name":{"type":"string","description":"Assignee's first name"},"last_name":{"type":"string","description":"Assignee's last name"},"mls":{"type":"string","description":"MLS board name"},"mls_id":{"type":"string","description":"Assignee's MLS ID"}}}}}}
```

## The ActivityPayload object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"ActivityPayload":{"title":"Activity Timeline Payload","type":"object","required":["action"],"description":"Payload for posting activities to a contact's timeline. Different activity types require different fields.\n","properties":{"action":{"type":"string","enum":["ContactViewedListing","ContactSharedListing","ContactFavoritedListing","ContactRemovedFavoriteListing","ContactValuedListing","ContactSignedUp","ContactLoggedIn","ContactCreatedSearch","ContactRemovedSearch","ContactSearchedListings"],"description":"The type of activity being reported"},"listing":{"$ref":"#/components/schemas/ActivityListing"},"search":{"$ref":"#/components/schemas/SearchData"},"notes":{"type":"string","description":"Optional notes about the activity"}}},"ActivityListing":{"title":"Activity Listing Data","type":"object","description":"Listing information for activity tracking. Required for listing-related activities (ContactViewedListing, ContactSharedListing, etc.)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the listing page"},"mls_number":{"type":"string","description":"MLS listing number"},"mls":{"type":"string","description":"MLS board identifier"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"price":{"type":"number","description":"Property price"},"property":{"type":"object","properties":{"address":{"type":"object","properties":{"street_address":{"type":"string","description":"Street address of the property"}}}}}}},"SearchData":{"title":"Search Data","type":"object","description":"Search criteria information. Required for search-related activities (ContactCreatedSearch, ContactRemovedSearch, ContactSearchedListings)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the saved search"},"title":{"type":"string","description":"Title or name of the saved search"},"minimum_bedrooms":{"type":"number","description":"Minimum number of bedrooms"},"maximum_bedrooms":{"type":"number","description":"Maximum number of bedrooms"},"minimum_bathrooms":{"type":"number","description":"Minimum number of bathrooms"},"maximum_bathrooms":{"type":"number","description":"Maximum number of bathrooms"},"minimum_price":{"type":"number","description":"Minimum price filter"},"maximum_price":{"type":"number","description":"Maximum price filter"},"property_types":{"type":"array","items":{"type":"string"},"description":"Array of property types"},"pool":{"type":"boolean","description":"Whether pool is required"}}}}}}
```

## The ActivityListing object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"ActivityListing":{"title":"Activity Listing Data","type":"object","description":"Listing information for activity tracking. Required for listing-related activities (ContactViewedListing, ContactSharedListing, etc.)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the listing page"},"mls_number":{"type":"string","description":"MLS listing number"},"mls":{"type":"string","description":"MLS board identifier"},"cover_image_url":{"type":"string","format":"uri","description":"URL to the listing's cover image"},"price":{"type":"number","description":"Property price"},"property":{"type":"object","properties":{"address":{"type":"object","properties":{"street_address":{"type":"string","description":"Street address of the property"}}}}}}}}}}
```

## The SearchData object

```json
{"openapi":"3.0.3","info":{"title":"Rechat Lead Capture API","version":"latest"},"components":{"schemas":{"SearchData":{"title":"Search Data","type":"object","description":"Search criteria information. Required for search-related activities (ContactCreatedSearch, ContactRemovedSearch, ContactSearchedListings)\n","properties":{"url":{"type":"string","format":"uri","description":"URL to the saved search"},"title":{"type":"string","description":"Title or name of the saved search"},"minimum_bedrooms":{"type":"number","description":"Minimum number of bedrooms"},"maximum_bedrooms":{"type":"number","description":"Maximum number of bedrooms"},"minimum_bathrooms":{"type":"number","description":"Minimum number of bathrooms"},"maximum_bathrooms":{"type":"number","description":"Maximum number of bathrooms"},"minimum_price":{"type":"number","description":"Minimum price filter"},"maximum_price":{"type":"number","description":"Maximum price filter"},"property_types":{"type":"array","items":{"type":"string"},"description":"Array of property types"},"pool":{"type":"boolean","description":"Whether pool is required"}}}}}}
```
