# Structurely Direct v2

## Overview

The Structurely API allows integrators to provide automation for their accounts. It offers various functionalities to streamline lead management, messaging, lead qualification conversations, and retrieval of metadata.

The Structurely API simplifies the integration process and removes the necessity to track additional fields in your system. It is specifically designed to utilize **your system's IDs** as internal keys, enabling you to seamlessly use IDs from your CRM or database as parameters, such as externalLeadId, and externalMessageId.

By utilizing this API, integrators can streamline their workflows, activate enhanced AI qualification conversations, and gain valuable insights into their accounts, leads, and conversations.

### Security

The Structurely API provides secure authentication and authorization mechanisms to ensure controlled access to its endpoints. The authentication system utilizes API tokens to secure interactions with the API.

Types of tokens and keys:

  
- bearer-access-token: Bearer JWT; **valid until deactivated**

**Note:** It is essential to keep your bearer-access-tokens secure and avoid sharing them with unauthorized parties to maintain the integrity and security of your Structurely API integration.

Version: `v3.35.20`

## Leads

- [GET /api/direct/v2/leads](/api/direct/v2/leads/get.md)
- [POST /api/direct/v2/leads](/api/direct/v2/leads/post.md)
- [POST /api/direct/v2/leads/bulk](/api/direct/v2/leads/bulk/post.md)
- [POST /api/direct/v2/leads/start](/api/direct/v2/leads/start/post.md)
- [GET /api/direct/v2/leads/{leadId}](/api/direct/v2/leads/{leadId}/get.md)
- [PATCH /api/direct/v2/leads/{leadId}](/api/direct/v2/leads/{leadId}/patch.md)
- [POST /api/direct/v2/leads/{leadId}/mute](/api/direct/v2/leads/{leadId}/mute/post.md)
- [POST /api/direct/v2/leads/{leadId}/unmute](/api/direct/v2/leads/{leadId}/unmute/post.md)
- [PATCH /api/direct/v2/leads/{leadId}/assign-agent](/api/direct/v2/leads/{leadId}/assign-agent/patch.md)
- [GET /api/direct/v2/leads/recent-activity](/api/direct/v2/leads/recent-activity/get.md)

### GET /api/direct/v2/leads

[GET /api/direct/v2/leads](/api/direct/v2/leads/get.md)

**Summary:** List leads

**Description:**

List non-archived leads using updatedAt and cursor-based pagination.

#### Parameters

- `updatedAt` (query, required: no)
  - Inclusive lower bound for lead last contact time (ISO-8601). Required when cursor is not provided.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```
- `limit` (query, required: no)
  - Number of leads to return. Defaults to 50. Must be between 1 and 100.
  - Schema:
    ```json
    {
      "type": "integer"
    }
    ```
- `cursor` (query, required: no)
  - Cursor from a previous response.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```

#### Responses

- `200`: Paginated lead results
  - Schema: `LeadListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "description": "Paginated leads for incremental sync.",
        "items": {
          "$ref": "#/components/schemas/Lead"
        }
      },
      "cursor": {
        "type": "string",
        "description": "Pagination cursor for the next page.",
        "nullable": true
      },
      "next": {
        "type": "string",
        "description": "Fully-qualified URL for the next page.",
        "nullable": true
      }
    },
    "required": [
      "items"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X GET 'https://client.structurely.com/api/direct/v2/leads' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/leads

[POST /api/direct/v2/leads](/api/direct/v2/leads/post.md)

**Summary:** Create a lead, this does not start a conversation

**Description:**

This endpoint will create a lead if it does not exist.

This action will **not** start a conversation.

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- externalLeadId: The Lead's ID from your CRM or database

#### Request body

New lead metadata

Schema: `CreateLead`

```json
{
  "type": "object",
  "properties": {
    "externalLeadId": {
      "type": "string",
      "description": "The ID for this lead in your CRM or database",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name for this lead",
      "example": "Jane Doe"
    },
    "email": {
      "type": "string",
      "example": "jane.doe@example.com"
    },
    "phone": {
      "type": "string",
      "description": "Lead's phone number, E.164 or number with area code",
      "example": "(303) 555-5555"
    },
    "source": {
      "type": "string",
      "default": "Unknown",
      "description": "The vendor that sourced this lead (or website)",
      "example": "www.shiny-leads-vendor.com"
    },
    "properties": {
      "example": {},
      "description": "Properties that are known about the lead, may be used in responses, may be confirmed or skipped in scripting.",
      "allOf": [
        {
          "$ref": "#/components/schemas/Properties"
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. During normalization, datetimes are converted to UTC ISO-8601 strings and entries with blank keys, unsupported value types, or mixed-type arrays are dropped.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/IntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "assignAgent": {
      "description": "Optional agent assignment details for the lead",
      "example": {
        "agentId": "650ba6ced07cb5552a2467b0"
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/AssignAgent"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

#### Responses

- `200`: Newly created lead
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X POST 'https://client.structurely.com/api/direct/v2/leads' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### POST /api/direct/v2/leads/bulk

[POST /api/direct/v2/leads/bulk](/api/direct/v2/leads/bulk/post.md)

**Summary:** Enroll leads in bulk, starting a conversation for each

**Description:**

Enroll leads in bulk, using the Structurely bulk API to maintain a safe enrollment rate.

#### Request body

Bulk lead enrollment request payload

Schema: `BulkLeadEnrollmentRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Optional list name. Defaults to 'Bulk Enrollment <timestamp>' when empty.",
      "example": "Q2 Imported Leads",
      "nullable": true
    },
    "script": {
      "type": "string",
      "example": "buyer",
      "description": "The script or usecase that will be used to communicate with this lead"
    },
    "leads": {
      "type": "array",
      "description": "Lead payloads equivalent to CreateLead payload objects.",
      "items": {
        "$ref": "#/components/schemas/CreateLead"
      }
    }
  },
  "required": [
    "leads",
    "script"
  ]
}
```

#### Responses

- `200`: Created lead list and summary counters
  - Schema: `BulkLeadEnrollmentResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The created LeadList ID.",
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "description": "The created LeadList name."
      },
      "summary": {
        "description": "Bulk enrollment list summary counters.",
        "allOf": [
          {
            "$ref": "#/components/schemas/BulkLeadEnrollmentSummary"
          }
        ]
      }
    },
    "required": [
      "id",
      "name",
      "summary"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X POST 'https://client.structurely.com/api/direct/v2/leads/bulk' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "leads": [],
  "script": "buyer"
}'
```

### POST /api/direct/v2/leads/start

[POST /api/direct/v2/leads/start](/api/direct/v2/leads/start/post.md)

**Summary:** Start a new conversation for a lead, create one if it does not exist

**Description:**

This endpoint will create a lead if it does not exist.

This action will stop all prior conversations with this lead.

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- externalLeadId: The Lead's ID from your CRM or database

#### Request body

New conversation + lead metadata

Schema: `StartConversation`

```json
{
  "type": "object",
  "properties": {
    "externalLeadId": {
      "type": "string",
      "description": "The ID for this lead in your CRM or database",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name for this lead",
      "example": "Jane Doe"
    },
    "email": {
      "type": "string",
      "example": "jane.doe@example.com"
    },
    "phone": {
      "type": "string",
      "description": "Lead's phone number, E.164 or number with area code",
      "example": "(303) 555-5555"
    },
    "source": {
      "type": "string",
      "default": "Unknown",
      "description": "The vendor that sourced this lead (or website)",
      "example": "www.shiny-leads-vendor.com"
    },
    "properties": {
      "example": {},
      "description": "Properties that are known about the lead, may be used in responses, may be confirmed or skipped in scripting.",
      "allOf": [
        {
          "$ref": "#/components/schemas/Properties"
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. During normalization, datetimes are converted to UTC ISO-8601 strings and entries with blank keys, unsupported value types, or mixed-type arrays are dropped.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/IntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "assignAgent": {
      "description": "Optional agent assignment details for the lead",
      "example": {
        "agentId": "650ba6ced07cb5552a2467b0"
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/AssignAgent"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "script": {
      "type": "string",
      "example": "buyer",
      "description": "The script or usecase that will be used to communicate with this lead"
    },
    "testPayloadClearDupeLeads": {
      "type": "boolean",
      "default": false,
      "description": "Only set this field during testing, it will automatically clear the phone, email, and externalLeadId for any lead enrolled with the same values.",
      "example": false,
      "nullable": true
    },
    "messages": {
      "type": "array",
      "description": "Optional historical messages to persist for a newly created lead.",
      "example": [
        {
          "channel": "sms",
          "messageId": "d645fca8-762f-46ca-b244-ed4ba244f335",
          "vendorName": "twilio",
          "isOutbound": false,
          "receivedAt": "2026-09-09T04:13:17.037148+00:00",
          "content": "Hello there!",
          "subject": null
        }
      ],
      "items": {
        "$ref": "#/components/schemas/StartConversationMessage"
      },
      "nullable": true
    }
  },
  "required": [
    "script"
  ]
}
```

#### Responses

- `200`: Newly created lead
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X POST 'https://client.structurely.com/api/direct/v2/leads/start' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "script": "buyer"
}'
```

### GET /api/direct/v2/leads/{leadId}

[GET /api/direct/v2/leads/{leadId}](/api/direct/v2/leads/{leadId}/get.md)

**Summary:** Retrieve a lead

**Description:**

Retrieve a lead from Structurely

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- leadId: The Lead's ID from your CRM or database

#### Parameters

- `leadId` (path, required: yes)
  - The Lead's ID, either the Structurely Lead ID, or the externalLeadId you used when creating the lead.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: Successful response, the lead's metadata
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `404`: Resource was not found, check response message
  - Schema: `NotFound`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Lead not found"
      },
      "statusCode": {
        "type": "number",
        "example": 404
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X GET 'https://client.structurely.com/api/direct/v2/leads/{leadId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### PATCH /api/direct/v2/leads/{leadId}

[PATCH /api/direct/v2/leads/{leadId}](/api/direct/v2/leads/{leadId}/patch.md)

**Summary:** Update lead metadata

**Description:**

Patch lead metadata after enrollment. Supports top-level fields name, externalLeadId, properties, customProperties, and integrations. Top-level email and phone fields are rejected.

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- leadId: The Lead's ID from your CRM or database

#### Parameters

- `leadId` (path, required: yes)
  - The Lead's ID, either the Structurely Lead ID, or the externalLeadId you used when creating the lead.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Lead patch payload

Schema: `PatchLead`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Updated lead name",
      "example": "Jane Doe",
      "nullable": true
    },
    "externalLeadId": {
      "type": "string",
      "description": "Updated external lead identifier",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "properties": {
      "example": {
        "timeframe": "soon",
        "priceMin": 250000
      },
      "description": "Properties to update for an enrolled lead. Omitted keys are unchanged. Keys explicitly set to null are cleared.",
      "anyOf": [
        {
          "$ref": "#/components/schemas/Properties"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. Entries explicitly set to null clear those custom properties. When both properties.customProperties and customProperties are provided, top-level customProperties takes precedence. Keys with unsupported values or mixed-type arrays are dropped during normalization.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata updates. Omitted integration sources are unchanged. A source set to null clears that source.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchIntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

#### Responses

- `200`: Updated lead metadata
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `404`: Resource was not found, check response message
  - Schema: `NotFound`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Lead not found"
      },
      "statusCode": {
        "type": "number",
        "example": 404
      }
    }
  }
  ```
- `409`: Lead update conflict, retry request
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X PATCH 'https://client.structurely.com/api/direct/v2/leads/{leadId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### POST /api/direct/v2/leads/{leadId}/mute

[POST /api/direct/v2/leads/{leadId}/mute](/api/direct/v2/leads/{leadId}/mute/post.md)

**Summary:** Mute the AI for a lead

**Description:**

Mute the AI for a lead

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- leadId: The Lead's ID from your CRM or database

#### Parameters

- `leadId` (path, required: yes)
  - The Lead's ID, either the Structurely Lead ID, or the externalLeadId you used when creating the lead.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Optional channels to mute or unmute. Omit to apply both Text and Voice.

Schema: `MuteChannelsRequest`

```json
{
  "type": "object",
  "properties": {
    "channels": {
      "type": "array",
      "minItems": 1,
      "description": "Channels to mute or unmute. Omit to apply both Text and Voice. Allowed values: Text, Voice.",
      "example": [
        "Text",
        "Voice"
      ],
      "items": {
        "type": "string",
        "enum": [
          "Text",
          "Voice"
        ]
      }
    }
  }
}
```

#### Responses

- `200`: Updated lead metadata
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `404`: Resource was not found, check response message
  - Schema: `NotFound`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Lead not found"
      },
      "statusCode": {
        "type": "number",
        "example": 404
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X POST 'https://client.structurely.com/api/direct/v2/leads/{leadId}/mute' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### POST /api/direct/v2/leads/{leadId}/unmute

[POST /api/direct/v2/leads/{leadId}/unmute](/api/direct/v2/leads/{leadId}/unmute/post.md)

**Summary:** Unmute the AI for a lead

**Description:**

Unmute the AI for a lead

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- leadId: The Lead's ID from your CRM or database

#### Parameters

- `leadId` (path, required: yes)
  - The Lead's ID, either the Structurely Lead ID, or the externalLeadId you used when creating the lead.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Optional channels to mute or unmute. Omit to apply both Text and Voice.

Schema: `MuteChannelsRequest`

```json
{
  "type": "object",
  "properties": {
    "channels": {
      "type": "array",
      "minItems": 1,
      "description": "Channels to mute or unmute. Omit to apply both Text and Voice. Allowed values: Text, Voice.",
      "example": [
        "Text",
        "Voice"
      ],
      "items": {
        "type": "string",
        "enum": [
          "Text",
          "Voice"
        ]
      }
    }
  }
}
```

#### Responses

- `200`: Updated lead metadata
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `404`: Resource was not found, check response message
  - Schema: `NotFound`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Lead not found"
      },
      "statusCode": {
        "type": "number",
        "example": 404
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X POST 'https://client.structurely.com/api/direct/v2/leads/{leadId}/unmute' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### PATCH /api/direct/v2/leads/{leadId}/assign-agent

[PATCH /api/direct/v2/leads/{leadId}/assign-agent](/api/direct/v2/leads/{leadId}/assign-agent/patch.md)

**Summary:** Assign an agent to a lead

**Description:**

Assign an agent to a lead

Optionally utilize your system's IDs as internal keys, pass IDs from your CRM or database as parameters for:
- leadId: The Lead's ID from your CRM or database
- externalMessageId: The Message's ID from your CRM or database

#### Parameters

- `leadId` (path, required: yes)
  - The Lead's ID, either the Structurely Lead ID, or the externalLeadId you used when creating the lead.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        },
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Agent to assign

Schema: `AssignAgent`

```json
{
  "type": "object",
  "properties": {
    "agentId": {
      "description": "The ID of the agent to assign in Structurely.",
      "example": "650ba6ced07cb5552a2467b0",
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name of the agent to assign.",
      "example": "John Agent",
      "nullable": true
    },
    "email": {
      "type": "string",
      "description": "Email of the agent to assign.",
      "example": "john.agent@example.com",
      "nullable": true
    },
    "phone": {
      "type": "string",
      "description": "Phone number of the agent to assign (E.164 or number with area code).",
      "example": "+13035551234",
      "nullable": true
    }
  }
}
```

#### Responses

- `200`: Updated lead metadata
  - Schema: `Lead`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this lead in Structurely",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optionally provide the ID for this lead in your CRM or database",
        "example": "b6726f23-1440-4206-962f-8c429f61714c",
        "nullable": true
      },
      "name": {
        "type": "string",
        "example": "Jane Doe"
      },
      "email": {
        "type": "string",
        "example": "jane.doe@example.com"
      },
      "phone": {
        "type": "string",
        "description": "E.164 formatted number",
        "example": "+13035555555"
      },
      "muted": {
        "type": "boolean",
        "example": false
      },
      "voiceMuted": {
        "type": "boolean",
        "description": "Whether Voice AI is muted for this lead.",
        "example": false
      },
      "stages": {
        "type": "array",
        "example": [
          "needs_followup"
        ],
        "items": {
          "type": "string"
        }
      },
      "properties": {
        "example": {
          "address": "12345 Deckawoo Dr, Denver, CO, 80132"
        },
        "description": "Properties that are known about the lead.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Properties"
          }
        ]
      },
      "customProperties": {
        "type": "object",
        "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
        "example": {
          "birthday": "2026-01-01T00:00:00Z",
          "marketingOptIn": true,
          "preferredContactDays": [
            "monday",
            "friday"
          ]
        },
        "additionalProperties": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "string"
            },
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "boolean"
            },
            {
              "type": "array",
              "items": {
                "type": "number"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "string",
                "format": "date-time"
              }
            },
            {
              "type": "array",
              "items": {
                "type": "boolean"
              }
            }
          ]
        }
      }
    },
    "required": [
      "customProperties",
      "voiceMuted"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `404`: Resource was not found, check response message
  - Schema: `NotFound`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Lead not found"
      },
      "statusCode": {
        "type": "number",
        "example": 404
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X PATCH 'https://client.structurely.com/api/direct/v2/leads/{leadId}/assign-agent' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### GET /api/direct/v2/leads/recent-activity

[GET /api/direct/v2/leads/recent-activity](/api/direct/v2/leads/recent-activity/get.md)

**Summary:** List appointment and callback recent activity

**Description:**

List appointment and callback recent activity for the authenticated account. Requires read:conversations or write:conversations. Initial requests must include createdAt, an inclusive lower bound on activity ObjectId creation time. Continuation requests must include only cursor and may include limit; do not send createdAt or activityTypes with a cursor. Results are ordered oldest first.

#### Parameters

- `createdAt` (query, required: no)
  - Required for an initial request. ISO-8601 inclusive lower bound on activity ObjectId creation time. Naive values are interpreted as UTC and values must be within the last 14 days.
  - Schema:
    ```json
    {
      "format": "date-time",
      "type": "string"
    }
    ```
- `activityTypes` (query, required: no)
  - Optional initial-request filter. Repeat this parameter for each selected type; omitting it returns only APPOINTMENT_SET activities.
  - Schema:
    ```json
    {
      "default": [
        "APPOINTMENT_SET"
      ],
      "items": {
        "enum": [
          "APPOINTMENT_SET",
          "CALLBACK_SCHEDULED"
        ],
        "type": "string"
      },
      "type": "array"
    }
    ```
- `limit` (query, required: no)
  - Number of activities to return. Defaults to 50 and must be between 1 and 100.
  - Schema:
    ```json
    {
      "default": 50,
      "maximum": 100,
      "minimum": 1,
      "type": "integer"
    }
    ```
- `cursor` (query, required: no)
  - Required for a continuation request. Opaque cursor from a previous response; cannot be combined with createdAt or activityTypes.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```

#### Responses

- `200`: Oldest-first, cursor-paginated recent activity for the authenticated account.
  - Schema: `RecentActivityListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "description": "Oldest-first, cursor-paginated recent activity records.",
        "items": {
          "$ref": "#/components/schemas/RecentActivity"
        }
      },
      "cursor": {
        "type": "string",
        "description": "Opaque cursor for the next page, or null when complete.",
        "nullable": true
      },
      "next": {
        "type": "string",
        "description": "Fully-qualified URL for the next page, or null when complete.",
        "nullable": true
      }
    },
    "required": [
      "cursor",
      "items",
      "next"
    ]
  }
  ```
- `400`: Invalid request, check response message
  - Schema: `InvalidRequest`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "The parameter leadId must be provided"
      },
      "statusCode": {
        "type": "number",
        "example": 400
      }
    }
  }
  ```
- `401`: Request is not authorized
  - Schema: `NotAuthorized`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Access Token is not authorized"
      },
      "statusCode": {
        "type": "number",
        "example": 401
      }
    }
  }
  ```
- `500`: Internal server error, check response message
  - Schema: `InternalServerError`
  ```json
  {
    "type": "object",
    "properties": {
      "message": {
        "type": "string",
        "description": "A message describing the error",
        "example": "Internal server error"
      },
      "statusCode": {
        "type": "number",
        "example": 500
      }
    }
  }
  ```

#### Security

- `bearer-access-token`

#### Example request

```bash
curl -sS -X GET 'https://client.structurely.com/api/direct/v2/leads/recent-activity' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Schemas

### `AcculynxIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "Acculynx Contact ID",
      "example": "12345"
    },
    "jobId": {
      "type": "string",
      "description": "Acculynx Job ID",
      "example": "67890"
    },
    "appointmentId": {
      "type": "string",
      "description": "Acculynx Appointment ID",
      "example": "54321",
      "nullable": true
    }
  },
  "required": [
    "contactId",
    "jobId"
  ]
}
```

### `AgentLegendIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "type": "integer",
      "description": "Agent Legend Prospect ID",
      "example": 12345
    }
  },
  "required": [
    "prospectId"
  ]
}
```

### `AssignAgent`

```json
{
  "type": "object",
  "properties": {
    "agentId": {
      "description": "The ID of the agent to assign in Structurely.",
      "example": "650ba6ced07cb5552a2467b0",
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name of the agent to assign.",
      "example": "John Agent",
      "nullable": true
    },
    "email": {
      "type": "string",
      "description": "Email of the agent to assign.",
      "example": "john.agent@example.com",
      "nullable": true
    },
    "phone": {
      "type": "string",
      "description": "Phone number of the agent to assign (E.164 or number with area code).",
      "example": "+13035551234",
      "nullable": true
    }
  }
}
```

### `BonzoIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "type": "integer",
      "description": "Bonzo Prospect ID",
      "example": 12345
    }
  },
  "required": [
    "prospectId"
  ]
}
```

### `BoomTownIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "BoomTown Contact ID",
      "example": "12345"
    }
  },
  "required": [
    "contactId"
  ]
}
```

### `BulkLeadEnrollmentRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Optional list name. Defaults to 'Bulk Enrollment <timestamp>' when empty.",
      "example": "Q2 Imported Leads",
      "nullable": true
    },
    "script": {
      "type": "string",
      "example": "buyer",
      "description": "The script or usecase that will be used to communicate with this lead"
    },
    "leads": {
      "type": "array",
      "description": "Lead payloads equivalent to CreateLead payload objects.",
      "items": {
        "$ref": "#/components/schemas/CreateLead"
      }
    }
  },
  "required": [
    "leads",
    "script"
  ]
}
```

### `BulkLeadEnrollmentResponse`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "The created LeadList ID.",
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "description": "The created LeadList name."
    },
    "summary": {
      "description": "Bulk enrollment list summary counters.",
      "allOf": [
        {
          "$ref": "#/components/schemas/BulkLeadEnrollmentSummary"
        }
      ]
    }
  },
  "required": [
    "id",
    "name",
    "summary"
  ]
}
```

### `BulkLeadEnrollmentSummary`

```json
{
  "type": "object",
  "properties": {
    "totalItems": {
      "type": "integer",
      "description": "Total lead items received in this bulk request."
    },
    "remainingItems": {
      "type": "integer",
      "description": "Lead items pending ingestion processing."
    },
    "finishedItems": {
      "type": "integer",
      "description": "Lead items already processed successfully."
    },
    "failedItems": {
      "type": "integer",
      "description": "Lead items rejected as invalid payloads."
    },
    "duplicateItems": {
      "type": "integer",
      "description": "Lead items marked duplicate and skipped."
    }
  },
  "required": [
    "duplicateItems",
    "failedItems",
    "finishedItems",
    "remainingItems",
    "totalItems"
  ]
}
```

### `CreateLead`

```json
{
  "type": "object",
  "properties": {
    "externalLeadId": {
      "type": "string",
      "description": "The ID for this lead in your CRM or database",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name for this lead",
      "example": "Jane Doe"
    },
    "email": {
      "type": "string",
      "example": "jane.doe@example.com"
    },
    "phone": {
      "type": "string",
      "description": "Lead's phone number, E.164 or number with area code",
      "example": "(303) 555-5555"
    },
    "source": {
      "type": "string",
      "default": "Unknown",
      "description": "The vendor that sourced this lead (or website)",
      "example": "www.shiny-leads-vendor.com"
    },
    "properties": {
      "example": {},
      "description": "Properties that are known about the lead, may be used in responses, may be confirmed or skipped in scripting.",
      "allOf": [
        {
          "$ref": "#/components/schemas/Properties"
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. During normalization, datetimes are converted to UTC ISO-8601 strings and entries with blank keys, unsupported value types, or mixed-type arrays are dropped.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/IntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "assignAgent": {
      "description": "Optional agent assignment details for the lead",
      "example": {
        "agentId": "650ba6ced07cb5552a2467b0"
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/AssignAgent"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

### `FollowUpBossIntegration`

```json
{
  "type": "object",
  "properties": {
    "personId": {
      "type": "string",
      "description": "Follow Up Boss Person ID",
      "example": "12345"
    }
  },
  "required": [
    "personId"
  ]
}
```

### `GoHighLevelIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "GoHighLevel Contact ID",
      "example": "12345"
    },
    "locationId": {
      "type": "string",
      "description": "GoHighLevel Location ID",
      "example": "67890",
      "nullable": true
    }
  },
  "required": [
    "contactId"
  ]
}
```

### `HubSpotIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "HubSpot Contact ID",
      "example": "12345"
    }
  },
  "required": [
    "contactId"
  ]
}
```

### `IntegrationMetadata`

```json
{
  "type": "object",
  "properties": {
    "salesforce": {
      "description": "Salesforce integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/SalesforceIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "bonzo": {
      "description": "Bonzo integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/BonzoIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "hubspot": {
      "description": "HubSpot integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/HubSpotIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "followupboss": {
      "description": "Follow Up Boss integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/FollowUpBossIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "acculynx": {
      "description": "Acculynx integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/AcculynxIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "boomtown": {
      "description": "BoomTown integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/BoomTownIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadperfection": {
      "description": "LeadPerfection integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/LeadPerfectionIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "marketsharp": {
      "description": "MarketSharp integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/MarketSharpV2Integration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "gohighlevel": {
      "description": "GoHighLevel integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/GoHighLevelIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadconnectorhq": {
      "description": "LeadConnectorHq integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/LeadConnectorHqIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "sierra": {
      "description": "Sierra integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/SierraIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "agentLegend": {
      "description": "Agent Legend integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/AgentLegendIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadMailbox": {
      "description": "Lead Mailbox integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/LeadMailboxIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "velocify": {
      "description": "Velocify integration metadata",
      "anyOf": [
        {
          "$ref": "#/components/schemas/VelocifyIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

### `InternalServerError`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "Internal server error"
    },
    "statusCode": {
      "type": "number",
      "example": 500
    }
  }
}
```

### `InvalidRequest`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "The parameter leadId must be provided"
    },
    "statusCode": {
      "type": "number",
      "example": 400
    }
  }
}
```

### `Lead`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "The ID for this lead in Structurely",
      "example": "650ba6ced07cb5552a2467b0",
      "type": "string",
      "format": "ObjectId"
    },
    "externalLeadId": {
      "type": "string",
      "description": "Optionally provide the ID for this lead in your CRM or database",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "name": {
      "type": "string",
      "example": "Jane Doe"
    },
    "email": {
      "type": "string",
      "example": "jane.doe@example.com"
    },
    "phone": {
      "type": "string",
      "description": "E.164 formatted number",
      "example": "+13035555555"
    },
    "muted": {
      "type": "boolean",
      "example": false
    },
    "voiceMuted": {
      "type": "boolean",
      "description": "Whether Voice AI is muted for this lead.",
      "example": false
    },
    "stages": {
      "type": "array",
      "example": [
        "needs_followup"
      ],
      "items": {
        "type": "string"
      }
    },
    "properties": {
      "example": {
        "address": "12345 Deckawoo Dr, Denver, CO, 80132"
      },
      "description": "Properties that are known about the lead.",
      "allOf": [
        {
          "$ref": "#/components/schemas/Properties"
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. This field is always returned as an object and is empty ({}) when no custom properties exist. Unsupported nested values and mixed-type arrays are excluded from responses.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      }
    }
  },
  "required": [
    "customProperties",
    "voiceMuted"
  ]
}
```

### `LeadConnectorHqIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "LeadConnectorHq Contact ID",
      "example": "12345"
    },
    "locationId": {
      "type": "string",
      "description": "LeadConnectorHq Location ID",
      "example": "67890",
      "nullable": true
    }
  },
  "required": [
    "contactId"
  ]
}
```

### `LeadListResponse`

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "description": "Paginated leads for incremental sync.",
      "items": {
        "$ref": "#/components/schemas/Lead"
      }
    },
    "cursor": {
      "type": "string",
      "description": "Pagination cursor for the next page.",
      "nullable": true
    },
    "next": {
      "type": "string",
      "description": "Fully-qualified URL for the next page.",
      "nullable": true
    }
  },
  "required": [
    "items"
  ]
}
```

### `LeadMailboxIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Lead Mailbox Lead ID",
      "example": "12345"
    }
  },
  "required": [
    "leadId"
  ]
}
```

### `LeadPerfectionIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "type": "string",
      "description": "LeadPerfection Prospect ID",
      "example": "12345"
    },
    "leadId": {
      "type": "string",
      "description": "LeadPerfection Lead ID",
      "example": "67890"
    },
    "appointmentId": {
      "type": "string",
      "description": "LeadPerfection Appointment ID",
      "example": "54321",
      "nullable": true
    }
  },
  "required": [
    "leadId",
    "prospectId"
  ]
}
```

### `MarketSharpV2Integration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "MarketSharp Contact ID",
      "example": "12345"
    },
    "inquiryId": {
      "type": "string",
      "description": "MarketSharp Inquiry ID",
      "example": "67890"
    },
    "appointmentId": {
      "type": "string",
      "description": "MarketSharp Appointment ID",
      "example": "54321",
      "nullable": true
    }
  },
  "required": [
    "contactId",
    "inquiryId"
  ]
}
```

### `MuteChannelsRequest`

```json
{
  "type": "object",
  "properties": {
    "channels": {
      "type": "array",
      "minItems": 1,
      "description": "Channels to mute or unmute. Omit to apply both Text and Voice. Allowed values: Text, Voice.",
      "example": [
        "Text",
        "Voice"
      ],
      "items": {
        "type": "string",
        "enum": [
          "Text",
          "Voice"
        ]
      }
    }
  }
}
```

### `NotAuthorized`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "Access Token is not authorized"
    },
    "statusCode": {
      "type": "number",
      "example": 401
    }
  }
}
```

### `NotFound`

```json
{
  "type": "object",
  "properties": {
    "message": {
      "type": "string",
      "description": "A message describing the error",
      "example": "Lead not found"
    },
    "statusCode": {
      "type": "number",
      "example": 404
    }
  }
}
```

### `PatchAcculynxIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "Acculynx Contact ID",
      "example": "12345",
      "nullable": true
    },
    "jobId": {
      "type": "string",
      "description": "Acculynx Job ID",
      "example": "67890",
      "nullable": true
    },
    "appointmentId": {
      "type": "string",
      "description": "Acculynx Appointment ID",
      "example": "54321",
      "nullable": true
    }
  }
}
```

### `PatchAgentLegendIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "type": "integer",
      "description": "Agent Legend Prospect ID",
      "example": 12345,
      "nullable": true
    }
  }
}
```

### `PatchBonzoIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "description": "Bonzo Prospect ID",
      "example": 12345,
      "oneOf": [
        {
          "type": "integer"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    }
  }
}
```

### `PatchBoomTownIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "BoomTown Contact ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `PatchFollowUpBossIntegration`

```json
{
  "type": "object",
  "properties": {
    "personId": {
      "type": "string",
      "description": "Follow Up Boss Person ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `PatchGoHighLevelIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "GoHighLevel Contact ID",
      "example": "12345",
      "nullable": true
    },
    "locationId": {
      "type": "string",
      "description": "GoHighLevel Location ID",
      "example": "67890",
      "nullable": true
    }
  }
}
```

### `PatchHubSpotIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "HubSpot Contact ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `PatchIntegrationMetadata`

```json
{
  "type": "object",
  "properties": {
    "salesforce": {
      "description": "Salesforce integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchSalesforceIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "bonzo": {
      "description": "Bonzo integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchBonzoIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "hubspot": {
      "description": "HubSpot integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchHubSpotIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "followupboss": {
      "description": "Follow Up Boss integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchFollowUpBossIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "acculynx": {
      "description": "Acculynx integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchAcculynxIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "boomtown": {
      "description": "BoomTown integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchBoomTownIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadperfection": {
      "description": "LeadPerfection integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchLeadPerfectionIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "marketsharp": {
      "description": "MarketSharp integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchMarketSharpV2Integration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "gohighlevel": {
      "description": "GoHighLevel integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchGoHighLevelIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadconnectorhq": {
      "description": "LeadConnectorHq integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchLeadConnectorHqIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "sierra": {
      "description": "Sierra integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchSierraIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "agent_legend": {
      "description": "Agent Legend integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchAgentLegendIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "leadMailbox": {
      "description": "Lead Mailbox integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchLeadMailboxIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "velocify": {
      "description": "Velocify integration metadata updates",
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchVelocifyIntegration"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

### `PatchLead`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Updated lead name",
      "example": "Jane Doe",
      "nullable": true
    },
    "externalLeadId": {
      "type": "string",
      "description": "Updated external lead identifier",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "properties": {
      "example": {
        "timeframe": "soon",
        "priceMin": 250000
      },
      "description": "Properties to update for an enrolled lead. Omitted keys are unchanged. Keys explicitly set to null are cleared.",
      "anyOf": [
        {
          "$ref": "#/components/schemas/Properties"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. Entries explicitly set to null clear those custom properties. When both properties.customProperties and customProperties are provided, top-level customProperties takes precedence. Keys with unsupported values or mixed-type arrays are dropped during normalization.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata updates. Omitted integration sources are unchanged. A source set to null clears that source.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/PatchIntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

### `PatchLeadConnectorHqIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "LeadConnectorHq Contact ID",
      "example": "12345",
      "nullable": true
    },
    "locationId": {
      "type": "string",
      "description": "LeadConnectorHq Location ID",
      "example": "67890",
      "nullable": true
    }
  }
}
```

### `PatchLeadMailboxIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Lead Mailbox Lead ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `PatchLeadPerfectionIntegration`

```json
{
  "type": "object",
  "properties": {
    "prospectId": {
      "type": "string",
      "description": "LeadPerfection Prospect ID",
      "example": "12345",
      "nullable": true
    },
    "leadId": {
      "type": "string",
      "description": "LeadPerfection Lead ID",
      "example": "67890",
      "nullable": true
    },
    "appointmentId": {
      "type": "string",
      "description": "LeadPerfection Appointment ID",
      "example": "54321",
      "nullable": true
    }
  }
}
```

### `PatchMarketSharpV2Integration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "MarketSharp Contact ID",
      "example": "12345",
      "nullable": true
    },
    "inquiryId": {
      "type": "string",
      "description": "MarketSharp Inquiry ID",
      "example": "67890",
      "nullable": true
    },
    "appointmentId": {
      "type": "string",
      "description": "MarketSharp Appointment ID",
      "example": "54321",
      "nullable": true
    }
  }
}
```

### `PatchSalesforceIntegration`

```json
{
  "type": "object",
  "properties": {
    "sfObjectId": {
      "type": "string",
      "description": "Salesforce Object ID for the Contact, Lead, or Opportunity this lead is tied to",
      "example": "001XXXXXXXXXXXXXXX",
      "nullable": true
    },
    "contactObjectId": {
      "type": "string",
      "description": "Salesforce Contact Object ID",
      "example": "003XXXXXXXXXXXXXXX",
      "nullable": true
    },
    "leadObjectId": {
      "type": "string",
      "description": "Salesforce Lead Object ID",
      "example": "00QXXXXXXXXXXXXXXX",
      "nullable": true
    },
    "opportunityObjectId": {
      "type": "string",
      "description": "Salesforce Opportunity Object ID",
      "example": "006XXXXXXXXXXXXXXX",
      "nullable": true
    },
    "ownerObjectId": {
      "type": "string",
      "description": "Salesforce Owner Object ID",
      "example": "005XXXXXXXXXXXXXXX",
      "nullable": true
    }
  }
}
```

### `PatchSierraIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Sierra Lead ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `PatchVelocifyIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Velocify Lead ID",
      "example": "12345",
      "nullable": true
    }
  }
}
```

### `Properties`

```json
{
  "type": "object",
  "properties": {
    "address": {
      "type": "string",
      "nullable": true
    },
    "agencyUrl": {
      "type": "string",
      "nullable": true
    },
    "agentExclusivity": {
      "type": "string",
      "nullable": true
    },
    "agentSatisfactionRating": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "agentStatus": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "alternatePlan": {
      "type": "string",
      "nullable": true
    },
    "anticipatedCloseDate": {
      "type": "string",
      "nullable": true
    },
    "autoCoverageType": {
      "type": "string",
      "enum": [
        "collision",
        "comprehensive",
        "full",
        "liability",
        null
      ],
      "nullable": true
    },
    "background": {
      "type": "string",
      "nullable": true
    },
    "baths": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "bathsMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "bathsMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "beds": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "bedsMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "bedsMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "benefit": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "businessLoanType": {
      "type": "string",
      "enum": [
        "business line of credit",
        "merchant cash advance",
        "sba loan",
        "term loan",
        null
      ],
      "nullable": true
    },
    "cancellationReason": {
      "type": "string",
      "nullable": true
    },
    "coBorrowerStatus": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "commercialProperty": {
      "type": "string",
      "enum": [
        "hotel",
        "industrial",
        "multi_family_housing",
        "office",
        "restaurant",
        "retail",
        null
      ],
      "nullable": true
    },
    "companyDepartments": {
      "type": "string",
      "enum": [
        "accounting",
        "business_development",
        "customer_support",
        "innovation",
        "inside_sales",
        "legal",
        "marketing",
        "product_management",
        null
      ],
      "nullable": true
    },
    "companyName": {
      "type": "string",
      "nullable": true
    },
    "constructionType": {
      "type": "string",
      "enum": [
        "addition",
        "new_build",
        "remodel",
        null
      ],
      "nullable": true
    },
    "consultantStatus": {
      "type": "string",
      "enum": [
        "interested",
        "not_interested",
        "postponed_interest",
        "somewhat_interested",
        null
      ],
      "nullable": true
    },
    "contactConfirmation": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "contactLocation": {
      "type": "string",
      "nullable": true
    },
    "contactOptIn": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "contactTime": {
      "type": "string",
      "nullable": true
    },
    "contentOffer": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "contingency": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "coverageAmount": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "coverageAmountMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "coverageAmountMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "credit": {
      "type": "string",
      "enum": [
        "excellent",
        "fair",
        "good",
        "very_good",
        "very_poor",
        null
      ],
      "nullable": true
    },
    "creditScore": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "crmDisposition": {
      "type": "string",
      "nullable": true
    },
    "crmNotes": {
      "type": "string",
      "nullable": true
    },
    "dateOfBirth": {
      "type": "string",
      "nullable": true
    },
    "debtToIncome": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "decisionMaker": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "decisionProcess": {
      "type": "string",
      "nullable": true
    },
    "decisionStakeholders": {
      "type": "string",
      "nullable": true
    },
    "demoConfirmation": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "downPayment": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "downPaymentMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "downPaymentMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "driversLicenseNumber": {
      "type": "string",
      "nullable": true
    },
    "driversLicenseStatus": {
      "type": "string",
      "enum": [
        "active",
        "expired",
        "permit",
        null
      ],
      "nullable": true
    },
    "education": {
      "type": "string",
      "enum": [
        "associates_degree",
        "bachelors_degree",
        "doctorate_phd",
        "high_school",
        "masters_degree",
        "other",
        null
      ],
      "nullable": true
    },
    "electricType": {
      "type": "string",
      "enum": [
        "circuit breaker box",
        "fuse box",
        null
      ],
      "nullable": true
    },
    "employees": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "employeesMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "employeesMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "employmentStatus": {
      "type": "string",
      "enum": [
        "employed",
        "employed_part_time",
        "not_employed",
        "retired",
        "self_employed",
        null
      ],
      "nullable": true
    },
    "equityStatus": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "equityStatusMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "equityStatusMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "existingCoverage": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "existingCoverageType": {
      "type": "string",
      "enum": [
        "auto_insurance",
        "home_insurance",
        "life_insurance",
        "long_term_disability_insurance",
        "pet_insurance",
        "renters_insurance",
        "umbrella_insurance",
        null
      ],
      "nullable": true
    },
    "exteriorMaterial": {
      "type": "string",
      "enum": [
        "brick",
        "fiber_cement_siding",
        "masonite_siding",
        "metal_siding",
        "siding",
        "stone",
        "stucco",
        "vinyl_siding",
        "wood",
        null
      ],
      "nullable": true
    },
    "externalCampaignId": {
      "type": "string",
      "nullable": true
    },
    "favoriteCity": {
      "type": "string",
      "nullable": true
    },
    "financialDefault": {
      "type": "string",
      "enum": [
        "bankruptcy",
        "declined_previously",
        "eviction",
        "foreclosure",
        "missed_payments",
        "short_sale",
        null
      ],
      "nullable": true
    },
    "financingStatus": {
      "type": "string",
      "enum": [
        "cash",
        "false",
        "housing_voucher",
        "owner_financing",
        "rent_to_own",
        "true",
        null
      ],
      "nullable": true
    },
    "firstTimeBuyer": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "firstTimeSeller": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "fsboReason": {
      "type": "string",
      "nullable": true
    },
    "furnaceAge": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "furnaceAgeMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "furnaceAgeMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "garageStalls": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "garageStallsMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "garageStallsMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "gender": {
      "type": "string",
      "enum": [
        "female",
        "male",
        "other",
        null
      ],
      "nullable": true
    },
    "healthHistory": {
      "type": "string",
      "nullable": true
    },
    "homeStyle": {
      "type": "string",
      "enum": [
        "a_frame",
        "art_deco",
        "barndominium",
        "bungalow",
        "cape_cod",
        "colonial",
        "condominium",
        "contemporary",
        "cottage",
        "craftsman",
        "creole",
        "dutch_colonial",
        "farmhouse",
        "federal",
        "french_provincial",
        "georgian",
        "gothic_revival",
        "greek_revival",
        "international",
        "italianate",
        "log_cabin",
        "manufactured_home",
        "mid_century_modern",
        "modern",
        "modular",
        "monterey",
        "national",
        "neoclassical",
        "other",
        "prairie",
        "pueblo",
        "queen_anne",
        "ranch",
        "regency",
        "saltbox",
        "second_empire",
        "shed",
        "shingle",
        "shotgun",
        "spanish_eclectic",
        "split_level",
        "stick",
        "tudor",
        "two_story",
        "victorian",
        null
      ],
      "nullable": true
    },
    "homeownersAssociation": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "ibuyerPartner": {
      "type": "string",
      "enum": [
        "moving_station",
        "offerpad",
        "opendoor",
        null
      ],
      "nullable": true
    },
    "impliedInsuranceType": {
      "type": "string",
      "enum": [
        "auto_insurance",
        "home_insurance",
        "life_insurance",
        "long_term_disability_insurance",
        "pet_insurance",
        "renters_insurance",
        "travel_insurance",
        "umbrella_insurance",
        null
      ],
      "nullable": true
    },
    "inHouseLender": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "income": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "incomeFrequency": {
      "type": "string",
      "enum": [
        "bi-weekly",
        "monthly",
        "semi-monthly",
        "weekly",
        null
      ],
      "nullable": true
    },
    "incomeSource": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "industry": {
      "type": "string",
      "enum": [
        "automotive",
        "commercial_real_estate",
        "ecommerce",
        "home_services",
        "insurance",
        "marketing",
        "mortgage",
        "property_management",
        "residential_real_estate",
        "retail",
        "software",
        null
      ],
      "nullable": true
    },
    "insureds": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "interest": {
      "type": "string",
      "enum": [
        "interested",
        "not_interested",
        "postponed_interest",
        "somewhat_interested",
        null
      ],
      "nullable": true
    },
    "interestRate": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "interestRateMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "interestRateMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "isAgent": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "isInvestor": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "isLocal": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "language": {
      "type": "string",
      "enum": [
        "arabic",
        "bengali",
        "english",
        "french",
        "hindi",
        "japanese",
        "mandarin",
        "portuguese",
        "punjabi",
        "russian",
        "spanish",
        null
      ],
      "nullable": true
    },
    "leadPriority": {
      "type": "string",
      "enum": [
        "distant",
        "later",
        "never",
        "now",
        "soon",
        null
      ],
      "nullable": true
    },
    "lenderName": {
      "type": "string",
      "nullable": true
    },
    "lenderStatus": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "liabilityCoverageAmount": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "liabilityCoverageAmountMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "liabilityCoverageAmountMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "lifeInsuranceType": {
      "type": "string",
      "enum": [
        "final_expense",
        "indexed_universal_life",
        "mortgage_protection",
        "term_life",
        "whole_life",
        null
      ],
      "nullable": true
    },
    "listingAge": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "listingProduct": {
      "type": "string",
      "enum": [
        "fsbo",
        "ibuyer",
        "network",
        null
      ],
      "nullable": true
    },
    "listingUrl": {
      "type": "string",
      "nullable": true
    },
    "livingSpace": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "livingSpaceMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "livingSpaceMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "loanBalance": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "loanBalanceMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "loanBalanceMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "loanPurpose": {
      "type": "string",
      "enum": [
        "cashout",
        "change_term",
        "rate_and_term",
        null
      ],
      "nullable": true
    },
    "loanTerm": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "loanType": {
      "type": "string",
      "enum": [
        "adjustable_rate_mortgage",
        "conventional",
        "fha",
        "heloc",
        "jumbo",
        "reverse_mortgage",
        "usda",
        "va",
        null
      ],
      "nullable": true
    },
    "location": {
      "type": "string",
      "nullable": true
    },
    "lotSize": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "lotSizeMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "lotSizeMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "maritalStatus": {
      "type": "string",
      "enum": [
        "divorced",
        "married",
        "separated",
        "single",
        null
      ],
      "nullable": true
    },
    "marketingSpend": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "marketingSpendMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "marketingSpendMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "militaryActiveDuty": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "militaryBranch": {
      "type": "string",
      "enum": [
        "air_force",
        "army",
        "coast_guard",
        "marines",
        "national_guard",
        "navy",
        "space_force",
        null
      ],
      "nullable": true
    },
    "militaryDischargeType": {
      "type": "string",
      "enum": [
        "bad_conduct_discharge",
        "dishonorable_discharge",
        "entry_level_separation",
        "general_discharge",
        "honorable_discharge",
        "medical_separation",
        "other_than_honorable_discharge",
        "separation_for_convenience_of_the_government",
        null
      ],
      "nullable": true
    },
    "militaryReservesService": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "militaryServiceTerm": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "monthlyPayments": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "monthlyPaymentsMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "monthlyPaymentsMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "mortgageEscrow": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "mortgageIntent": {
      "type": "string",
      "enum": [
        "preapproval",
        "rate_quote",
        null
      ],
      "nullable": true
    },
    "mortgageStatus": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "motivation": {
      "type": "string",
      "enum": [
        "closer_to_family",
        "closer_to_friends",
        "closer_to_school",
        "closer_to_work",
        "death",
        "debt",
        "divorce",
        "downsizing",
        "empty_nester",
        "environmental",
        "equity",
        "good_schools",
        "homeless",
        "investment",
        "job_transfer",
        "lease_expiry",
        "lifestyle",
        "location_proximity",
        "lost_job",
        "neighbor_sold_property",
        "new_children",
        "new_job",
        "privacy",
        "ready_to_move",
        "relocating",
        "retiring",
        "save_money",
        "sold_property",
        "space_for_animals",
        "tired_of_renting",
        "upsizing",
        "vacation_interest",
        "weather",
        null
      ],
      "nullable": true
    },
    "motivationPlans": {
      "type": "string",
      "nullable": true
    },
    "netWorth": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "netWorthMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "netWorthMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "objection": {
      "type": "string",
      "enum": [
        "company_rep",
        "compatibility",
        "other",
        "price",
        "quality",
        "timing",
        null
      ],
      "nullable": true
    },
    "occupation": {
      "type": "string",
      "nullable": true
    },
    "officeLocation": {
      "type": "string",
      "nullable": true
    },
    "ownership": {
      "type": "string",
      "enum": [
        "co_owner",
        "financed",
        "leased",
        "no_ownership",
        "purchasing",
        "sole_owner",
        "third_party_owner",
        null
      ],
      "nullable": true
    },
    "ownershipTimeline": {
      "type": "string",
      "nullable": true
    },
    "paintingType": {
      "type": "string",
      "enum": [
        "brick",
        "cabinetry",
        "commercial",
        "concrete_staining",
        "epoxy_floor_coating",
        "exterior",
        "garage_doors",
        "interior",
        "new_build",
        "other",
        "stucco",
        "wallpaper",
        "wood_staining",
        null
      ],
      "nullable": true
    },
    "paymentAmount": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "paymentAmountMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "paymentAmountMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "paymentType": {
      "type": "string",
      "enum": [
        "cash",
        "credit",
        "financing",
        "insurance",
        null
      ],
      "nullable": true
    },
    "personAge": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "petAge": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "petName": {
      "type": "string",
      "nullable": true
    },
    "petType": {
      "type": "string",
      "enum": [
        "cat",
        "dog",
        "other",
        null
      ],
      "nullable": true
    },
    "preferredChannel": {
      "type": "string",
      "enum": [
        "mailgun",
        "phone_call",
        "twilio",
        null
      ],
      "nullable": true
    },
    "prescriptions": {
      "type": "string",
      "nullable": true
    },
    "price": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "priceMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "priceMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "priorClaims": {
      "type": "string",
      "nullable": true
    },
    "priorLoanExperience": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "problem": {
      "type": "string",
      "nullable": true
    },
    "productType": {
      "type": "string",
      "enum": [
        "awning",
        "bath",
        "deck",
        "door",
        "flooring",
        "gutter_guard",
        "gutters",
        "hurricane_protection",
        "hvac",
        "interior",
        "kitchen",
        "patio",
        "roofing",
        "screened_porch_sunroom",
        "siding",
        "solar",
        "window",
        null
      ],
      "nullable": true
    },
    "projectDetails": {
      "type": "string",
      "nullable": true
    },
    "projectType": {
      "type": "string",
      "enum": [
        "cleaning",
        "new_install",
        "remodel",
        "repair",
        "replacement",
        null
      ],
      "nullable": true
    },
    "promotionalOffer": {
      "type": "string",
      "enum": [
        "interested",
        "not_interested",
        "postponed_interest",
        "somewhat_interested",
        null
      ],
      "nullable": true
    },
    "propertyAge": {
      "type": "string",
      "nullable": true
    },
    "propertyFeature": {
      "type": "string",
      "enum": [
        "access_to_water",
        "basement",
        "big_kitchen",
        "big_yard",
        "deck",
        "detached_garage",
        "driveway",
        "existing_tenants",
        "exposed_beams",
        "exposed_brick",
        "fenced_yard",
        "finished_basement",
        "fireplace",
        "garden",
        "handicap_accessible",
        "hardwood_floors",
        "home_office",
        "hot_tub",
        "in_law_suite",
        "main_floor_laundry",
        "main_floor_master",
        "other",
        "patio - porch",
        "pet_friendly",
        "pool",
        "rural",
        "rv_parking",
        "safe_neighborhood",
        "screened_porch",
        "shop",
        "solar",
        "space_to_entertain",
        "trampoline",
        "updated_baths",
        "updated_kitchen",
        "utilities_included",
        "vaulted_ceilings",
        "walkable_neighborhood",
        null
      ],
      "nullable": true
    },
    "propertyPreferences": {
      "type": "string",
      "nullable": true
    },
    "propertyRecords": {
      "type": "string",
      "enum": [
        "lien",
        "second_mortgage",
        null
      ],
      "nullable": true
    },
    "propertyStatus": {
      "type": "string",
      "enum": [
        "active",
        "pending",
        "sold",
        null
      ],
      "nullable": true
    },
    "propertyUse": {
      "type": "string",
      "enum": [
        "agriculture",
        "business",
        "investment",
        "personal",
        "primary_residence",
        "secondary_residence",
        "short_term_rental",
        "vacation",
        null
      ],
      "nullable": true
    },
    "propertyValue": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "propertyValueMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "propertyValueMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "propertyVisit": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "purchaseStatus": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "quantity": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "readiness": {
      "type": "string",
      "enum": [
        "active",
        "just_looking",
        "not_interested",
        "researching",
        null
      ],
      "nullable": true
    },
    "referralAgencyName": {
      "type": "string",
      "nullable": true
    },
    "referralAgentEmail": {
      "type": "string",
      "nullable": true
    },
    "referralAgentName": {
      "type": "string",
      "nullable": true
    },
    "referralAgentPhone": {
      "type": "string",
      "nullable": true
    },
    "referralInterest": {
      "type": "string",
      "enum": [
        "agent",
        "does_not_want_agent",
        "financing",
        null
      ],
      "nullable": true
    },
    "relocating": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "rentalPeriod": {
      "type": "string",
      "nullable": true
    },
    "replacementAmount": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "replacementAmountMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "replacementAmountMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "revenue": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "revenueMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "revenueMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "roofAge": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "roofAgeMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "roofAgeMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "roofType": {
      "type": "string",
      "enum": [
        "asphalt_shingles",
        "cedar_shake_shingles",
        "coating",
        "composite_shingles",
        "flat_roofing",
        "metal",
        "slate",
        "synthetic_shingles",
        null
      ],
      "nullable": true
    },
    "satisfactionRating": {
      "type": "string",
      "enum": [
        "excellent",
        "moderate",
        "poor",
        "very_poor",
        null
      ],
      "nullable": true
    },
    "schedulingLink": {
      "type": "string",
      "nullable": true
    },
    "scope": {
      "type": "string",
      "nullable": true
    },
    "sellingAddress": {
      "type": "string",
      "nullable": true
    },
    "startDate": {
      "type": "string",
      "nullable": true
    },
    "state": {
      "type": "string",
      "enum": [
        "alabama",
        "alaska",
        "arizona",
        "arkansas",
        "california",
        "colorado",
        "connecticut",
        "delaware",
        "florida",
        "georgia",
        "hawaii",
        "idaho",
        "illinois",
        "indiana",
        "iowa",
        "kansas",
        "kentucky",
        "louisiana",
        "maine",
        "maryland",
        "massachusetts",
        "michigan",
        "minnesota",
        "mississippi",
        "missouri",
        "montana",
        "nebraska",
        "nevada",
        "new_hampshire",
        "new_jersey",
        "new_mexico",
        "new_york",
        "north_carolina",
        "north_dakota",
        "ohio",
        "oklahoma",
        "oregon",
        "pennsylvania",
        "rhode_island",
        "south_carolina",
        "south_dakota",
        "tennessee",
        "texas",
        "utah",
        "vermont",
        "virginia",
        "washington",
        "west_virginia",
        "wisconsin",
        "wyoming",
        null
      ],
      "nullable": true
    },
    "technology": {
      "type": "string",
      "nullable": true
    },
    "tenure": {
      "type": "string",
      "nullable": true
    },
    "timeZone": {
      "type": "string",
      "enum": [
        "Africa/Abidjan",
        "Africa/Accra",
        "Africa/Addis_Ababa",
        "Africa/Algiers",
        "Africa/Asmara",
        "Africa/Bamako",
        "Africa/Bangui",
        "Africa/Banjul",
        "Africa/Bissau",
        "Africa/Blantyre",
        "Africa/Brazzaville",
        "Africa/Bujumbura",
        "Africa/Cairo",
        "Africa/Casablanca",
        "Africa/Ceuta",
        "Africa/Conakry",
        "Africa/Dakar",
        "Africa/Dar_es_Salaam",
        "Africa/Djibouti",
        "Africa/Douala",
        "Africa/El_Aaiun",
        "Africa/Freetown",
        "Africa/Gaborone",
        "Africa/Harare",
        "Africa/Johannesburg",
        "Africa/Juba",
        "Africa/Kampala",
        "Africa/Khartoum",
        "Africa/Kigali",
        "Africa/Kinshasa",
        "Africa/Lagos",
        "Africa/Libreville",
        "Africa/Lome",
        "Africa/Luanda",
        "Africa/Lubumbashi",
        "Africa/Lusaka",
        "Africa/Malabo",
        "Africa/Maputo",
        "Africa/Maseru",
        "Africa/Mbabane",
        "Africa/Mogadishu",
        "Africa/Monrovia",
        "Africa/Nairobi",
        "Africa/Ndjamena",
        "Africa/Niamey",
        "Africa/Nouakchott",
        "Africa/Ouagadougou",
        "Africa/Porto-Novo",
        "Africa/Sao_Tome",
        "Africa/Tripoli",
        "Africa/Tunis",
        "Africa/Windhoek",
        "America/Adak",
        "America/Anchorage",
        "America/Anguilla",
        "America/Antigua",
        "America/Araguaina",
        "America/Argentina/Buenos_Aires",
        "America/Argentina/Catamarca",
        "America/Argentina/Cordoba",
        "America/Argentina/Jujuy",
        "America/Argentina/La_Rioja",
        "America/Argentina/Mendoza",
        "America/Argentina/Rio_Gallegos",
        "America/Argentina/Salta",
        "America/Argentina/San_Juan",
        "America/Argentina/San_Luis",
        "America/Argentina/Tucuman",
        "America/Argentina/Ushuaia",
        "America/Aruba",
        "America/Asuncion",
        "America/Atikokan",
        "America/Bahia",
        "America/Bahia_Banderas",
        "America/Barbados",
        "America/Belem",
        "America/Belize",
        "America/Blanc-Sablon",
        "America/Boa_Vista",
        "America/Bogota",
        "America/Boise",
        "America/Cambridge_Bay",
        "America/Campo_Grande",
        "America/Cancun",
        "America/Caracas",
        "America/Cayenne",
        "America/Cayman",
        "America/Chicago",
        "America/Chihuahua",
        "America/Ciudad_Juarez",
        "America/Costa_Rica",
        "America/Creston",
        "America/Cuiaba",
        "America/Curacao",
        "America/Danmarkshavn",
        "America/Dawson",
        "America/Dawson_Creek",
        "America/Denver",
        "America/Detroit",
        "America/Dominica",
        "America/Edmonton",
        "America/Eirunepe",
        "America/El_Salvador",
        "America/Fort_Nelson",
        "America/Fortaleza",
        "America/Glace_Bay",
        "America/Goose_Bay",
        "America/Grand_Turk",
        "America/Grenada",
        "America/Guadeloupe",
        "America/Guatemala",
        "America/Guayaquil",
        "America/Guyana",
        "America/Halifax",
        "America/Havana",
        "America/Hermosillo",
        "America/Indiana/Indianapolis",
        "America/Indiana/Knox",
        "America/Indiana/Marengo",
        "America/Indiana/Petersburg",
        "America/Indiana/Tell_City",
        "America/Indiana/Vevay",
        "America/Indiana/Vincennes",
        "America/Indiana/Winamac",
        "America/Inuvik",
        "America/Iqaluit",
        "America/Jamaica",
        "America/Juneau",
        "America/Kentucky/Louisville",
        "America/Kentucky/Monticello",
        "America/Kralendijk",
        "America/La_Paz",
        "America/Lima",
        "America/Los_Angeles",
        "America/Lower_Princes",
        "America/Maceio",
        "America/Managua",
        "America/Manaus",
        "America/Marigot",
        "America/Martinique",
        "America/Matamoros",
        "America/Mazatlan",
        "America/Menominee",
        "America/Merida",
        "America/Metlakatla",
        "America/Mexico_City",
        "America/Miquelon",
        "America/Moncton",
        "America/Monterrey",
        "America/Montevideo",
        "America/Montserrat",
        "America/Nassau",
        "America/New_York",
        "America/Nome",
        "America/Noronha",
        "America/North_Dakota/Beulah",
        "America/North_Dakota/Center",
        "America/North_Dakota/New_Salem",
        "America/Nuuk",
        "America/Ojinaga",
        "America/Panama",
        "America/Paramaribo",
        "America/Phoenix",
        "America/Port-au-Prince",
        "America/Port_of_Spain",
        "America/Porto_Velho",
        "America/Puerto_Rico",
        "America/Punta_Arenas",
        "America/Rankin_Inlet",
        "America/Recife",
        "America/Regina",
        "America/Resolute",
        "America/Rio_Branco",
        "America/Santarem",
        "America/Santiago",
        "America/Santo_Domingo",
        "America/Sao_Paulo",
        "America/Scoresbysund",
        "America/Sitka",
        "America/St_Barthelemy",
        "America/St_Johns",
        "America/St_Kitts",
        "America/St_Lucia",
        "America/St_Thomas",
        "America/St_Vincent",
        "America/Swift_Current",
        "America/Tegucigalpa",
        "America/Thule",
        "America/Tijuana",
        "America/Toronto",
        "America/Tortola",
        "America/Vancouver",
        "America/Whitehorse",
        "America/Winnipeg",
        "America/Yakutat",
        "Antarctica/Casey",
        "Antarctica/Davis",
        "Antarctica/DumontDUrville",
        "Antarctica/Macquarie",
        "Antarctica/Mawson",
        "Antarctica/McMurdo",
        "Antarctica/Palmer",
        "Antarctica/Rothera",
        "Antarctica/Syowa",
        "Antarctica/Troll",
        "Antarctica/Vostok",
        "Arctic/Longyearbyen",
        "Asia/Aden",
        "Asia/Almaty",
        "Asia/Amman",
        "Asia/Anadyr",
        "Asia/Aqtau",
        "Asia/Aqtobe",
        "Asia/Ashgabat",
        "Asia/Atyrau",
        "Asia/Baghdad",
        "Asia/Bahrain",
        "Asia/Baku",
        "Asia/Bangkok",
        "Asia/Barnaul",
        "Asia/Beirut",
        "Asia/Bishkek",
        "Asia/Brunei",
        "Asia/Chita",
        "Asia/Choibalsan",
        "Asia/Colombo",
        "Asia/Damascus",
        "Asia/Dhaka",
        "Asia/Dili",
        "Asia/Dubai",
        "Asia/Dushanbe",
        "Asia/Famagusta",
        "Asia/Gaza",
        "Asia/Hebron",
        "Asia/Ho_Chi_Minh",
        "Asia/Hong_Kong",
        "Asia/Hovd",
        "Asia/Irkutsk",
        "Asia/Jakarta",
        "Asia/Jayapura",
        "Asia/Jerusalem",
        "Asia/Kabul",
        "Asia/Kamchatka",
        "Asia/Karachi",
        "Asia/Kathmandu",
        "Asia/Khandyga",
        "Asia/Kolkata",
        "Asia/Krasnoyarsk",
        "Asia/Kuala_Lumpur",
        "Asia/Kuching",
        "Asia/Kuwait",
        "Asia/Macau",
        "Asia/Magadan",
        "Asia/Makassar",
        "Asia/Manila",
        "Asia/Muscat",
        "Asia/Nicosia",
        "Asia/Novokuznetsk",
        "Asia/Novosibirsk",
        "Asia/Omsk",
        "Asia/Oral",
        "Asia/Phnom_Penh",
        "Asia/Pontianak",
        "Asia/Pyongyang",
        "Asia/Qatar",
        "Asia/Qostanay",
        "Asia/Qyzylorda",
        "Asia/Riyadh",
        "Asia/Sakhalin",
        "Asia/Samarkand",
        "Asia/Seoul",
        "Asia/Shanghai",
        "Asia/Singapore",
        "Asia/Srednekolymsk",
        "Asia/Taipei",
        "Asia/Tashkent",
        "Asia/Tbilisi",
        "Asia/Tehran",
        "Asia/Thimphu",
        "Asia/Tokyo",
        "Asia/Tomsk",
        "Asia/Ulaanbaatar",
        "Asia/Urumqi",
        "Asia/Ust-Nera",
        "Asia/Vientiane",
        "Asia/Vladivostok",
        "Asia/Yakutsk",
        "Asia/Yangon",
        "Asia/Yekaterinburg",
        "Asia/Yerevan",
        "Atlantic/Azores",
        "Atlantic/Bermuda",
        "Atlantic/Canary",
        "Atlantic/Cape_Verde",
        "Atlantic/Faroe",
        "Atlantic/Madeira",
        "Atlantic/Reykjavik",
        "Atlantic/South_Georgia",
        "Atlantic/St_Helena",
        "Atlantic/Stanley",
        "Australia/Adelaide",
        "Australia/Brisbane",
        "Australia/Broken_Hill",
        "Australia/Darwin",
        "Australia/Eucla",
        "Australia/Hobart",
        "Australia/Lindeman",
        "Australia/Lord_Howe",
        "Australia/Melbourne",
        "Australia/Perth",
        "Australia/Sydney",
        "Canada/Atlantic",
        "Canada/Central",
        "Canada/Eastern",
        "Canada/Mountain",
        "Canada/Newfoundland",
        "Canada/Pacific",
        "Europe/Amsterdam",
        "Europe/Andorra",
        "Europe/Astrakhan",
        "Europe/Athens",
        "Europe/Belgrade",
        "Europe/Berlin",
        "Europe/Bratislava",
        "Europe/Brussels",
        "Europe/Bucharest",
        "Europe/Budapest",
        "Europe/Busingen",
        "Europe/Chisinau",
        "Europe/Copenhagen",
        "Europe/Dublin",
        "Europe/Gibraltar",
        "Europe/Guernsey",
        "Europe/Helsinki",
        "Europe/Isle_of_Man",
        "Europe/Istanbul",
        "Europe/Jersey",
        "Europe/Kaliningrad",
        "Europe/Kirov",
        "Europe/Kyiv",
        "Europe/Lisbon",
        "Europe/Ljubljana",
        "Europe/London",
        "Europe/Luxembourg",
        "Europe/Madrid",
        "Europe/Malta",
        "Europe/Mariehamn",
        "Europe/Minsk",
        "Europe/Monaco",
        "Europe/Moscow",
        "Europe/Oslo",
        "Europe/Paris",
        "Europe/Podgorica",
        "Europe/Prague",
        "Europe/Riga",
        "Europe/Rome",
        "Europe/Samara",
        "Europe/San_Marino",
        "Europe/Sarajevo",
        "Europe/Saratov",
        "Europe/Simferopol",
        "Europe/Skopje",
        "Europe/Sofia",
        "Europe/Stockholm",
        "Europe/Tallinn",
        "Europe/Tirane",
        "Europe/Ulyanovsk",
        "Europe/Vaduz",
        "Europe/Vatican",
        "Europe/Vienna",
        "Europe/Vilnius",
        "Europe/Volgograd",
        "Europe/Warsaw",
        "Europe/Zagreb",
        "Europe/Zurich",
        "GMT",
        "Indian/Antananarivo",
        "Indian/Chagos",
        "Indian/Christmas",
        "Indian/Cocos",
        "Indian/Comoro",
        "Indian/Kerguelen",
        "Indian/Mahe",
        "Indian/Maldives",
        "Indian/Mauritius",
        "Indian/Mayotte",
        "Indian/Reunion",
        "Pacific/Apia",
        "Pacific/Auckland",
        "Pacific/Bougainville",
        "Pacific/Chatham",
        "Pacific/Chuuk",
        "Pacific/Easter",
        "Pacific/Efate",
        "Pacific/Fakaofo",
        "Pacific/Fiji",
        "Pacific/Funafuti",
        "Pacific/Galapagos",
        "Pacific/Gambier",
        "Pacific/Guadalcanal",
        "Pacific/Guam",
        "Pacific/Honolulu",
        "Pacific/Kanton",
        "Pacific/Kiritimati",
        "Pacific/Kosrae",
        "Pacific/Kwajalein",
        "Pacific/Majuro",
        "Pacific/Marquesas",
        "Pacific/Midway",
        "Pacific/Nauru",
        "Pacific/Niue",
        "Pacific/Norfolk",
        "Pacific/Noumea",
        "Pacific/Pago_Pago",
        "Pacific/Palau",
        "Pacific/Pitcairn",
        "Pacific/Pohnpei",
        "Pacific/Port_Moresby",
        "Pacific/Rarotonga",
        "Pacific/Saipan",
        "Pacific/Tahiti",
        "Pacific/Tarawa",
        "Pacific/Tongatapu",
        "Pacific/Wake",
        "Pacific/Wallis",
        "US/Alaska",
        "US/Arizona",
        "US/Central",
        "US/Eastern",
        "US/Hawaii",
        "US/Mountain",
        "US/Pacific",
        "UTC",
        null
      ],
      "nullable": true
    },
    "timeframe": {
      "type": "string",
      "nullable": true
    },
    "tobaccoUsage": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "totalDebt": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "totalDebtMax": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "totalDebtMin": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "url": {
      "type": "string",
      "nullable": true
    },
    "useCase": {
      "type": "string",
      "enum": [
        "customer_support",
        "lead_conversion",
        "lead_generation",
        "workflow_improvement",
        null
      ],
      "nullable": true
    },
    "usingProfanity": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "vehicleId": {
      "type": "string",
      "nullable": true
    },
    "vehicleMake": {
      "type": "string",
      "nullable": true
    },
    "vehicleMileage": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "vehicleModel": {
      "type": "string",
      "nullable": true
    },
    "vehicleYear": {
      "oneOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        }
      ],
      "nullable": true
    },
    "veteran": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "veteranServiceDisability": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "viewedProperties": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "webinarOptIn": {
      "type": "string",
      "enum": [
        "no",
        "yes",
        null
      ],
      "nullable": true
    },
    "windowType": {
      "type": "string",
      "enum": [
        "architectural_windows",
        "awning_windows",
        "bay_windows",
        "bow_windows",
        "casement_windows",
        "coastal_windows",
        "double_hung_windows",
        "double_sliding_windows",
        "horizontal_sliding_windows",
        "other",
        "picture_windows",
        "single_hung_windows",
        "single_sliding_windows",
        "sliding_patio_door",
        "vinyl",
        "wood",
        null
      ],
      "nullable": true
    },
    "workHistory": {
      "type": "string",
      "nullable": true
    },
    "workingWithColleague": {
      "enum": [
        true,
        false,
        "true",
        "false",
        null
      ],
      "oneOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        }
      ],
      "nullable": true
    },
    "zipCode": {
      "type": "string",
      "nullable": true
    }
  }
}
```

### `RecentActivity`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "Recent activity ID.",
      "format": "ObjectId",
      "example": "650ba6ced07cb5552a2467b0"
    },
    "leadId": {
      "type": "string",
      "description": "ID of the lead associated with this activity.",
      "format": "ObjectId"
    },
    "leadName": {
      "type": "string",
      "description": "Name of the lead associated with this activity."
    },
    "activityType": {
      "type": "string",
      "enum": [
        "APPOINTMENT_SET",
        "CALLBACK_SCHEDULED"
      ],
      "description": "Type of appointment or callback activity.",
      "example": "APPOINTMENT_SET"
    },
    "createdAt": {
      "type": "string",
      "description": "ISO-8601 creation time derived from the activity ObjectId.",
      "format": "date-time"
    },
    "metadata": {
      "type": "object",
      "description": "Activity metadata with top-level keys converted to camelCase. Top-level datetime values are ISO-8601 strings.",
      "additionalProperties": {}
    }
  },
  "required": [
    "activityType",
    "createdAt",
    "id",
    "leadId",
    "leadName",
    "metadata"
  ]
}
```

### `RecentActivityListResponse`

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "description": "Oldest-first, cursor-paginated recent activity records.",
      "items": {
        "$ref": "#/components/schemas/RecentActivity"
      }
    },
    "cursor": {
      "type": "string",
      "description": "Opaque cursor for the next page, or null when complete.",
      "nullable": true
    },
    "next": {
      "type": "string",
      "description": "Fully-qualified URL for the next page, or null when complete.",
      "nullable": true
    }
  },
  "required": [
    "cursor",
    "items",
    "next"
  ]
}
```

### `SalesforceIntegration`

```json
{
  "type": "object",
  "properties": {
    "sfObjectId": {
      "type": "string",
      "description": "Salesforce Object ID for the Contact, Lead, or Opportunity this lead is tied to",
      "example": "001XXXXXXXXXXXXXXX"
    },
    "contactObjectId": {
      "type": "string",
      "description": "Salesforce Contact Object ID, must be set if Lead or Opportunity are not set",
      "example": "003XXXXXXXXXXXXXXX",
      "nullable": true
    },
    "leadObjectId": {
      "type": "string",
      "description": "Salesforce Lead Object ID, must be set if Contact or Opportunity are not set",
      "example": "00QXXXXXXXXXXXXXXX",
      "nullable": true
    },
    "opportunityObjectId": {
      "type": "string",
      "description": "Salesforce Opportunity Object ID, Must be set if Lead or Contact are not set",
      "example": "006XXXXXXXXXXXXXXX",
      "nullable": true
    },
    "ownerObjectId": {
      "type": "string",
      "description": "Salesforce Owner Object ID",
      "example": "005XXXXXXXXXXXXXXX",
      "nullable": true
    }
  },
  "required": [
    "sfObjectId"
  ]
}
```

### `SierraIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Sierra Lead ID",
      "example": "12345"
    }
  },
  "required": [
    "leadId"
  ]
}
```

### `StartConversation`

```json
{
  "type": "object",
  "properties": {
    "externalLeadId": {
      "type": "string",
      "description": "The ID for this lead in your CRM or database",
      "example": "b6726f23-1440-4206-962f-8c429f61714c",
      "nullable": true
    },
    "name": {
      "type": "string",
      "description": "Full name for this lead",
      "example": "Jane Doe"
    },
    "email": {
      "type": "string",
      "example": "jane.doe@example.com"
    },
    "phone": {
      "type": "string",
      "description": "Lead's phone number, E.164 or number with area code",
      "example": "(303) 555-5555"
    },
    "source": {
      "type": "string",
      "default": "Unknown",
      "description": "The vendor that sourced this lead (or website)",
      "example": "www.shiny-leads-vendor.com"
    },
    "properties": {
      "example": {},
      "description": "Properties that are known about the lead, may be used in responses, may be confirmed or skipped in scripting.",
      "allOf": [
        {
          "$ref": "#/components/schemas/Properties"
        }
      ]
    },
    "customProperties": {
      "type": "object",
      "description": "Optional top-level custom properties for this lead, represented as a dictionary with string keys. Value types: number|string|datetime|boolean|number[]|string[]|datetime[]|boolean[]. During normalization, datetimes are converted to UTC ISO-8601 strings and entries with blank keys, unsupported value types, or mixed-type arrays are dropped.",
      "example": {
        "birthday": "2026-01-01T00:00:00Z",
        "marketingOptIn": true,
        "preferredContactDays": [
          "monday",
          "friday"
        ]
      },
      "additionalProperties": {
        "oneOf": [
          {
            "type": "number"
          },
          {
            "type": "string"
          },
          {
            "type": "string",
            "format": "date-time"
          },
          {
            "type": "boolean"
          },
          {
            "type": "array",
            "items": {
              "type": "number"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "type": "array",
            "items": {
              "type": "boolean"
            }
          }
        ]
      },
      "nullable": true
    },
    "integrations": {
      "description": "Optional integration-specific metadata.",
      "example": {
        "salesforce": {
          "sfObjectId": "001XXXXXXXXXXXXXXX"
        }
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/IntegrationMetadata"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "assignAgent": {
      "description": "Optional agent assignment details for the lead",
      "example": {
        "agentId": "650ba6ced07cb5552a2467b0"
      },
      "anyOf": [
        {
          "$ref": "#/components/schemas/AssignAgent"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "script": {
      "type": "string",
      "example": "buyer",
      "description": "The script or usecase that will be used to communicate with this lead"
    },
    "testPayloadClearDupeLeads": {
      "type": "boolean",
      "default": false,
      "description": "Only set this field during testing, it will automatically clear the phone, email, and externalLeadId for any lead enrolled with the same values.",
      "example": false,
      "nullable": true
    },
    "messages": {
      "type": "array",
      "description": "Optional historical messages to persist for a newly created lead.",
      "example": [
        {
          "channel": "sms",
          "messageId": "d645fca8-762f-46ca-b244-ed4ba244f335",
          "vendorName": "twilio",
          "isOutbound": false,
          "receivedAt": "2026-09-09T04:13:17.037148+00:00",
          "content": "Hello there!",
          "subject": null
        }
      ],
      "items": {
        "$ref": "#/components/schemas/StartConversationMessage"
      },
      "nullable": true
    }
  },
  "required": [
    "script"
  ]
}
```

### `StartConversationMessage`

```json
{
  "type": "object",
  "properties": {
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "email",
        "web"
      ],
      "description": "Message channel.",
      "example": "sms"
    },
    "messageId": {
      "type": "string",
      "description": "Unique message identifier in the source vendor.",
      "example": "d645fca8-762f-46ca-b244-ed4ba244f335"
    },
    "vendorName": {
      "type": "string",
      "enum": [
        "twilio",
        "telnyx",
        "message-bird",
        "vonage",
        "gmail",
        "mailgun",
        "bonzo",
        "sierra",
        "agent-legend",
        "live-chat"
      ],
      "description": "Vendor associated with this message.",
      "example": "twilio"
    },
    "isOutbound": {
      "type": "boolean",
      "description": "True when the agent/platform sent the message.",
      "example": false
    },
    "receivedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timezone-aware datetime when the message was received/sent.",
      "example": "2026-09-09T04:13:17.037405+00:00"
    },
    "content": {
      "type": "string",
      "description": "Message content.",
      "example": "Hello there!"
    },
    "subject": {
      "type": "string",
      "description": "Optional email subject.",
      "example": "Quick follow-up",
      "nullable": true
    }
  },
  "required": [
    "channel",
    "content",
    "isOutbound",
    "messageId",
    "receivedAt",
    "vendorName"
  ]
}
```

### `VelocifyIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Velocify Lead ID",
      "example": "12345"
    }
  },
  "required": [
    "leadId"
  ]
}
```

## Security

### `bearer-access-token`

```json
{
  "type": "http",
  "scheme": "bearer",
  "bearerFormat": "JWT"
}
```
