# 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`

## Contents

- [Accounts](/api/direct/v2/accounts.md)
- [Auth](/api/direct/v2/auth.md)
- [Calling](/api/direct/v2/calling.md)
- [Channels](/api/direct/v2/channels.md)
- [Custom Properties](/api/direct/v2/custom-properties.md)
- [Custom Reports](/api/direct/v2/custom-reports.md)
- [Knowledge Bases](/api/direct/v2/knowledge-bases.md)
- [Leads](/api/direct/v2/leads.md)
- [MCP](/api/direct/v2/mcp.md)
- [Messaging](/api/direct/v2/messaging.md)
- [Scripts](/api/direct/v2/scripts.md)
- [User Management](/api/direct/v2/user-management.md)
- [Webhooks](/api/direct/v2/webhooks.md)

## Endpoint files

### Accounts

- [GET /api/direct/v2/accounts](/api/direct/v2/accounts/get.md)
- [PATCH /api/direct/v2/accounts](/api/direct/v2/accounts/patch.md)

### Auth

- [GET /api/direct/v2/auth/token-info](/api/direct/v2/auth/token-info/get.md)

### Calling

- [GET /api/direct/v2/calling/](/api/direct/v2/calling/get.md)
- [POST /api/direct/v2/calling/call](/api/direct/v2/calling/call/post.md)
- [POST /api/direct/v2/calling/{leadId}/call](/api/direct/v2/calling/{leadId}/call/post.md)
- [GET /api/direct/v2/calling/{leadId}/call/{callId}](/api/direct/v2/calling/{leadId}/call/{callId}/get.md)
- [PATCH /api/direct/v2/calling/{callId}/disposition](/api/direct/v2/calling/{callId}/disposition/patch.md)
- [POST /api/direct/v2/calling/track](/api/direct/v2/calling/track/post.md)
- [GET /api/direct/v2/calling/ai-agents](/api/direct/v2/calling/ai-agents/get.md)
- [GET /api/direct/v2/calling/scheduling](/api/direct/v2/calling/scheduling/get.md)
- [POST /api/direct/v2/calling/scheduling](/api/direct/v2/calling/scheduling/post.md)

### Channels

- [GET /api/direct/v2/channels](/api/direct/v2/channels/get.md)
- [PATCH /api/direct/v2/channels/{channelId}](/api/direct/v2/channels/{channelId}/patch.md)

### Custom Properties

- [GET /api/direct/v2/custom-properties](/api/direct/v2/custom-properties/get.md)
- [POST /api/direct/v2/custom-properties](/api/direct/v2/custom-properties/post.md)
- [PATCH /api/direct/v2/custom-properties/{customPropertyId}](/api/direct/v2/custom-properties/{customPropertyId}/patch.md)
- [DELETE /api/direct/v2/custom-properties/{customPropertyId}](/api/direct/v2/custom-properties/{customPropertyId}/delete.md)

### Custom Reports

- [GET /api/direct/v2/custom-reports](/api/direct/v2/custom-reports/get.md)
- [GET /api/direct/v2/custom-reports/{category}/latest](/api/direct/v2/custom-reports/{category}/latest/get.md)
- [GET /api/direct/v2/custom-reports/{category}/{id}](/api/direct/v2/custom-reports/{category}/{id}/get.md)

### Knowledge Bases

- [GET /api/direct/v2/knowledge-bases](/api/direct/v2/knowledge-bases/get.md)
- [POST /api/direct/v2/knowledge-bases](/api/direct/v2/knowledge-bases/post.md)
- [PATCH /api/direct/v2/knowledge-bases/{knowledgeBaseId}](/api/direct/v2/knowledge-bases/{knowledgeBaseId}/patch.md)
- [DELETE /api/direct/v2/knowledge-bases/{knowledgeBaseId}](/api/direct/v2/knowledge-bases/{knowledgeBaseId}/delete.md)

### 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)

### MCP

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

### Messaging

- [POST /api/direct/v2/leads/{leadId}/message](/api/direct/v2/leads/{leadId}/message/post.md)
- [GET /api/direct/v2/messaging/{leadId}/messages](/api/direct/v2/messaging/{leadId}/messages/get.md)
- [POST /api/direct/v2/messaging/{leadId}/track](/api/direct/v2/messaging/{leadId}/track/post.md)

### Scripts

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

### User Management

- [GET /api/direct/v2/users](/api/direct/v2/users/get.md)
- [POST /api/direct/v2/users](/api/direct/v2/users/post.md)
- [GET /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/get.md)
- [PATCH /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/patch.md)
- [DELETE /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/delete.md)
- [POST /api/direct/v2/users/{userId}/cross-launch](/api/direct/v2/users/{userId}/cross-launch/post.md)

### Webhooks

- [GET /api/direct/v2/webhooks](/api/direct/v2/webhooks/get.md)
- [POST /api/direct/v2/webhooks](/api/direct/v2/webhooks/post.md)
- [PATCH /api/direct/v2/webhooks/{webhook_id}](/api/direct/v2/webhooks/{webhook_id}/patch.md)
- [DELETE /api/direct/v2/webhooks/{webhook_id}](/api/direct/v2/webhooks/{webhook_id}/delete.md)

## Leads

### 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 '{}'
```

## Messaging

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

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

**Summary:** Send a message to a lead

**Description:**

Send a message to a lead. Text AI is muted by default unless continueConversation is true. When useGenerativeAI is true, text is used as a prompt template and generation/send is processed asynchronously.

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

Message to send

Schema: `SendMessage`

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "The message you want to send to the lead",
      "example": "This is a test message"
    },
    "externalMessageId": {
      "type": "string",
      "description": "Optionally provide the ID for a message in your CRM or database",
      "example": "1e86983d-62fa-41fc-88fe-0f26cc8150da",
      "nullable": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date time for when the message was created, must be timezone aware",
      "example": "2026-09-09T04:13:17.037960+00:00",
      "nullable": true
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "email",
        "web"
      ],
      "description": "What channel should the message be sent over",
      "example": "sms"
    },
    "messageMetadata": {
      "type": "object",
      "description": "Metadata to associate with the message",
      "example": "{\"holiday_campaign\":\"easter\"}",
      "additionalProperties": {
        "type": "string"
      }
    },
    "continueConversation": {
      "type": "boolean",
      "default": false,
      "description": "When true, do not mute text AI. Omitted defaults to false (legacy mute). Recommended: true.",
      "example": true
    },
    "useGenerativeAI": {
      "type": "boolean",
      "default": false,
      "description": "When true, treat text as a Text AI prompt template and enqueue asynchronous generation and send. The generated message is delivered later; this response still returns lead metadata. Omitted defaults to false (send text as-is). Recommended: true.",
      "example": true
    }
  },
  "required": [
    "channel",
    "text"
  ]
}
```

#### 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}/message' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "channel": "sms",
  "text": "This is a test message"
}'
```

## Calling

### GET /api/direct/v2/calling/

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

**Summary:** List calls

**Description:**

List calls using updatedAt and cursor pagination.

#### Parameters

- `updatedAt` (query, required: no)
  - Inclusive lower bound for call analyzedAt/finishedAt (ISO-8601). Required when cursor is not provided.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```
- `limit` (query, required: no)
  - Number of calls to return per page. Defaults to 50, between 10 and 100
  - Schema:
    ```json
    {
      "type": "integer"
    }
    ```
- `cursor` (query, required: no)
  - Cursor from a previous response.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```
- `leadId` (query, required: no)
  - Optional Structurely customer id or externalLeadId. First page only; mutually exclusive with cursor.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```

#### Responses

- `200`: Paginated call results
  - Schema: `CallList`
  ```json
  {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "description": "Paginated calls for incremental sync.",
        "items": {
          "$ref": "#/components/schemas/Call"
        }
      },
      "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
      }
    }
  }
  ```
- `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/calling' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/calling/call

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

**Summary:** Create a lead and start a call, this will not start a Text Conversation

**Description:**

Create a new lead and immediately start a call with them

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

The lead information and call metadata

Schema: `StartCall`

```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
        }
      ]
    },
    "callAiAgentId": {
      "type": "string",
      "description": "The ID of the Call AI Agent to use for the call (if not specified will make a direct call).",
      "nullable": true
    },
    "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
    }
  }
}
```

#### Responses

- `200`: The call that was started
  - Schema: `Call`
  ```json
  {
    "type": "object",
    "properties": {
      "callId": {
        "description": "The ID of this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "leadId": {
        "description": "The ID of the lead associated with this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optional external ID for the lead.",
        "nullable": true
      },
      "callType": {
        "type": "string",
        "description": "The type of call."
      },
      "customerCallStatus": {
        "type": "string"
      },
      "agentCallStatus": {
        "type": "string"
      },
      "disposition": {
        "type": "string",
        "description": "Current disposition of the call."
      },
      "isOutboundCall": {
        "type": "boolean",
        "description": "Call direction."
      },
      "duration": {
        "type": "number",
        "description": "Duration of the call in seconds.",
        "nullable": true
      },
      "startedAt": {
        "type": "number",
        "description": "Timestamp when the call was initiated.",
        "nullable": true
      },
      "updatedAt": {
        "type": "number",
        "description": "Timestamp when the call was last updated.",
        "nullable": true
      },
      "finishedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "analyzedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "notes": {
        "type": "string",
        "nullable": true
      },
      "callAiAgent": {
        "description": "The AI agent used for the call.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CallAiAgent"
          },
          {
            "type": "object",
            "nullable": true
          }
        ]
      },
      "destinationNumber": {
        "type": "string",
        "description": "The phone number the call was made to.",
        "nullable": true
      },
      "sourceNumber": {
        "type": "string",
        "description": "The phone number the call was made from.",
        "nullable": true
      },
      "recordingUrl": {
        "type": "string",
        "description": "URL of the call recording.",
        "nullable": true
      },
      "slots": {
        "type": "object",
        "description": "Slot values extracted from the call.",
        "additionalProperties": {},
        "nullable": true
      },
      "transcript": {
        "type": "array",
        "description": "Transcript of the call conversation.",
        "items": {
          "$ref": "#/components/schemas/CallTranscript"
        },
        "nullable": true
      },
      "callMetadata": {
        "type": "object",
        "description": "Metadata associated with the call.",
        "additionalProperties": {},
        "nullable": true
      }
    },
    "required": [
      "callId",
      "callType",
      "leadId"
    ]
  }
  ```
- `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/calling/call' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### POST /api/direct/v2/calling/{leadId}/call

[POST /api/direct/v2/calling/{leadId}/call](/api/direct/v2/calling/{leadId}/call/post.md)

**Summary:** Start a call for a lead that is already in the system

**Description:**

Start a call for a lead that is already in the system

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

#### 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

The metadata for calling a lead

Schema: `CallLead`

```json
{
  "type": "object",
  "properties": {
    "callAiAgentId": {
      "type": "string",
      "description": "The ID of the Call AI Agent to use for the call (if not specified will make a direct call).",
      "nullable": true
    },
    "properties": {
      "example": {
        "address": "12345 Deckawoo Dr, Denver, CO, 80132"
      },
      "description": "Properties that are known about the lead.",
      "anyOf": [
        {
          "$ref": "#/components/schemas/Properties"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

#### Responses

- `200`: The call that was started
  - Schema: `Call`
  ```json
  {
    "type": "object",
    "properties": {
      "callId": {
        "description": "The ID of this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "leadId": {
        "description": "The ID of the lead associated with this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optional external ID for the lead.",
        "nullable": true
      },
      "callType": {
        "type": "string",
        "description": "The type of call."
      },
      "customerCallStatus": {
        "type": "string"
      },
      "agentCallStatus": {
        "type": "string"
      },
      "disposition": {
        "type": "string",
        "description": "Current disposition of the call."
      },
      "isOutboundCall": {
        "type": "boolean",
        "description": "Call direction."
      },
      "duration": {
        "type": "number",
        "description": "Duration of the call in seconds.",
        "nullable": true
      },
      "startedAt": {
        "type": "number",
        "description": "Timestamp when the call was initiated.",
        "nullable": true
      },
      "updatedAt": {
        "type": "number",
        "description": "Timestamp when the call was last updated.",
        "nullable": true
      },
      "finishedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "analyzedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "notes": {
        "type": "string",
        "nullable": true
      },
      "callAiAgent": {
        "description": "The AI agent used for the call.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CallAiAgent"
          },
          {
            "type": "object",
            "nullable": true
          }
        ]
      },
      "destinationNumber": {
        "type": "string",
        "description": "The phone number the call was made to.",
        "nullable": true
      },
      "sourceNumber": {
        "type": "string",
        "description": "The phone number the call was made from.",
        "nullable": true
      },
      "recordingUrl": {
        "type": "string",
        "description": "URL of the call recording.",
        "nullable": true
      },
      "slots": {
        "type": "object",
        "description": "Slot values extracted from the call.",
        "additionalProperties": {},
        "nullable": true
      },
      "transcript": {
        "type": "array",
        "description": "Transcript of the call conversation.",
        "items": {
          "$ref": "#/components/schemas/CallTranscript"
        },
        "nullable": true
      },
      "callMetadata": {
        "type": "object",
        "description": "Metadata associated with the call.",
        "additionalProperties": {},
        "nullable": true
      }
    },
    "required": [
      "callId",
      "callType",
      "leadId"
    ]
  }
  ```
- `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/calling/{leadId}/call' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### GET /api/direct/v2/calling/{leadId}/call/{callId}

[GET /api/direct/v2/calling/{leadId}/call/{callId}](/api/direct/v2/calling/{leadId}/call/{callId}/get.md)

**Summary:** Get call details for a lead

**Description:**

Get details of a specific call 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"
        }
      ]
    }
    ```
- `callId` (path, required: yes)
  - The Call's ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: The call details
  - Schema: `Call`
  ```json
  {
    "type": "object",
    "properties": {
      "callId": {
        "description": "The ID of this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "leadId": {
        "description": "The ID of the lead associated with this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optional external ID for the lead.",
        "nullable": true
      },
      "callType": {
        "type": "string",
        "description": "The type of call."
      },
      "customerCallStatus": {
        "type": "string"
      },
      "agentCallStatus": {
        "type": "string"
      },
      "disposition": {
        "type": "string",
        "description": "Current disposition of the call."
      },
      "isOutboundCall": {
        "type": "boolean",
        "description": "Call direction."
      },
      "duration": {
        "type": "number",
        "description": "Duration of the call in seconds.",
        "nullable": true
      },
      "startedAt": {
        "type": "number",
        "description": "Timestamp when the call was initiated.",
        "nullable": true
      },
      "updatedAt": {
        "type": "number",
        "description": "Timestamp when the call was last updated.",
        "nullable": true
      },
      "finishedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "analyzedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "notes": {
        "type": "string",
        "nullable": true
      },
      "callAiAgent": {
        "description": "The AI agent used for the call.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CallAiAgent"
          },
          {
            "type": "object",
            "nullable": true
          }
        ]
      },
      "destinationNumber": {
        "type": "string",
        "description": "The phone number the call was made to.",
        "nullable": true
      },
      "sourceNumber": {
        "type": "string",
        "description": "The phone number the call was made from.",
        "nullable": true
      },
      "recordingUrl": {
        "type": "string",
        "description": "URL of the call recording.",
        "nullable": true
      },
      "slots": {
        "type": "object",
        "description": "Slot values extracted from the call.",
        "additionalProperties": {},
        "nullable": true
      },
      "transcript": {
        "type": "array",
        "description": "Transcript of the call conversation.",
        "items": {
          "$ref": "#/components/schemas/CallTranscript"
        },
        "nullable": true
      },
      "callMetadata": {
        "type": "object",
        "description": "Metadata associated with the call.",
        "additionalProperties": {},
        "nullable": true
      }
    },
    "required": [
      "callId",
      "callType",
      "leadId"
    ]
  }
  ```
- `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/calling/{leadId}/call/{callId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### PATCH /api/direct/v2/calling/{callId}/disposition

[PATCH /api/direct/v2/calling/{callId}/disposition](/api/direct/v2/calling/{callId}/disposition/patch.md)

**Summary:** Update a call disposition

**Description:**

Set call disposition for a specific call.

#### Parameters

- `callId` (path, required: yes)
  - The Call's ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Payload for updating call disposition

Schema: `CallDispositionUpdate`

```json
{
  "type": "object",
  "properties": {
    "disposition": {
      "type": "string",
      "enum": [
        "Answering Machine",
        "Connected",
        "Appointment Set",
        "Live Transferred",
        "Live Transfer Failed",
        "Call Back Later",
        "Did Not Leave Voicemail",
        "Do Not Call",
        "Do Not Contact",
        "Left Voicemail",
        "Not Interested",
        "No Conversation",
        "Reconnect Later",
        "Wrong Number",
        "Call Blocked, Detected as Spam",
        "Door Visit",
        "Agent Voicemail"
      ],
      "description": "Disposition to set for the call.",
      "example": "Connected"
    }
  },
  "required": [
    "disposition"
  ]
}
```

#### Responses

- `200`: The updated call
  - Schema: `Call`
  ```json
  {
    "type": "object",
    "properties": {
      "callId": {
        "description": "The ID of this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "leadId": {
        "description": "The ID of the lead associated with this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optional external ID for the lead.",
        "nullable": true
      },
      "callType": {
        "type": "string",
        "description": "The type of call."
      },
      "customerCallStatus": {
        "type": "string"
      },
      "agentCallStatus": {
        "type": "string"
      },
      "disposition": {
        "type": "string",
        "description": "Current disposition of the call."
      },
      "isOutboundCall": {
        "type": "boolean",
        "description": "Call direction."
      },
      "duration": {
        "type": "number",
        "description": "Duration of the call in seconds.",
        "nullable": true
      },
      "startedAt": {
        "type": "number",
        "description": "Timestamp when the call was initiated.",
        "nullable": true
      },
      "updatedAt": {
        "type": "number",
        "description": "Timestamp when the call was last updated.",
        "nullable": true
      },
      "finishedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "analyzedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "notes": {
        "type": "string",
        "nullable": true
      },
      "callAiAgent": {
        "description": "The AI agent used for the call.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CallAiAgent"
          },
          {
            "type": "object",
            "nullable": true
          }
        ]
      },
      "destinationNumber": {
        "type": "string",
        "description": "The phone number the call was made to.",
        "nullable": true
      },
      "sourceNumber": {
        "type": "string",
        "description": "The phone number the call was made from.",
        "nullable": true
      },
      "recordingUrl": {
        "type": "string",
        "description": "URL of the call recording.",
        "nullable": true
      },
      "slots": {
        "type": "object",
        "description": "Slot values extracted from the call.",
        "additionalProperties": {},
        "nullable": true
      },
      "transcript": {
        "type": "array",
        "description": "Transcript of the call conversation.",
        "items": {
          "$ref": "#/components/schemas/CallTranscript"
        },
        "nullable": true
      },
      "callMetadata": {
        "type": "object",
        "description": "Metadata associated with the call.",
        "additionalProperties": {},
        "nullable": true
      }
    },
    "required": [
      "callId",
      "callType",
      "leadId"
    ]
  }
  ```
- `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/calling/{callId}/disposition' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "disposition": "Connected"
}'
```

### POST /api/direct/v2/calling/track

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

**Summary:** Track vendor call ingestion

**Description:**

Ingest an externally completed call, dedupe by vendor call id, and return call details.

#### Request body

Vendor call tracking payload

Schema: `TrackCallRequest`

```json
{
  "type": "object",
  "properties": {
    "startedAt": {
      "type": "string",
      "format": "date-time"
    },
    "finishedAt": {
      "type": "string",
      "format": "date-time"
    },
    "vendorCallId": {
      "type": "string"
    },
    "vendorName": {
      "type": "string"
    },
    "callType": {
      "description": "The type of tracked call.",
      "example": "AgentStarted",
      "type": "string",
      "enum": [
        "CustomerStarted",
        "AgentStarted",
        "DialerStarted",
        "DoorVisit"
      ]
    },
    "recordingUrl": {
      "type": "string"
    },
    "callDisposition": {
      "description": "Optional disposition to set for the tracked call.",
      "example": "Connected",
      "type": "string",
      "enum": [
        "Busy",
        "Failed",
        "Answering Machine",
        "No Answer",
        "Connected",
        "Appointment Set",
        "Live Transferred",
        "Live Transfer Failed",
        "Call Back Later",
        "Did Not Leave Voicemail",
        "Do Not Call",
        "Do Not Contact",
        "Left Voicemail",
        "Not Interested",
        "No Conversation",
        "Reconnect Later",
        "Wrong Number",
        "Call Blocked, Detected as Spam",
        "Door Visit",
        "Agent Voicemail",
        null
      ],
      "nullable": true
    },
    "lead": {
      "anyOf": [
        {
          "type": "object",
          "nullable": true
        },
        {
          "$ref": "#/components/schemas/CreateLead"
        }
      ]
    }
  },
  "required": [
    "callType",
    "finishedAt",
    "recordingUrl",
    "startedAt",
    "vendorCallId",
    "vendorName"
  ]
}
```

#### Responses

- `200`: Tracked call payload
  - Schema: `Call`
  ```json
  {
    "type": "object",
    "properties": {
      "callId": {
        "description": "The ID of this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "leadId": {
        "description": "The ID of the lead associated with this call.",
        "type": "string",
        "format": "ObjectId"
      },
      "externalLeadId": {
        "type": "string",
        "description": "Optional external ID for the lead.",
        "nullable": true
      },
      "callType": {
        "type": "string",
        "description": "The type of call."
      },
      "customerCallStatus": {
        "type": "string"
      },
      "agentCallStatus": {
        "type": "string"
      },
      "disposition": {
        "type": "string",
        "description": "Current disposition of the call."
      },
      "isOutboundCall": {
        "type": "boolean",
        "description": "Call direction."
      },
      "duration": {
        "type": "number",
        "description": "Duration of the call in seconds.",
        "nullable": true
      },
      "startedAt": {
        "type": "number",
        "description": "Timestamp when the call was initiated.",
        "nullable": true
      },
      "updatedAt": {
        "type": "number",
        "description": "Timestamp when the call was last updated.",
        "nullable": true
      },
      "finishedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "analyzedAt": {
        "type": "number",
        "description": "Timestamp when the call ended.",
        "nullable": true
      },
      "notes": {
        "type": "string",
        "nullable": true
      },
      "callAiAgent": {
        "description": "The AI agent used for the call.",
        "anyOf": [
          {
            "$ref": "#/components/schemas/CallAiAgent"
          },
          {
            "type": "object",
            "nullable": true
          }
        ]
      },
      "destinationNumber": {
        "type": "string",
        "description": "The phone number the call was made to.",
        "nullable": true
      },
      "sourceNumber": {
        "type": "string",
        "description": "The phone number the call was made from.",
        "nullable": true
      },
      "recordingUrl": {
        "type": "string",
        "description": "URL of the call recording.",
        "nullable": true
      },
      "slots": {
        "type": "object",
        "description": "Slot values extracted from the call.",
        "additionalProperties": {},
        "nullable": true
      },
      "transcript": {
        "type": "array",
        "description": "Transcript of the call conversation.",
        "items": {
          "$ref": "#/components/schemas/CallTranscript"
        },
        "nullable": true
      },
      "callMetadata": {
        "type": "object",
        "description": "Metadata associated with the call.",
        "additionalProperties": {},
        "nullable": true
      }
    },
    "required": [
      "callId",
      "callType",
      "leadId"
    ]
  }
  ```
- `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/calling/track' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "callType": "AgentStarted",
  "finishedAt": "string",
  "recordingUrl": "string",
  "startedAt": "string",
  "vendorCallId": "string",
  "vendorName": "string"
}'
```

### GET /api/direct/v2/calling/ai-agents

[GET /api/direct/v2/calling/ai-agents](/api/direct/v2/calling/ai-agents/get.md)

**Summary:** List CallAI Agents

**Description:**

List all the CallAI Agents in your account

#### Responses

- `200`: A response containing all the active agents in your account
  - Schema: `CallAiAgentList`
  ```json
  {
    "type": "object",
    "properties": {
      "agents": {
        "type": "array",
        "description": "A list of available AI Call Agents.",
        "items": {
          "$ref": "#/components/schemas/CallAiAgent"
        }
      }
    },
    "required": [
      "agents"
    ]
  }
  ```
- `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/calling/ai-agents' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### GET /api/direct/v2/calling/scheduling

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

**Summary:** Get scheduled calling status

**Description:**

Get current scheduled calling status and configuration

#### Responses

- `200`: Scheduling status information
  - Schema: `SchedulingStatus`
  ```json
  {
    "type": "object",
    "properties": {
      "enabled": {
        "type": "boolean",
        "description": "Whether scheduled calling is enabled",
        "example": true
      },
      "current_status": {
        "type": "string",
        "enum": [
          "Active",
          "Disabled",
          "Sleeping"
        ],
        "description": "Current scheduling status",
        "example": "Active"
      }
    }
  }
  ```
- `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/calling/scheduling' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/calling/scheduling

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

**Summary:** Enable or disable scheduled calling

**Description:**

Toggle scheduled calling on/off for the authenticated entity

#### Request body

Enable/disable scheduled calling

Schema: `SchedulingSettings`

```json
{
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean",
      "description": "Enable or disable scheduled calling",
      "example": true
    }
  },
  "required": [
    "enabled"
  ]
}
```

#### Responses

- `200`: Current scheduling status
  - Schema: `SchedulingStatus`
  ```json
  {
    "type": "object",
    "properties": {
      "enabled": {
        "type": "boolean",
        "description": "Whether scheduled calling is enabled",
        "example": true
      },
      "current_status": {
        "type": "string",
        "enum": [
          "Active",
          "Disabled",
          "Sleeping"
        ],
        "description": "Current scheduling status",
        "example": "Active"
      }
    }
  }
  ```
- `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/calling/scheduling' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "enabled": true
}'
```

## Scripts

### GET /api/direct/v2/scripts

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

**Summary:** Retrieve a list of available scripts

**Description:**

This endpoint will return a list of scripts available to your account

#### Responses

- `200`: A script available to your account
  - Schema: `Scripts`
  ```json
  {
    "type": "object",
    "properties": {
      "scripts": {
        "description": "A list of scripts your account can use",
        "example": [
          {
            "name": "buyer",
            "displayName": "Buyer",
            "isCustom": false,
            "isCampaign": false
          }
        ],
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/Script"
        }
      }
    }
  }
  ```
- `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/scripts' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Messaging

### GET /api/direct/v2/messaging/{leadId}/messages

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

**Summary:** Retrieve a lead message history

**Description:**

Retrieve message history 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"
        }
      ]
    }
    ```

#### Responses

- `200`: Successful response, the lead's message history
  - Schema: `MessageList`
  ```json
  {
    "type": "object",
    "properties": {
      "messages": {
        "type": "array",
        "description": "A list of lead messages",
        "items": {
          "$ref": "#/components/schemas/Message"
        }
      }
    },
    "required": [
      "messages"
    ]
  }
  ```
- `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/messaging/{leadId}/messages' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/messaging/{leadId}/track

[POST /api/direct/v2/messaging/{leadId}/track](/api/direct/v2/messaging/{leadId}/track/post.md)

**Summary:** Track a vendor message

**Description:**

Ingest a message that already happened on a partner channel into conversation history.

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

Vendor message tracking payload

Schema: `TrackMessageRequest`

```json
{
  "type": "object",
  "properties": {
    "vendor": {
      "type": "string",
      "description": "Public vendor that originated the message",
      "example": "twilio"
    },
    "vendorMessageId": {
      "type": "string",
      "description": "Vendor identity for this message",
      "example": "SM1234567890"
    },
    "sender": {
      "description": "Who sent the message: Lead, User, or AI",
      "example": "Lead",
      "type": "string",
      "enum": [
        "Lead",
        "User",
        "AI"
      ]
    },
    "channel": {
      "description": "Public message channel: sms, email, or web",
      "example": "sms",
      "type": "string",
      "enum": [
        "sms",
        "email",
        "web"
      ]
    },
    "text": {
      "type": "string",
      "description": "Message body text",
      "example": "Hello from the partner"
    },
    "receivedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timezone-aware datetime when the message was received/sent",
      "example": "2026-09-09T04:13:17.038608+00:00"
    },
    "sourceAddress": {
      "type": "string",
      "description": "Required for sms and email; omit for web",
      "example": "+15551234567",
      "nullable": true
    },
    "destinationAddress": {
      "type": "string",
      "description": "Required for sms and email; omit for web",
      "example": "+15557654321",
      "nullable": true
    },
    "subject": {
      "type": "string",
      "description": "Optional email subject",
      "example": "Checking in",
      "nullable": true
    },
    "media": {
      "type": "array",
      "description": "Optional media items to ingest over HTTPS",
      "items": {
        "$ref": "#/components/schemas/TrackMessageMedia"
      },
      "nullable": true
    },
    "messageMetadata": {
      "type": "object",
      "description": "Optional string metadata associated with the message",
      "example": "{\"campaign\":\"spring\"}",
      "additionalProperties": {
        "type": "string"
      },
      "nullable": true
    }
  },
  "required": [
    "channel",
    "receivedAt",
    "sender",
    "text",
    "vendor",
    "vendorMessageId"
  ]
}
```

#### Responses

- `200`: Tracked message payload
  - Schema: `Message`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "The ID for this message",
        "type": "string",
        "format": "ObjectId"
      },
      "channel": {
        "readOnly": true,
        "description": "The channel this message was sent over",
        "example": "sms"
      },
      "isOutbound": {
        "type": "boolean",
        "description": "Whether this message was outbound",
        "example": true
      },
      "text": {
        "type": "string",
        "description": "Message body text",
        "example": "Hello from Structurely",
        "nullable": true
      },
      "subject": {
        "type": "string",
        "description": "Message subject for email channels",
        "example": "Checking in",
        "nullable": true
      },
      "receivedAt": {
        "readOnly": true,
        "description": "ISO-8601 UTC timestamp this message was received"
      },
      "deliveryStatus": {
        "readOnly": true,
        "description": "Delivery status for outbound messages (null for inbound)",
        "example": "Delivered",
        "nullable": true
      },
      "sender": {
        "readOnly": true,
        "description": "Public sender of the message: Lead, User, AI, or null",
        "example": "Lead",
        "nullable": true
      }
    },
    "required": [
      "channel",
      "id",
      "isOutbound",
      "receivedAt",
      "sender"
    ]
  }
  ```
- `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/messaging/{leadId}/track' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "channel": "sms",
  "receivedAt": "2026-09-09T04:13:17.038608+00:00",
  "sender": "Lead",
  "text": "Hello from the partner",
  "vendor": "twilio",
  "vendorMessageId": "SM1234567890"
}'
```

## Auth

### GET /api/direct/v2/auth/token-info

[GET /api/direct/v2/auth/token-info](/api/direct/v2/auth/token-info/get.md)

**Summary:** Retrieve account metadata

**Description:**

Retrieve account metadata for an API access token

#### Responses

- `200`: Account Metadata
  - Schema: `AccountInfo`
  ```json
  {
    "type": "object",
    "properties": {
      "accountId": {
        "type": "string"
      },
      "accountName": {
        "type": "string"
      }
    },
    "required": [
      "accountId",
      "accountName"
    ]
  }
  ```
- `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/auth/token-info' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## User Management

### GET /api/direct/v2/users

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

**Summary:** List users

**Description:**

List users with optional filtering

#### Parameters

- `limit` (query, required: no)
  - Maximum number of results to return
  - Schema:
    ```json
    {
      "type": "integer"
    }
    ```
- `offset` (query, required: no)
  - Number of results to skip
  - Schema:
    ```json
    {
      "type": "integer"
    }
    ```
- `archived` (query, required: no)
  - Filter by archived status
  - Schema:
    ```json
    {
      "type": "boolean"
    }
    ```
- `email` (query, required: no)
  - Filter by email
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```
- `name` (query, required: no)
  - Filter by name
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```
- `teamId` (query, required: no)
  - Filter by team ID
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```

#### Responses

- `200`: List of users
  - Schema: `UserList`
  ```json
  {
    "type": "object",
    "properties": {
      "data": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/User"
        }
      },
      "total": {
        "type": "integer"
      },
      "limit": {
        "type": "integer"
      },
      "offset": {
        "type": "integer"
      }
    }
  }
  ```
- `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/users' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/users

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

**Summary:** Create a new user

**Description:**

Create a new user in the system

#### Request body

User creation parameters

Schema: `CreateUser`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "phone": {
      "type": "string"
    },
    "isFauxUser": {
      "type": "boolean",
      "default": false
    },
    "teamId": {
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    }
  },
  "required": [
    "email",
    "name",
    "phone"
  ]
}
```

#### Responses

- `201`: Created user
  - Schema: `User`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "email": {
        "type": "string",
        "format": "email",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true
      },
      "isFauxUser": {
        "type": "boolean",
        "readOnly": true
      },
      "archivedAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true,
        "nullable": true
      },
      "teamId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "accountId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "createdAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true
      }
    }
  }
  ```
- `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/users' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "email": "string",
  "name": "string",
  "phone": "string"
}'
```

### GET /api/direct/v2/users/{userId}

[GET /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/get.md)

**Summary:** Retrieve a user detail resource

**Description:**

Retrieve one active user belonging to the authenticated brokerage. Requires read:users or write:users scope.

#### Parameters

- `userId` (path, required: yes)
  - The active brokerage user ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: User detail
  - Schema: `UserDetail`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true,
        "nullable": true
      },
      "isFauxUser": {
        "type": "boolean",
        "readOnly": true
      },
      "teamId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "accountId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "settings": {
        "readOnly": true,
        "allOf": [
          {
            "$ref": "#/components/schemas/UserSettings"
          }
        ]
      }
    },
    "required": [
      "accountId",
      "id",
      "isFauxUser",
      "name",
      "phone",
      "settings",
      "teamId"
    ]
  }
  ```
- `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
      }
    }
  }
  ```
- `403`: Access is restricted to brokerage accounts.
  - 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/users/{userId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### PATCH /api/direct/v2/users/{userId}

[PATCH /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/patch.md)

**Summary:** Update a user detail resource

**Description:**

Update approved user profile and local settings fields. Omitted fields preserve their existing values. Requires write:users scope.

#### Parameters

- `userId` (path, required: yes)
  - The active brokerage user ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

User fields to update.

Schema: `PatchUser`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "phone": {
      "type": "string",
      "nullable": true
    },
    "settings": {
      "$ref": "#/components/schemas/PatchUserSettings"
    }
  }
}
```

#### Responses

- `200`: Updated user detail
  - Schema: `UserDetail`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true,
        "nullable": true
      },
      "isFauxUser": {
        "type": "boolean",
        "readOnly": true
      },
      "teamId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "accountId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "settings": {
        "readOnly": true,
        "allOf": [
          {
            "$ref": "#/components/schemas/UserSettings"
          }
        ]
      }
    },
    "required": [
      "accountId",
      "id",
      "isFauxUser",
      "name",
      "phone",
      "settings",
      "teamId"
    ]
  }
  ```
- `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
      }
    }
  }
  ```
- `403`: Access is restricted to brokerage accounts.
  - 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/users/{userId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### DELETE /api/direct/v2/users/{userId}

[DELETE /api/direct/v2/users/{userId}](/api/direct/v2/users/{userId}/delete.md)

**Summary:** Archive a user

**Description:**

Archive an existing user. Requires write:users scope.

#### Parameters

- `userId` (path, required: yes)
  - The User's ID to archive, this action is not reversible
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `204`: User archived successfully
  - Schema: `User`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "email": {
        "type": "string",
        "format": "email",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true
      },
      "isFauxUser": {
        "type": "boolean",
        "readOnly": true
      },
      "archivedAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true,
        "nullable": true
      },
      "teamId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "accountId": {
        "readOnly": true,
        "type": "string",
        "format": "ObjectId",
        "nullable": true
      },
      "createdAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "readOnly": true
      }
    }
  }
  ```
- `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
      }
    }
  }
  ```
- `403`: Access is restricted to brokerage accounts.
  - 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 DELETE 'https://client.structurely.com/api/direct/v2/users/{userId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/users/{userId}/cross-launch

[POST /api/direct/v2/users/{userId}/cross-launch](/api/direct/v2/users/{userId}/cross-launch/post.md)

**Summary:** Create a Portal cross-launch URL for a user

**Description:**

Create a fully formed Portal cross-launch URL for an active brokerage user. Requires write:users scope.

#### Parameters

- `userId` (path, required: yes)
  - The active brokerage user ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Optional Portal destination for the cross-launch.

Schema: `CrossLaunchRequest`

```json
{
  "type": "object",
  "properties": {
    "targetUri": {
      "type": "string",
      "nullable": true
    }
  }
}
```

#### Responses

- `200`: Portal cross-launch URL
  - Schema: `CrossLaunchResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "url": {
        "type": "string",
        "readOnly": true
      }
    },
    "required": [
      "url"
    ]
  }
  ```
- `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
      }
    }
  }
  ```
- `403`: Access is restricted to brokerage accounts or the session is not authorized to cross-launch.
  - 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/users/{userId}/cross-launch' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Webhooks

### GET /api/direct/v2/webhooks

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

**Summary:** List webhook subscriptions

**Description:**

List webhook subscriptions for the authenticated account.

#### Responses

- `200`: Webhook subscriptions for the authenticated account
  - Schema: `WebhookListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "webhooks": {
        "type": "array",
        "description": "Webhook resources for the authenticated account.",
        "items": {
          "$ref": "#/components/schemas/WebhookCreateResponse"
        }
      }
    },
    "required": [
      "webhooks"
    ]
  }
  ```
- `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/webhooks' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/webhooks

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

**Summary:** Create a new webhook

**Description:**

Create a webhook subscription for lead, call, and message events.

#### Request body

Webhook configuration payload

Schema: `WebhookCreateRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable webhook name.",
      "example": "my webhook"
    },
    "target": {
      "type": "string",
      "description": "HTTPS URL where webhook events will be delivered.",
      "example": "https://example.com/webhooks"
    },
    "triggers": {
      "type": "array",
      "description": "List of events that should trigger this webhook.",
      "example": [
        "lead:created",
        "message"
      ],
      "items": {
        "type": "string",
        "enum": [
          "lead:created",
          "lead:updated",
          "call:created",
          "call:updated",
          "message",
          "custom-tool"
        ]
      }
    }
  },
  "required": [
    "name",
    "target",
    "triggers"
  ]
}
```

#### Responses

- `200`: The created webhook resource
  - Schema: `WebhookCreateResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "Webhook ID.",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "description": "Human-readable webhook name.",
        "example": "my webhook"
      },
      "target": {
        "type": "string",
        "description": "HTTPS URL where webhook events are delivered."
      },
      "secret": {
        "type": "string",
        "description": "Webhook signing secret.",
        "example": "A4h5Q8Y3y9D7s2P4n6V1k3R0t8W2x5Z7b9C1d4F6g8H0j2K4"
      },
      "triggers": {
        "type": "array",
        "description": "Events that trigger this webhook.",
        "example": [
          "message"
        ],
        "items": {
          "type": "string",
          "enum": [
            "lead:created",
            "lead:updated",
            "call:created",
            "call:updated",
            "message",
            "custom-tool"
          ]
        }
      },
      "status": {
        "description": "Current webhook status.",
        "example": "active",
        "type": "string",
        "enum": [
          "active",
          "disabled",
          "failed"
        ]
      },
      "consecutiveFailures": {
        "type": "integer",
        "description": "Number of consecutive failed delivery attempts.",
        "example": 0
      },
      "totalSuccessfulRequests": {
        "type": "integer",
        "description": "Total successful webhook delivery attempts.",
        "example": 0
      },
      "totalFailedRequests": {
        "type": "integer",
        "description": "Total failed webhook delivery attempts.",
        "example": 0
      },
      "createdAt": {
        "type": "string",
        "format": "date-time",
        "description": "Webhook creation timestamp."
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Webhook last update timestamp."
      }
    },
    "required": [
      "consecutiveFailures",
      "createdAt",
      "id",
      "name",
      "secret",
      "status",
      "target",
      "totalFailedRequests",
      "totalSuccessfulRequests",
      "triggers",
      "updatedAt"
    ]
  }
  ```
- `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/webhooks' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "my webhook",
  "target": "https://example.com/webhooks",
  "triggers": [
    "lead:created",
    "message"
  ]
}'
```

### PATCH /api/direct/v2/webhooks/{webhook_id}

[PATCH /api/direct/v2/webhooks/{webhook_id}](/api/direct/v2/webhooks/{webhook_id}/patch.md)

**Summary:** Update an existing webhook

**Description:**

Update mutable webhook fields. This endpoint currently supports status updates only.

#### Parameters

- `webhook_id` (path, required: yes)
  - The webhook ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Webhook update payload.

Schema: `WebhookPatchRequest`

```json
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "active",
        "disabled"
      ],
      "description": "Webhook status to apply.",
      "example": "active"
    }
  },
  "required": [
    "status"
  ]
}
```

#### Responses

- `200`: The updated webhook resource
  - Schema: `WebhookCreateResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "Webhook ID.",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "description": "Human-readable webhook name.",
        "example": "my webhook"
      },
      "target": {
        "type": "string",
        "description": "HTTPS URL where webhook events are delivered."
      },
      "secret": {
        "type": "string",
        "description": "Webhook signing secret.",
        "example": "A4h5Q8Y3y9D7s2P4n6V1k3R0t8W2x5Z7b9C1d4F6g8H0j2K4"
      },
      "triggers": {
        "type": "array",
        "description": "Events that trigger this webhook.",
        "example": [
          "message"
        ],
        "items": {
          "type": "string",
          "enum": [
            "lead:created",
            "lead:updated",
            "call:created",
            "call:updated",
            "message",
            "custom-tool"
          ]
        }
      },
      "status": {
        "description": "Current webhook status.",
        "example": "active",
        "type": "string",
        "enum": [
          "active",
          "disabled",
          "failed"
        ]
      },
      "consecutiveFailures": {
        "type": "integer",
        "description": "Number of consecutive failed delivery attempts.",
        "example": 0
      },
      "totalSuccessfulRequests": {
        "type": "integer",
        "description": "Total successful webhook delivery attempts.",
        "example": 0
      },
      "totalFailedRequests": {
        "type": "integer",
        "description": "Total failed webhook delivery attempts.",
        "example": 0
      },
      "createdAt": {
        "type": "string",
        "format": "date-time",
        "description": "Webhook creation timestamp."
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "description": "Webhook last update timestamp."
      }
    },
    "required": [
      "consecutiveFailures",
      "createdAt",
      "id",
      "name",
      "secret",
      "status",
      "target",
      "totalFailedRequests",
      "totalSuccessfulRequests",
      "triggers",
      "updatedAt"
    ]
  }
  ```
- `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 PATCH 'https://client.structurely.com/api/direct/v2/webhooks/{webhook_id}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "status": "active"
}'
```

### DELETE /api/direct/v2/webhooks/{webhook_id}

[DELETE /api/direct/v2/webhooks/{webhook_id}](/api/direct/v2/webhooks/{webhook_id}/delete.md)

**Summary:** Delete an existing webhook

**Description:**

Delete a webhook subscription.

#### Parameters

- `webhook_id` (path, required: yes)
  - The webhook ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: Webhook deletion result
  ```json
  {
    "example": "OK",
    "type": "string"
  }
  ```
- `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 DELETE 'https://client.structurely.com/api/direct/v2/webhooks/{webhook_id}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Knowledge Bases

### GET /api/direct/v2/knowledge-bases

[GET /api/direct/v2/knowledge-bases](/api/direct/v2/knowledge-bases/get.md)

**Summary:** List knowledge bases

**Description:**

List knowledge bases for the authenticated account.

#### Responses

- `200`: Knowledge bases for the authenticated account
  - Schema: `KnowledgeBaseListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "knowledgeBases": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/KnowledgeBase"
        }
      }
    },
    "required": [
      "knowledgeBases"
    ]
  }
  ```
- `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/knowledge-bases' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/knowledge-bases

[POST /api/direct/v2/knowledge-bases](/api/direct/v2/knowledge-bases/post.md)

**Summary:** Create a knowledge base

**Description:**

Create a knowledge base for the authenticated account.

#### Request body

Knowledge base creation payload

Schema: `CreateKnowledgeBase`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "customAnswers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBaseAnswer"
      }
    }
  },
  "required": [
    "name"
  ]
}
```

#### Responses

- `200`: The created knowledge base
  - Schema: `KnowledgeBase`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "ObjectId"
      },
      "createdAt": {
        "type": "string",
        "format": "date-time"
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "nullable": true
      },
      "name": {
        "type": "string"
      },
      "isEnabled": {
        "type": "boolean"
      },
      "type": {
        "type": "string"
      },
      "size": {
        "type": "integer"
      },
      "customAnswers": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/KnowledgeBaseAnswer"
        }
      }
    },
    "required": [
      "createdAt",
      "customAnswers",
      "id",
      "isEnabled",
      "name",
      "size",
      "type"
    ]
  }
  ```
- `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/knowledge-bases' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string"
}'
```

### PATCH /api/direct/v2/knowledge-bases/{knowledgeBaseId}

[PATCH /api/direct/v2/knowledge-bases/{knowledgeBaseId}](/api/direct/v2/knowledge-bases/{knowledgeBaseId}/patch.md)

**Summary:** Update a knowledge base

**Description:**

Update a knowledge base for the authenticated account.

#### Parameters

- `knowledgeBaseId` (path, required: yes)
  - The Knowledge Base ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Knowledge base patch payload

Schema: `PatchKnowledgeBase`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "customAnswers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBaseAnswer"
      }
    }
  }
}
```

#### Responses

- `200`: The updated knowledge base
  - Schema: `KnowledgeBase`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "format": "ObjectId"
      },
      "createdAt": {
        "type": "string",
        "format": "date-time"
      },
      "updatedAt": {
        "type": "string",
        "format": "date-time",
        "nullable": true
      },
      "name": {
        "type": "string"
      },
      "isEnabled": {
        "type": "boolean"
      },
      "type": {
        "type": "string"
      },
      "size": {
        "type": "integer"
      },
      "customAnswers": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/KnowledgeBaseAnswer"
        }
      }
    },
    "required": [
      "createdAt",
      "customAnswers",
      "id",
      "isEnabled",
      "name",
      "size",
      "type"
    ]
  }
  ```
- `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/knowledge-bases/{knowledgeBaseId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### DELETE /api/direct/v2/knowledge-bases/{knowledgeBaseId}

[DELETE /api/direct/v2/knowledge-bases/{knowledgeBaseId}](/api/direct/v2/knowledge-bases/{knowledgeBaseId}/delete.md)

**Summary:** Delete a knowledge base

**Description:**

Delete a knowledge base for the authenticated account.

#### Parameters

- `knowledgeBaseId` (path, required: yes)
  - The Knowledge Base ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: Knowledge base deletion result
  ```json
  {
    "example": "OK",
    "type": "string"
  }
  ```
- `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 DELETE 'https://client.structurely.com/api/direct/v2/knowledge-bases/{knowledgeBaseId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Custom Properties

### GET /api/direct/v2/custom-properties

[GET /api/direct/v2/custom-properties](/api/direct/v2/custom-properties/get.md)

**Summary:** List custom property definitions

**Description:**

Manage account-level Direct API custom property definitions.
Names are sanitized before storage. JSON schema fragments are validated as custom property schemas,
and schema.required is stripped; use the top-level
required field instead.

usedForLlmContext controls whether this custom property is
included in automatic LLM lead_metadata prompt context. This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.

Create example:
{
  "name": "Financing Status",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

Response example:
{
  "id": "650ba6ced07cb5552a2467b0",
  "name": "financingStatus",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

#### Responses

- `200`: Custom property definitions for the authenticated account.
  - Schema: `CustomPropertyListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "customProperties": {
        "type": "array",
        "description": "Custom property definitions for the authenticated account.",
        "items": {
          "$ref": "#/components/schemas/CustomProperty"
        }
      }
    },
    "required": [
      "customProperties"
    ]
  }
  ```
- `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/custom-properties' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### POST /api/direct/v2/custom-properties

[POST /api/direct/v2/custom-properties](/api/direct/v2/custom-properties/post.md)

**Summary:** Create a custom property definition

**Description:**

Manage account-level Direct API custom property definitions.
Names are sanitized before storage. JSON schema fragments are validated as custom property schemas,
and schema.required is stripped; use the top-level
required field instead.

usedForLlmContext controls whether this custom property is
included in automatic LLM lead_metadata prompt context. This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.

Create example:
{
  "name": "Financing Status",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

Response example:
{
  "id": "650ba6ced07cb5552a2467b0",
  "name": "financingStatus",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

#### Request body

Custom property definition payload.

Schema: `CustomPropertyCreateRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable custom property name. The stored name is sanitized to the custom property camelCase identifier.",
      "example": "Financing Status"
    },
    "description": {
      "type": "string",
      "description": "Optional human-readable description for this custom property.",
      "example": "How the lead plans to finance the purchase.",
      "nullable": true
    },
    "schema": {
      "type": "object",
      "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
      "oneOf": [
        {
          "type": "object",
          "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            }
          },
          "required": [
            "type"
          ],
          "not": {
            "required": [
              "enum"
            ]
          },
          "example": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "description": "NUMBER value schema. Use with dataType NUMBER.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "number"
          }
        },
        {
          "type": "object",
          "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "boolean"
          }
        },
        {
          "type": "object",
          "description": "ARRAY value schema. items.type supports string, number, or boolean.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "array"
              ]
            },
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "required": [
            "type",
            "items"
          ],
          "example": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "x-enum-descriptions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "enum"
          ],
          "example": {
            "type": "string",
            "enum": [
              "cash",
              "financed"
            ],
            "x-enum-descriptions": [
              "Cash buyer",
              "Needs financing"
            ]
          }
        }
      ],
      "example": {
        "type": "string",
        "enum": [
          "cash",
          "financed"
        ],
        "x-enum-descriptions": [
          "Cash buyer",
          "Needs financing"
        ]
      },
      "additionalProperties": {}
    },
    "required": {
      "type": "boolean",
      "default": false,
      "description": "Whether this property should be considered required. Use this top-level field instead of schema.required.",
      "example": false,
      "nullable": true
    },
    "dataType": {
      "type": "string",
      "default": "STRING",
      "enum": [
        "DATE",
        "DATETIME",
        "ANNIVERSARY_DATE",
        "TIME",
        "STRING",
        "NUMBER",
        "BOOLEAN",
        "ARRAY",
        "ENUM"
      ],
      "description": "Semantic custom property data type. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema plus this semantic value.",
      "example": "ENUM"
    },
    "dataOnly": {
      "type": "boolean",
      "default": false,
      "description": "Whether the property is data-only. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled.",
      "example": false,
      "nullable": true
    },
    "usedForLlmContext": {
      "type": "boolean",
      "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly. When omitted, this value is derived from dataOnly after create defaults are applied.",
      "example": false,
      "nullable": true
    }
  },
  "required": [
    "name",
    "schema"
  ]
}
```

#### Responses

- `200`: The created custom property definition.
  - Schema: `CustomProperty`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "Custom property definition ID.",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "description": "Sanitized custom property camelCase identifier.",
        "example": "financingStatus"
      },
      "description": {
        "type": "string",
        "description": "Custom property description, when set.",
        "example": "How the lead plans to finance the purchase.",
        "nullable": true
      },
      "schema": {
        "type": "object",
        "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
        "oneOf": [
          {
            "type": "object",
            "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "string"
                ]
              }
            },
            "required": [
              "type"
            ],
            "not": {
              "required": [
                "enum"
              ]
            },
            "example": {
              "type": "string"
            }
          },
          {
            "type": "object",
            "description": "NUMBER value schema. Use with dataType NUMBER.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "number"
                ]
              }
            },
            "required": [
              "type"
            ],
            "example": {
              "type": "number"
            }
          },
          {
            "type": "object",
            "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "boolean"
                ]
              }
            },
            "required": [
              "type"
            ],
            "example": {
              "type": "boolean"
            }
          },
          {
            "type": "object",
            "description": "ARRAY value schema. items.type supports string, number, or boolean.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "array"
                ]
              },
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "string",
                      "number",
                      "boolean"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              }
            },
            "required": [
              "type",
              "items"
            ],
            "example": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "string"
                ]
              },
              "enum": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "x-enum-descriptions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "enum"
            ],
            "example": {
              "type": "string",
              "enum": [
                "cash",
                "financed"
              ],
              "x-enum-descriptions": [
                "Cash buyer",
                "Needs financing"
              ]
            }
          }
        ],
        "example": {
          "type": "string",
          "enum": [
            "cash",
            "financed"
          ],
          "x-enum-descriptions": [
            "Cash buyer",
            "Needs financing"
          ]
        },
        "additionalProperties": {}
      },
      "required": {
        "type": "boolean",
        "description": "Whether this property is required.",
        "example": false
      },
      "dataType": {
        "type": "string",
        "enum": [
          "DATE",
          "DATETIME",
          "ANNIVERSARY_DATE",
          "TIME",
          "STRING",
          "NUMBER",
          "BOOLEAN",
          "ARRAY",
          "ENUM"
        ],
        "description": "Semantic custom property data type.",
        "example": "ENUM"
      },
      "dataOnly": {
        "type": "boolean",
        "description": "Whether this property is data-only. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled.",
        "example": false
      },
      "usedForLlmContext": {
        "type": "boolean",
        "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.",
        "example": false
      }
    },
    "required": [
      "dataOnly",
      "dataType",
      "id",
      "name",
      "required",
      "schema",
      "usedForLlmContext"
    ]
  }
  ```
- `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/custom-properties' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Financing Status",
  "schema": {
    "type": "string",
    "enum": [
      "cash",
      "financed"
    ],
    "x-enum-descriptions": [
      "Cash buyer",
      "Needs financing"
    ]
  }
}'
```

### PATCH /api/direct/v2/custom-properties/{customPropertyId}

[PATCH /api/direct/v2/custom-properties/{customPropertyId}](/api/direct/v2/custom-properties/{customPropertyId}/patch.md)

**Summary:** Update a custom property definition

**Description:**

Manage account-level Direct API custom property definitions.
Names are sanitized before storage. JSON schema fragments are validated as custom property schemas,
and schema.required is stripped; use the top-level
required field instead.

usedForLlmContext controls whether this custom property is
included in automatic LLM lead_metadata prompt context. This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.

Create example:
{
  "name": "Financing Status",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

Response example:
{
  "id": "650ba6ced07cb5552a2467b0",
  "name": "financingStatus",
  "description": "How the lead plans to finance the purchase.",
  "schema": {
    "type": "string",
    "enum": ["cash", "financed"],
    "x-enum-descriptions": ["Cash buyer", "Needs financing"]
  },
  "required": false,
  "dataType": "ENUM",
  "dataOnly": false,
  "usedForLlmContext": false
}

Omitted fields preserve existing values. Explicit null for nullable optional fields (description, required, dataType, dataOnly, and usedForLlmContext) leaves those fields unchanged. When usedForLlmContext is omitted or null, the existing effective value is preserved even if dataOnly changes in the same request.

#### Parameters

- `customPropertyId` (path, required: yes)
  - The custom property definition ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Custom property definition fields to update.

Schema: `CustomPropertyPatchRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "New custom property name. When omitted, the current sanitized name is preserved.",
      "example": "Updated Financing Status"
    },
    "description": {
      "type": "string",
      "description": "Updated description. Explicit null leaves the current value unchanged.",
      "example": "Updated financing details.",
      "nullable": true
    },
    "schema": {
      "type": "object",
      "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
      "oneOf": [
        {
          "type": "object",
          "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            }
          },
          "required": [
            "type"
          ],
          "not": {
            "required": [
              "enum"
            ]
          },
          "example": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "description": "NUMBER value schema. Use with dataType NUMBER.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "number"
          }
        },
        {
          "type": "object",
          "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "boolean"
          }
        },
        {
          "type": "object",
          "description": "ARRAY value schema. items.type supports string, number, or boolean.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "array"
              ]
            },
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "required": [
            "type",
            "items"
          ],
          "example": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "x-enum-descriptions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "enum"
          ],
          "example": {
            "type": "string",
            "enum": [
              "cash",
              "financed"
            ],
            "x-enum-descriptions": [
              "Cash buyer",
              "Needs financing"
            ]
          }
        }
      ],
      "example": {
        "type": "number"
      },
      "additionalProperties": {}
    },
    "required": {
      "type": "boolean",
      "description": "Updated required flag. Explicit null leaves the current value unchanged.",
      "example": true,
      "nullable": true
    },
    "dataType": {
      "type": "string",
      "enum": [
        "DATE",
        "DATETIME",
        "ANNIVERSARY_DATE",
        "TIME",
        "STRING",
        "NUMBER",
        "BOOLEAN",
        "ARRAY",
        "ENUM"
      ],
      "description": "Updated semantic custom property data type. Explicit null leaves the current value unchanged.",
      "example": "NUMBER"
    },
    "dataOnly": {
      "type": "boolean",
      "description": "Updated data-only flag. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled. Explicit null leaves the current value unchanged.",
      "example": false,
      "nullable": true
    },
    "usedForLlmContext": {
      "type": "boolean",
      "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly. Omitted or null values preserve the existing effective setting, even when dataOnly changes in the same request.",
      "example": false,
      "nullable": true
    }
  }
}
```

#### Responses

- `200`: The updated custom property definition.
  - Schema: `CustomProperty`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "description": "Custom property definition ID.",
        "example": "650ba6ced07cb5552a2467b0",
        "type": "string",
        "format": "ObjectId"
      },
      "name": {
        "type": "string",
        "description": "Sanitized custom property camelCase identifier.",
        "example": "financingStatus"
      },
      "description": {
        "type": "string",
        "description": "Custom property description, when set.",
        "example": "How the lead plans to finance the purchase.",
        "nullable": true
      },
      "schema": {
        "type": "object",
        "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
        "oneOf": [
          {
            "type": "object",
            "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "string"
                ]
              }
            },
            "required": [
              "type"
            ],
            "not": {
              "required": [
                "enum"
              ]
            },
            "example": {
              "type": "string"
            }
          },
          {
            "type": "object",
            "description": "NUMBER value schema. Use with dataType NUMBER.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "number"
                ]
              }
            },
            "required": [
              "type"
            ],
            "example": {
              "type": "number"
            }
          },
          {
            "type": "object",
            "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "boolean"
                ]
              }
            },
            "required": [
              "type"
            ],
            "example": {
              "type": "boolean"
            }
          },
          {
            "type": "object",
            "description": "ARRAY value schema. items.type supports string, number, or boolean.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "array"
                ]
              },
              "items": {
                "type": "object",
                "properties": {
                  "type": {
                    "type": "string",
                    "enum": [
                      "string",
                      "number",
                      "boolean"
                    ]
                  }
                },
                "required": [
                  "type"
                ]
              }
            },
            "required": [
              "type",
              "items"
            ],
            "example": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "type": "object",
            "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "string"
                ]
              },
              "enum": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "x-enum-descriptions": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "type",
              "enum"
            ],
            "example": {
              "type": "string",
              "enum": [
                "cash",
                "financed"
              ],
              "x-enum-descriptions": [
                "Cash buyer",
                "Needs financing"
              ]
            }
          }
        ],
        "example": {
          "type": "string",
          "enum": [
            "cash",
            "financed"
          ],
          "x-enum-descriptions": [
            "Cash buyer",
            "Needs financing"
          ]
        },
        "additionalProperties": {}
      },
      "required": {
        "type": "boolean",
        "description": "Whether this property is required.",
        "example": false
      },
      "dataType": {
        "type": "string",
        "enum": [
          "DATE",
          "DATETIME",
          "ANNIVERSARY_DATE",
          "TIME",
          "STRING",
          "NUMBER",
          "BOOLEAN",
          "ARRAY",
          "ENUM"
        ],
        "description": "Semantic custom property data type.",
        "example": "ENUM"
      },
      "dataOnly": {
        "type": "boolean",
        "description": "Whether this property is data-only. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled.",
        "example": false
      },
      "usedForLlmContext": {
        "type": "boolean",
        "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.",
        "example": false
      }
    },
    "required": [
      "dataOnly",
      "dataType",
      "id",
      "name",
      "required",
      "schema",
      "usedForLlmContext"
    ]
  }
  ```
- `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/custom-properties/{customPropertyId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

### DELETE /api/direct/v2/custom-properties/{customPropertyId}

[DELETE /api/direct/v2/custom-properties/{customPropertyId}](/api/direct/v2/custom-properties/{customPropertyId}/delete.md)

**Summary:** Delete a custom property definition

**Description:**

Delete only the custom property definition. Existing lead customProperties values are not cleared.

#### Parameters

- `customPropertyId` (path, required: yes)
  - The custom property definition ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `200`: Custom property deletion result.
  - Schema: `CustomPropertyDeleteResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "ok": {
        "type": "boolean",
        "description": "True when the custom property definition was deleted.",
        "example": true
      }
    },
    "required": [
      "ok"
    ]
  }
  ```
- `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 DELETE 'https://client.structurely.com/api/direct/v2/custom-properties/{customPropertyId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## Accounts

### GET /api/direct/v2/accounts

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

**Summary:** Retrieve account settings

**Description:**

Retrieve the authenticated account. Requires read:account or write:account scope.

#### Responses

- `200`: Account settings
  - Schema: `Account`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "readOnly": true
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true,
        "nullable": true
      },
      "settings": {
        "readOnly": true,
        "allOf": [
          {
            "$ref": "#/components/schemas/AccountSettings"
          }
        ]
      }
    },
    "required": [
      "id",
      "name",
      "phone",
      "settings"
    ]
  }
  ```
- `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/accounts' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### PATCH /api/direct/v2/accounts

[PATCH /api/direct/v2/accounts](/api/direct/v2/accounts/patch.md)

**Summary:** Update account settings

**Description:**

Update the authenticated account. Omitted fields preserve their existing values. Requires write:account scope.

#### Request body

Account fields to update.

Schema: `PatchAccount`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "phone": {
      "type": "string",
      "nullable": true
    },
    "settings": {
      "$ref": "#/components/schemas/PatchAccountSettings"
    }
  }
}
```

#### Responses

- `200`: Updated account settings
  - Schema: `Account`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "readOnly": true
      },
      "name": {
        "type": "string",
        "readOnly": true
      },
      "phone": {
        "type": "string",
        "readOnly": true,
        "nullable": true
      },
      "settings": {
        "readOnly": true,
        "allOf": [
          {
            "$ref": "#/components/schemas/AccountSettings"
          }
        ]
      }
    },
    "required": [
      "id",
      "name",
      "phone",
      "settings"
    ]
  }
  ```
- `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/accounts' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Channels

### GET /api/direct/v2/channels

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

**Summary:** List SMS channels

**Description:**

List SMS channels owned directly by the authenticated entity. Requires channel:read or channel:write. Results are sorted by ascending channel ID and use opaque cursor pagination.

#### Parameters

- `limit` (query, required: no)
  - Number of channels to return. Defaults to 50 and must be between 1 and 100.
  - Schema:
    ```json
    {
      "type": "integer"
    }
    ```
- `cursor` (query, required: no)
  - Opaque padded URL-safe base64 cursor from a previous response.
  - Schema:
    ```json
    {
      "type": "string"
    }
    ```

#### Responses

- `200`: Cursor-paginated SMS channels for the authenticated entity.
  - Schema: `ChannelListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "description": "Cursor-paginated SMS channels.",
        "items": {
          "$ref": "#/components/schemas/Channel"
        }
      },
      "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/channels' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### PATCH /api/direct/v2/channels/{channelId}

[PATCH /api/direct/v2/channels/{channelId}](/api/direct/v2/channels/{channelId}/patch.md)

**Summary:** Update SMS channel assignments

**Description:**

Assign or clear a Campaign or Voice AI Agent for an SMS channel owned directly by the authenticated entity. Requires channel:write. Omitted fields remain unchanged; explicit null clears the corresponding assignment. A Campaign and Voice AI Agent cannot both be assigned in the same request.

#### Parameters

- `channelId` (path, required: yes)
  - The SMS channel ID.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "format": "ObjectId",
          "type": "string"
        }
      ]
    }
    ```

#### Request body

Optional nullable Campaign and Voice AI Agent assignment IDs.

Schema: `PatchChannel`

```json
{
  "type": "object",
  "properties": {
    "campaignId": {
      "description": "Campaign ID to assign, or null to clear the Campaign assignment.",
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "voiceAgentId": {
      "description": "Voice AI Agent ID to assign, or null to clear the Voice AI Agent assignment.",
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    }
  }
}
```

#### Responses

- `200`: The complete updated SMS channel resource.
  - Schema: `Channel`
  ```json
  {
    "type": "object",
    "properties": {
      "id": {
        "type": "string",
        "description": "SMS channel ID.",
        "example": "650ba6ced07cb5552a2467b0",
        "format": "ObjectId"
      },
      "channelType": {
        "type": "string",
        "enum": [
          "SMS"
        ],
        "description": "Channel type.",
        "example": "SMS"
      },
      "address": {
        "type": "string",
        "description": "SMS source address.",
        "example": "+13035555555"
      },
      "enabled": {
        "type": "boolean",
        "description": "Whether the channel is active.",
        "example": true
      },
      "campaignId": {
        "type": "string",
        "description": "Assigned Campaign ID, or null when no Campaign is assigned.",
        "format": "ObjectId",
        "nullable": true
      },
      "voiceAgentId": {
        "type": "string",
        "description": "Assigned Voice AI Agent ID, or null when no Voice AI Agent is assigned.",
        "format": "ObjectId",
        "nullable": true
      }
    },
    "required": [
      "address",
      "campaignId",
      "channelType",
      "enabled",
      "id",
      "voiceAgentId"
    ]
  }
  ```
- `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/channels/{channelId}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{}'
```

## Leads

### 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"
```

## Custom Reports

### GET /api/direct/v2/custom-reports

[GET /api/direct/v2/custom-reports](/api/direct/v2/custom-reports/get.md)

**Summary:** List custom reports

**Description:**

List every S3 object for the authenticated account's client-accessible custom reports. The response is unpaginated.

#### Responses

- `200`: Custom report objects for the authenticated account
  - Schema: `CustomReportListResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "items": {
        "type": "array",
        "description": "Custom report objects for the authenticated account.",
        "items": {
          "$ref": "#/components/schemas/CustomReport"
        }
      }
    },
    "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/custom-reports' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### GET /api/direct/v2/custom-reports/{category}/latest

[GET /api/direct/v2/custom-reports/{category}/latest](/api/direct/v2/custom-reports/{category}/latest/get.md)

**Summary:** Download the latest custom report in a category

**Description:**

Redirect to a 1-hour presigned S3 GET URL for the most recently modified object in the category. Ties are broken by higher file name.

#### Parameters

- `category` (path, required: yes)
  - Custom report category (DirectPlatformCustomReport.name).
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `302`: Redirect to a 1-hour presigned S3 GET URL. The Location header contains the same URL as downloadReport.
  - Schema: `CustomReportDownloadResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "downloadReport": {
        "type": "string",
        "description": "1-hour presigned S3 GET URL for the custom report object."
      }
    },
    "required": [
      "downloadReport"
    ]
  }
  ```
- `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/custom-reports/{category}/latest' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

### GET /api/direct/v2/custom-reports/{category}/{id}

[GET /api/direct/v2/custom-reports/{category}/{id}](/api/direct/v2/custom-reports/{category}/{id}/get.md)

**Summary:** Download a custom report by id

**Description:**

Redirect to a 1-hour presigned S3 GET URL for the matching custom report object.

#### Parameters

- `category` (path, required: yes)
  - Custom report category (DirectPlatformCustomReport.name).
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        }
      ]
    }
    ```
- `id` (path, required: yes)
  - SHA-256 hex digest of the report file name.
  - Schema:
    ```json
    {
      "oneOf": [
        {
          "type": "string"
        }
      ]
    }
    ```

#### Responses

- `302`: Redirect to a 1-hour presigned S3 GET URL. The Location header contains the same URL as downloadReport.
  - Schema: `CustomReportDownloadResponse`
  ```json
  {
    "type": "object",
    "properties": {
      "downloadReport": {
        "type": "string",
        "description": "1-hour presigned S3 GET URL for the custom report object."
      }
    },
    "required": [
      "downloadReport"
    ]
  }
  ```
- `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/custom-reports/{category}/{id}' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN"
```

## MCP

### POST /api/direct/v2/mcp

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

**Summary:** Structurely Direct MCP endpoint

**Description:**

JSON-RPC 2.0 Streamable HTTP MCP endpoint for Structurely Direct. Canonical path is POST /api/direct/v2/mcp. Alias paths POST /mcp, POST /api/mcp, POST /mcp-server, and POST /api/mcp-server invoke the same handler. Streamable HTTP clients may also POST JSON-RPC to /.well-known/mcp.json and /.well-known/mcp-server (and /api/.well-known counterparts). Unauthenticated server metadata is at GET /.well-known/mcp.json and GET /.well-known/mcp-server (also GET /api/.well-known/mcp.json and GET /api/.well-known/mcp-server). Discovery methods (initialize, ping, tools/list, resources/list, resources/templates/list) work without a bearer token. Calling tools and reading resources requires a Direct API bearer token. This is not a REST resource schema.

#### Responses

- `200`: JSON-RPC 2.0 success or error envelope
  ```json
  {
    "type": "object"
  }
  ```
- `202`: Accepted JSON-RPC notification with an empty body
  ```json
  {
    "type": "object"
  }
  ```
- `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
      }
    }
  }
  ```
- `405`: Method not allowed
  - 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 POST 'https://client.structurely.com/api/direct/v2/mcp' \
  -H "Accept: application/json" \
  -H "Authorization: Bearer $STRUCTURELY_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2024-11-05",
    "capabilities": {},
    "clientInfo": {
      "name": "example-client",
      "version": "1.0"
    }
  }
}'
```

## Schemas

### `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
    }
  }
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `BonzoIntegration`

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

### `HubSpotIntegration`

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

### `FollowUpBossIntegration`

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

### `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"
  ]
}
```

### `BoomTownIntegration`

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

### `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"
  ]
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `SierraIntegration`

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

### `AgentLegendIntegration`

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

### `LeadMailboxIntegration`

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

### `VelocifyIntegration`

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

### `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
        }
      ]
    }
  }
}
```

### `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
    }
  }
}
```

### `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
        }
      ]
    }
  }
}
```

### `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
    }
  }
}
```

### `PatchBonzoIntegration`

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

### `PatchHubSpotIntegration`

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

### `PatchFollowUpBossIntegration`

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

### `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
    }
  }
}
```

### `PatchBoomTownIntegration`

```json
{
  "type": "object",
  "properties": {
    "contactId": {
      "type": "string",
      "description": "BoomTown Contact 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
    }
  }
}
```

### `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
    }
  }
}
```

### `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
    }
  }
}
```

### `PatchSierraIntegration`

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

### `PatchAgentLegendIntegration`

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

### `PatchLeadMailboxIntegration`

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

### `PatchVelocifyIntegration`

```json
{
  "type": "object",
  "properties": {
    "leadId": {
      "type": "string",
      "description": "Velocify Lead 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
        }
      ]
    }
  }
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `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"
  ]
}
```

### `SendMessage`

```json
{
  "type": "object",
  "properties": {
    "text": {
      "type": "string",
      "description": "The message you want to send to the lead",
      "example": "This is a test message"
    },
    "externalMessageId": {
      "type": "string",
      "description": "Optionally provide the ID for a message in your CRM or database",
      "example": "1e86983d-62fa-41fc-88fe-0f26cc8150da",
      "nullable": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Date time for when the message was created, must be timezone aware",
      "example": "2026-09-09T04:13:17.037960+00:00",
      "nullable": true
    },
    "channel": {
      "type": "string",
      "enum": [
        "sms",
        "email",
        "web"
      ],
      "description": "What channel should the message be sent over",
      "example": "sms"
    },
    "messageMetadata": {
      "type": "object",
      "description": "Metadata to associate with the message",
      "example": "{\"holiday_campaign\":\"easter\"}",
      "additionalProperties": {
        "type": "string"
      }
    },
    "continueConversation": {
      "type": "boolean",
      "default": false,
      "description": "When true, do not mute text AI. Omitted defaults to false (legacy mute). Recommended: true.",
      "example": true
    },
    "useGenerativeAI": {
      "type": "boolean",
      "default": false,
      "description": "When true, treat text as a Text AI prompt template and enqueue asynchronous generation and send. The generated message is delivered later; this response still returns lead metadata. Omitted defaults to false (send text as-is). Recommended: true.",
      "example": true
    }
  },
  "required": [
    "channel",
    "text"
  ]
}
```

### `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"
        ]
      }
    }
  }
}
```

### `Message`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "The ID for this message",
      "type": "string",
      "format": "ObjectId"
    },
    "channel": {
      "readOnly": true,
      "description": "The channel this message was sent over",
      "example": "sms"
    },
    "isOutbound": {
      "type": "boolean",
      "description": "Whether this message was outbound",
      "example": true
    },
    "text": {
      "type": "string",
      "description": "Message body text",
      "example": "Hello from Structurely",
      "nullable": true
    },
    "subject": {
      "type": "string",
      "description": "Message subject for email channels",
      "example": "Checking in",
      "nullable": true
    },
    "receivedAt": {
      "readOnly": true,
      "description": "ISO-8601 UTC timestamp this message was received"
    },
    "deliveryStatus": {
      "readOnly": true,
      "description": "Delivery status for outbound messages (null for inbound)",
      "example": "Delivered",
      "nullable": true
    },
    "sender": {
      "readOnly": true,
      "description": "Public sender of the message: Lead, User, AI, or null",
      "example": "Lead",
      "nullable": true
    }
  },
  "required": [
    "channel",
    "id",
    "isOutbound",
    "receivedAt",
    "sender"
  ]
}
```

### `MessageList`

```json
{
  "type": "object",
  "properties": {
    "messages": {
      "type": "array",
      "description": "A list of lead messages",
      "items": {
        "$ref": "#/components/schemas/Message"
      }
    }
  },
  "required": [
    "messages"
  ]
}
```

### `TrackMessageMedia`

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "description": "HTTPS URL of media to ingest",
      "example": "https://cdn.example.com/media.png"
    },
    "mediaType": {
      "type": "string",
      "description": "MIME type of the media item",
      "example": "image/png"
    }
  },
  "required": [
    "mediaType",
    "url"
  ]
}
```

### `TrackMessageRequest`

```json
{
  "type": "object",
  "properties": {
    "vendor": {
      "type": "string",
      "description": "Public vendor that originated the message",
      "example": "twilio"
    },
    "vendorMessageId": {
      "type": "string",
      "description": "Vendor identity for this message",
      "example": "SM1234567890"
    },
    "sender": {
      "description": "Who sent the message: Lead, User, or AI",
      "example": "Lead",
      "type": "string",
      "enum": [
        "Lead",
        "User",
        "AI"
      ]
    },
    "channel": {
      "description": "Public message channel: sms, email, or web",
      "example": "sms",
      "type": "string",
      "enum": [
        "sms",
        "email",
        "web"
      ]
    },
    "text": {
      "type": "string",
      "description": "Message body text",
      "example": "Hello from the partner"
    },
    "receivedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Timezone-aware datetime when the message was received/sent",
      "example": "2026-09-09T04:13:17.038608+00:00"
    },
    "sourceAddress": {
      "type": "string",
      "description": "Required for sms and email; omit for web",
      "example": "+15551234567",
      "nullable": true
    },
    "destinationAddress": {
      "type": "string",
      "description": "Required for sms and email; omit for web",
      "example": "+15557654321",
      "nullable": true
    },
    "subject": {
      "type": "string",
      "description": "Optional email subject",
      "example": "Checking in",
      "nullable": true
    },
    "media": {
      "type": "array",
      "description": "Optional media items to ingest over HTTPS",
      "items": {
        "$ref": "#/components/schemas/TrackMessageMedia"
      },
      "nullable": true
    },
    "messageMetadata": {
      "type": "object",
      "description": "Optional string metadata associated with the message",
      "example": "{\"campaign\":\"spring\"}",
      "additionalProperties": {
        "type": "string"
      },
      "nullable": true
    }
  },
  "required": [
    "channel",
    "receivedAt",
    "sender",
    "text",
    "vendor",
    "vendorMessageId"
  ]
}
```

### `Script`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "The name of the script, send this when starting a conversation",
      "example": "buyer"
    },
    "displayName": {
      "type": "string",
      "description": "The value to display users to help them choose a script",
      "example": "Buyer"
    },
    "isCustom": {
      "type": "boolean",
      "description": "Is this script customized to you",
      "example": "false"
    },
    "isCampaign": {
      "type": "boolean",
      "description": "True when this script represents a campaign",
      "example": "false"
    }
  },
  "required": [
    "displayName"
  ]
}
```

### `Scripts`

```json
{
  "type": "object",
  "properties": {
    "scripts": {
      "description": "A list of scripts your account can use",
      "example": [
        {
          "name": "buyer",
          "displayName": "Buyer",
          "isCustom": false,
          "isCampaign": false
        }
      ],
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/Script"
      }
    }
  }
}
```

### `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
    }
  }
}
```

### `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
    }
  }
}
```

### `InternalServerError`

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

### `AccountInfo`

```json
{
  "type": "object",
  "properties": {
    "accountId": {
      "type": "string"
    },
    "accountName": {
      "type": "string"
    }
  },
  "required": [
    "accountId",
    "accountName"
  ]
}
```

### `AccountHoursOfOperationMode`

```json
{
  "type": "object",
  "properties": {
    "time": {
      "type": "string",
      "enum": [
        "12a",
        "1a",
        "2a",
        "3a",
        "4a",
        "5a",
        "6a",
        "7a",
        "8a",
        "9a",
        "10a",
        "11a",
        "12p",
        "1p",
        "2p",
        "3p",
        "4p",
        "5p",
        "6p",
        "7p",
        "8p",
        "9p",
        "10p",
        "11p"
      ]
    },
    "mode": {
      "type": "string",
      "enum": [
        "active",
        "sleep"
      ]
    }
  },
  "required": [
    "mode",
    "time"
  ]
}
```

### `AccountHoursOfOperation`

```json
{
  "type": "object",
  "properties": {
    "monday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "tuesday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "wednesday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "thursday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "friday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "saturday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    },
    "sunday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/AccountHoursOfOperationMode"
      }
    }
  },
  "required": [
    "friday",
    "monday",
    "saturday",
    "sunday",
    "thursday",
    "tuesday",
    "wednesday"
  ]
}
```

### `AccountAppointmentScheduling`

```json
{
  "type": "object",
  "properties": {
    "scheduleOnHolidays": {
      "type": "boolean",
      "readOnly": true,
      "description": "Whether appointments may be scheduled on holidays.",
      "example": true
    },
    "minimumBusinessDaysUntilSchedule": {
      "type": "integer",
      "readOnly": true,
      "description": "Minimum business days required before an appointment may be scheduled.",
      "example": 1,
      "nullable": true
    },
    "minimumHoursUntilSchedule": {
      "type": "integer",
      "readOnly": true,
      "minimum": 1,
      "maximum": 12,
      "description": "Minimum hours required before an appointment may be scheduled.",
      "example": 4
    },
    "maximumBusinessDaysBeforeSchedule": {
      "type": "integer",
      "readOnly": true,
      "description": "Maximum business days in advance an appointment may be scheduled; null or zero means no maximum.",
      "example": 30,
      "nullable": true
    }
  },
  "required": [
    "maximumBusinessDaysBeforeSchedule",
    "minimumBusinessDaysUntilSchedule",
    "minimumHoursUntilSchedule",
    "scheduleOnHolidays"
  ]
}
```

### `AccountSettings`

```json
{
  "type": "object",
  "properties": {
    "defaultChatbotName": {
      "type": "string",
      "readOnly": true
    },
    "chatbotHoursOfOperation": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountHoursOfOperation"
        }
      ]
    },
    "callingHoursOfOperation": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountHoursOfOperation"
        }
      ]
    },
    "timeZone": {
      "type": "string",
      "readOnly": true
    },
    "industries": {
      "type": "array",
      "readOnly": true,
      "items": {
        "type": "string",
        "enum": [
          "real_estate",
          "mortgage",
          "software",
          "solar",
          "insurance",
          "travel",
          "automotive",
          "support",
          "home_services",
          "financial_services",
          "recruiting",
          "other"
        ]
      }
    },
    "leadTypes": {
      "type": "array",
      "readOnly": true,
      "items": {
        "type": "string",
        "enum": [
          "buyer",
          "seller",
          "renter",
          "rent_to_own",
          "new_home_loan",
          "home_refinance",
          "auto_insurance",
          "crop_insurance",
          "home_insurance",
          "life_insurance",
          "long_term_disability_insurance",
          "mortgage_insurance",
          "pet_insurance",
          "recruiting_insurance",
          "renters_insurance",
          "travel_insurance",
          "umbrella_insurance",
          "bathroom",
          "deck",
          "door",
          "flooring",
          "gutter_guard",
          "gutters",
          "patio",
          "roofing",
          "screened_porch_sunroom",
          "siding",
          "solar",
          "windows",
          "wealth_management",
          "used_vehicle",
          "new_vehicle",
          "inbound_recruit",
          "outbound_recruit"
        ]
      }
    },
    "fauxAgentsInheritHoursOfOperation": {
      "type": "boolean",
      "readOnly": true
    },
    "allowMultiConversations": {
      "type": "boolean",
      "readOnly": true
    },
    "appointmentScheduling": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountAppointmentScheduling"
        }
      ]
    }
  },
  "required": [
    "allowMultiConversations",
    "appointmentScheduling",
    "callingHoursOfOperation",
    "chatbotHoursOfOperation",
    "defaultChatbotName",
    "fauxAgentsInheritHoursOfOperation",
    "industries",
    "leadTypes",
    "timeZone"
  ]
}
```

### `Account`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "readOnly": true
    },
    "name": {
      "type": "string",
      "readOnly": true
    },
    "phone": {
      "type": "string",
      "readOnly": true,
      "nullable": true
    },
    "settings": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountSettings"
        }
      ]
    }
  },
  "required": [
    "id",
    "name",
    "phone",
    "settings"
  ]
}
```

### `PatchAccountAppointmentScheduling`

```json
{
  "type": "object",
  "properties": {
    "scheduleOnHolidays": {
      "type": "boolean",
      "description": "Whether appointments may be scheduled on holidays.",
      "example": true
    },
    "minimumBusinessDaysUntilSchedule": {
      "type": "integer",
      "minimum": 0,
      "description": "Minimum business days required before an appointment may be scheduled.",
      "example": 1,
      "nullable": true
    },
    "minimumHoursUntilSchedule": {
      "type": "integer",
      "minimum": 1,
      "maximum": 12,
      "description": "Minimum hours required before an appointment may be scheduled.",
      "example": 4
    },
    "maximumBusinessDaysBeforeSchedule": {
      "type": "integer",
      "minimum": 0,
      "description": "Maximum business days in advance an appointment may be scheduled; null or zero means no maximum.",
      "example": 30,
      "nullable": true
    }
  }
}
```

### `PatchAccountSettings`

```json
{
  "type": "object",
  "properties": {
    "defaultChatbotName": {
      "type": "string"
    },
    "chatbotHoursOfOperation": {
      "$ref": "#/components/schemas/AccountHoursOfOperation"
    },
    "callingHoursOfOperation": {
      "$ref": "#/components/schemas/AccountHoursOfOperation"
    },
    "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"
      ]
    },
    "industries": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "real_estate",
          "mortgage",
          "software",
          "solar",
          "insurance",
          "travel",
          "automotive",
          "support",
          "home_services",
          "financial_services",
          "recruiting",
          "other"
        ]
      }
    },
    "leadTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "buyer",
          "seller",
          "renter",
          "rent_to_own",
          "new_home_loan",
          "home_refinance",
          "auto_insurance",
          "crop_insurance",
          "home_insurance",
          "life_insurance",
          "long_term_disability_insurance",
          "mortgage_insurance",
          "pet_insurance",
          "recruiting_insurance",
          "renters_insurance",
          "travel_insurance",
          "umbrella_insurance",
          "bathroom",
          "deck",
          "door",
          "flooring",
          "gutter_guard",
          "gutters",
          "patio",
          "roofing",
          "screened_porch_sunroom",
          "siding",
          "solar",
          "windows",
          "wealth_management",
          "used_vehicle",
          "new_vehicle",
          "inbound_recruit",
          "outbound_recruit"
        ]
      }
    },
    "fauxAgentsInheritHoursOfOperation": {
      "type": "boolean"
    },
    "allowMultiConversations": {
      "type": "boolean"
    },
    "appointmentScheduling": {
      "$ref": "#/components/schemas/PatchAccountAppointmentScheduling"
    }
  }
}
```

### `PatchAccount`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "phone": {
      "type": "string",
      "nullable": true
    },
    "settings": {
      "$ref": "#/components/schemas/PatchAccountSettings"
    }
  }
}
```

### `CreateUser`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "email": {
      "type": "string",
      "format": "email"
    },
    "phone": {
      "type": "string"
    },
    "isFauxUser": {
      "type": "boolean",
      "default": false
    },
    "teamId": {
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    }
  },
  "required": [
    "email",
    "name",
    "phone"
  ]
}
```

### `UserAppointmentSchedulingTransition`

```json
{
  "type": "object",
  "properties": {
    "startTime": {
      "type": "string",
      "enum": [
        "12a",
        "1a",
        "2a",
        "3a",
        "4a",
        "5a",
        "6a",
        "7a",
        "8a",
        "9a",
        "10a",
        "11a",
        "12p",
        "1p",
        "2p",
        "3p",
        "4p",
        "5p",
        "6p",
        "7p",
        "8p",
        "9p",
        "10p",
        "11p"
      ],
      "description": "Exact lower-case hourly transition start.",
      "example": "9a"
    },
    "mode": {
      "type": "string",
      "enum": [
        "Available",
        "NotAvailable"
      ],
      "description": "Availability mode beginning at startTime.",
      "example": "Available"
    }
  },
  "required": [
    "mode",
    "startTime"
  ]
}
```

### `PatchUserAppointmentSchedulingWeeklyAvailability`

```json
{
  "type": "object",
  "properties": {
    "monday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "tuesday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "wednesday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "thursday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "friday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "saturday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "sunday": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    }
  }
}
```

### `PatchUserAppointmentScheduling`

```json
{
  "type": "object",
  "properties": {
    "isActive": {
      "type": "boolean",
      "description": "Whether FAUX appointment scheduling is active."
    },
    "appointmentDuration": {
      "type": "integer",
      "minimum": 10,
      "maximum": 180,
      "description": "FAUX appointment duration in whole minutes, honored exactly."
    },
    "weeklyAvailability": {
      "description": "One or more weekday replacements. Omitted weekdays are preserved.",
      "minProperties": 1,
      "allOf": [
        {
          "$ref": "#/components/schemas/PatchUserAppointmentSchedulingWeeklyAvailability"
        }
      ]
    }
  }
}
```

### `PatchUserSettings`

```json
{
  "type": "object",
  "properties": {
    "defaultChatbotName": {
      "type": "string",
      "nullable": true
    },
    "chatbotHoursOfOperation": {
      "$ref": "#/components/schemas/AccountHoursOfOperation"
    },
    "callingHoursOfOperation": {
      "$ref": "#/components/schemas/AccountHoursOfOperation"
    },
    "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
    },
    "industries": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "real_estate",
          "mortgage",
          "software",
          "solar",
          "insurance",
          "travel",
          "automotive",
          "support",
          "home_services",
          "financial_services",
          "recruiting",
          "other"
        ]
      },
      "nullable": true
    },
    "leadTypes": {
      "type": "array",
      "items": {
        "type": "string",
        "enum": [
          "buyer",
          "seller",
          "renter",
          "rent_to_own",
          "new_home_loan",
          "home_refinance",
          "auto_insurance",
          "crop_insurance",
          "home_insurance",
          "life_insurance",
          "long_term_disability_insurance",
          "mortgage_insurance",
          "pet_insurance",
          "recruiting_insurance",
          "renters_insurance",
          "travel_insurance",
          "umbrella_insurance",
          "bathroom",
          "deck",
          "door",
          "flooring",
          "gutter_guard",
          "gutters",
          "patio",
          "roofing",
          "screened_porch_sunroom",
          "siding",
          "solar",
          "windows",
          "wealth_management",
          "used_vehicle",
          "new_vehicle",
          "inbound_recruit",
          "outbound_recruit"
        ]
      },
      "nullable": true
    },
    "appointmentScheduling": {
      "$ref": "#/components/schemas/PatchUserAppointmentScheduling"
    }
  }
}
```

### `PatchUser`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "phone": {
      "type": "string",
      "nullable": true
    },
    "settings": {
      "$ref": "#/components/schemas/PatchUserSettings"
    }
  }
}
```

### `UserAppointmentSchedulingWeeklyAvailability`

```json
{
  "type": "object",
  "properties": {
    "monday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "tuesday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "wednesday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "thursday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "friday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "saturday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    },
    "sunday": {
      "type": "array",
      "readOnly": true,
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/UserAppointmentSchedulingTransition"
      }
    }
  },
  "required": [
    "friday",
    "monday",
    "saturday",
    "sunday",
    "thursday",
    "tuesday",
    "wednesday"
  ]
}
```

### `UserAppointmentScheduling`

```json
{
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "enum": [
        "google",
        "faux"
      ],
      "readOnly": true,
      "description": "Scheduling provider. Active Google scheduling wins over FAUX scheduling."
    },
    "configurable": {
      "type": "boolean",
      "readOnly": true,
      "description": "False for Google, which exposes no configurable metadata; true for FAUX."
    },
    "isActive": {
      "type": "boolean",
      "readOnly": true,
      "description": "Present only when provider is faux."
    },
    "appointmentDuration": {
      "type": "integer",
      "readOnly": true,
      "minimum": 10,
      "maximum": 180,
      "description": "Present only when provider is faux."
    },
    "weeklyAvailability": {
      "readOnly": true,
      "description": "Present only when provider is faux.",
      "allOf": [
        {
          "$ref": "#/components/schemas/UserAppointmentSchedulingWeeklyAvailability"
        }
      ]
    }
  },
  "required": [
    "configurable",
    "provider"
  ]
}
```

### `UserSettings`

```json
{
  "type": "object",
  "properties": {
    "defaultChatbotName": {
      "type": "string",
      "readOnly": true
    },
    "chatbotHoursOfOperation": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountHoursOfOperation"
        }
      ]
    },
    "callingHoursOfOperation": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/AccountHoursOfOperation"
        }
      ]
    },
    "timeZone": {
      "type": "string",
      "readOnly": true
    },
    "industries": {
      "type": "array",
      "readOnly": true,
      "items": {
        "type": "string"
      }
    },
    "leadTypes": {
      "type": "array",
      "readOnly": true,
      "items": {
        "type": "string"
      }
    },
    "appointmentScheduling": {
      "readOnly": true,
      "description": "Google responses contain only provider and configurable; FAUX responses contain the configurable surface.",
      "oneOf": [
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "provider",
            "configurable"
          ],
          "properties": {
            "provider": {
              "type": "string",
              "enum": [
                "google"
              ]
            },
            "configurable": {
              "type": "boolean",
              "enum": [
                false
              ]
            }
          }
        },
        {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "provider",
            "configurable",
            "isActive",
            "appointmentDuration",
            "weeklyAvailability"
          ],
          "properties": {
            "provider": {
              "type": "string",
              "enum": [
                "faux"
              ]
            },
            "configurable": {
              "type": "boolean",
              "enum": [
                true
              ]
            },
            "isActive": {
              "type": "boolean"
            },
            "appointmentDuration": {
              "type": "integer",
              "minimum": 10,
              "maximum": 180,
              "description": "Whole-minute duration honored exactly by FAUX scheduling."
            },
            "weeklyAvailability": {
              "$ref": "#/components/schemas/UserAppointmentSchedulingWeeklyAvailability"
            }
          }
        }
      ],
      "allOf": [
        {
          "$ref": "#/components/schemas/UserAppointmentScheduling"
        }
      ]
    }
  },
  "required": [
    "appointmentScheduling",
    "callingHoursOfOperation",
    "chatbotHoursOfOperation",
    "defaultChatbotName",
    "industries",
    "leadTypes",
    "timeZone"
  ]
}
```

### `UserDetail`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "readOnly": true
    },
    "phone": {
      "type": "string",
      "readOnly": true,
      "nullable": true
    },
    "isFauxUser": {
      "type": "boolean",
      "readOnly": true
    },
    "teamId": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "accountId": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId"
    },
    "settings": {
      "readOnly": true,
      "allOf": [
        {
          "$ref": "#/components/schemas/UserSettings"
        }
      ]
    }
  },
  "required": [
    "accountId",
    "id",
    "isFauxUser",
    "name",
    "phone",
    "settings",
    "teamId"
  ]
}
```

### `User`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "readOnly": true
    },
    "email": {
      "type": "string",
      "format": "email",
      "readOnly": true
    },
    "phone": {
      "type": "string",
      "readOnly": true
    },
    "isFauxUser": {
      "type": "boolean",
      "readOnly": true
    },
    "archivedAt": {
      "type": "string",
      "format": "date-time",
      "readOnly": true,
      "nullable": true
    },
    "teamId": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "accountId": {
      "readOnly": true,
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "readOnly": true
    }
  }
}
```

### `UserList`

```json
{
  "type": "object",
  "properties": {
    "data": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/User"
      }
    },
    "total": {
      "type": "integer"
    },
    "limit": {
      "type": "integer"
    },
    "offset": {
      "type": "integer"
    }
  }
}
```

### `CrossLaunchRequest`

```json
{
  "type": "object",
  "properties": {
    "targetUri": {
      "type": "string",
      "nullable": true
    }
  }
}
```

### `CrossLaunchResponse`

```json
{
  "type": "object",
  "properties": {
    "url": {
      "type": "string",
      "readOnly": true
    }
  },
  "required": [
    "url"
  ]
}
```

### `StartCall`

```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
        }
      ]
    },
    "callAiAgentId": {
      "type": "string",
      "description": "The ID of the Call AI Agent to use for the call (if not specified will make a direct call).",
      "nullable": true
    },
    "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
    }
  }
}
```

### `CallLead`

```json
{
  "type": "object",
  "properties": {
    "callAiAgentId": {
      "type": "string",
      "description": "The ID of the Call AI Agent to use for the call (if not specified will make a direct call).",
      "nullable": true
    },
    "properties": {
      "example": {
        "address": "12345 Deckawoo Dr, Denver, CO, 80132"
      },
      "description": "Properties that are known about the lead.",
      "anyOf": [
        {
          "$ref": "#/components/schemas/Properties"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    }
  }
}
```

### `CallDispositionUpdate`

```json
{
  "type": "object",
  "properties": {
    "disposition": {
      "type": "string",
      "enum": [
        "Answering Machine",
        "Connected",
        "Appointment Set",
        "Live Transferred",
        "Live Transfer Failed",
        "Call Back Later",
        "Did Not Leave Voicemail",
        "Do Not Call",
        "Do Not Contact",
        "Left Voicemail",
        "Not Interested",
        "No Conversation",
        "Reconnect Later",
        "Wrong Number",
        "Call Blocked, Detected as Spam",
        "Door Visit",
        "Agent Voicemail"
      ],
      "description": "Disposition to set for the call.",
      "example": "Connected"
    }
  },
  "required": [
    "disposition"
  ]
}
```

### `CallAiAgent`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "ID of the Voice AI Agent.",
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "description": "Name of the Voice AI Agent."
    }
  }
}
```

### `CallTranscript`

```json
{
  "type": "object",
  "properties": {
    "speaker": {
      "type": "string"
    },
    "occurred_at": {
      "type": "number"
    },
    "transcript": {
      "type": "string"
    },
    "confidence": {
      "type": "number",
      "nullable": true
    }
  },
  "required": [
    "occurred_at",
    "speaker",
    "transcript"
  ]
}
```

### `Call`

```json
{
  "type": "object",
  "properties": {
    "callId": {
      "description": "The ID of this call.",
      "type": "string",
      "format": "ObjectId"
    },
    "leadId": {
      "description": "The ID of the lead associated with this call.",
      "type": "string",
      "format": "ObjectId"
    },
    "externalLeadId": {
      "type": "string",
      "description": "Optional external ID for the lead.",
      "nullable": true
    },
    "callType": {
      "type": "string",
      "description": "The type of call."
    },
    "customerCallStatus": {
      "type": "string"
    },
    "agentCallStatus": {
      "type": "string"
    },
    "disposition": {
      "type": "string",
      "description": "Current disposition of the call."
    },
    "isOutboundCall": {
      "type": "boolean",
      "description": "Call direction."
    },
    "duration": {
      "type": "number",
      "description": "Duration of the call in seconds.",
      "nullable": true
    },
    "startedAt": {
      "type": "number",
      "description": "Timestamp when the call was initiated.",
      "nullable": true
    },
    "updatedAt": {
      "type": "number",
      "description": "Timestamp when the call was last updated.",
      "nullable": true
    },
    "finishedAt": {
      "type": "number",
      "description": "Timestamp when the call ended.",
      "nullable": true
    },
    "analyzedAt": {
      "type": "number",
      "description": "Timestamp when the call ended.",
      "nullable": true
    },
    "notes": {
      "type": "string",
      "nullable": true
    },
    "callAiAgent": {
      "description": "The AI agent used for the call.",
      "anyOf": [
        {
          "$ref": "#/components/schemas/CallAiAgent"
        },
        {
          "type": "object",
          "nullable": true
        }
      ]
    },
    "destinationNumber": {
      "type": "string",
      "description": "The phone number the call was made to.",
      "nullable": true
    },
    "sourceNumber": {
      "type": "string",
      "description": "The phone number the call was made from.",
      "nullable": true
    },
    "recordingUrl": {
      "type": "string",
      "description": "URL of the call recording.",
      "nullable": true
    },
    "slots": {
      "type": "object",
      "description": "Slot values extracted from the call.",
      "additionalProperties": {},
      "nullable": true
    },
    "transcript": {
      "type": "array",
      "description": "Transcript of the call conversation.",
      "items": {
        "$ref": "#/components/schemas/CallTranscript"
      },
      "nullable": true
    },
    "callMetadata": {
      "type": "object",
      "description": "Metadata associated with the call.",
      "additionalProperties": {},
      "nullable": true
    }
  },
  "required": [
    "callId",
    "callType",
    "leadId"
  ]
}
```

### `CallList`

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "description": "Paginated calls for incremental sync.",
      "items": {
        "$ref": "#/components/schemas/Call"
      }
    },
    "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"
  ]
}
```

### `CallAiAgentList`

```json
{
  "type": "object",
  "properties": {
    "agents": {
      "type": "array",
      "description": "A list of available AI Call Agents.",
      "items": {
        "$ref": "#/components/schemas/CallAiAgent"
      }
    }
  },
  "required": [
    "agents"
  ]
}
```

### `TrackCallRequest`

```json
{
  "type": "object",
  "properties": {
    "startedAt": {
      "type": "string",
      "format": "date-time"
    },
    "finishedAt": {
      "type": "string",
      "format": "date-time"
    },
    "vendorCallId": {
      "type": "string"
    },
    "vendorName": {
      "type": "string"
    },
    "callType": {
      "description": "The type of tracked call.",
      "example": "AgentStarted",
      "type": "string",
      "enum": [
        "CustomerStarted",
        "AgentStarted",
        "DialerStarted",
        "DoorVisit"
      ]
    },
    "recordingUrl": {
      "type": "string"
    },
    "callDisposition": {
      "description": "Optional disposition to set for the tracked call.",
      "example": "Connected",
      "type": "string",
      "enum": [
        "Busy",
        "Failed",
        "Answering Machine",
        "No Answer",
        "Connected",
        "Appointment Set",
        "Live Transferred",
        "Live Transfer Failed",
        "Call Back Later",
        "Did Not Leave Voicemail",
        "Do Not Call",
        "Do Not Contact",
        "Left Voicemail",
        "Not Interested",
        "No Conversation",
        "Reconnect Later",
        "Wrong Number",
        "Call Blocked, Detected as Spam",
        "Door Visit",
        "Agent Voicemail",
        null
      ],
      "nullable": true
    },
    "lead": {
      "anyOf": [
        {
          "type": "object",
          "nullable": true
        },
        {
          "$ref": "#/components/schemas/CreateLead"
        }
      ]
    }
  },
  "required": [
    "callType",
    "finishedAt",
    "recordingUrl",
    "startedAt",
    "vendorCallId",
    "vendorName"
  ]
}
```

### `SchedulingSettings`

```json
{
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean",
      "description": "Enable or disable scheduled calling",
      "example": true
    }
  },
  "required": [
    "enabled"
  ]
}
```

### `SchedulingStatus`

```json
{
  "type": "object",
  "properties": {
    "enabled": {
      "type": "boolean",
      "description": "Whether scheduled calling is enabled",
      "example": true
    },
    "current_status": {
      "type": "string",
      "enum": [
        "Active",
        "Disabled",
        "Sleeping"
      ],
      "description": "Current scheduling status",
      "example": "Active"
    }
  }
}
```

### `CustomPropertyCreateRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable custom property name. The stored name is sanitized to the custom property camelCase identifier.",
      "example": "Financing Status"
    },
    "description": {
      "type": "string",
      "description": "Optional human-readable description for this custom property.",
      "example": "How the lead plans to finance the purchase.",
      "nullable": true
    },
    "schema": {
      "type": "object",
      "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
      "oneOf": [
        {
          "type": "object",
          "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            }
          },
          "required": [
            "type"
          ],
          "not": {
            "required": [
              "enum"
            ]
          },
          "example": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "description": "NUMBER value schema. Use with dataType NUMBER.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "number"
          }
        },
        {
          "type": "object",
          "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "boolean"
          }
        },
        {
          "type": "object",
          "description": "ARRAY value schema. items.type supports string, number, or boolean.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "array"
              ]
            },
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "required": [
            "type",
            "items"
          ],
          "example": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "x-enum-descriptions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "enum"
          ],
          "example": {
            "type": "string",
            "enum": [
              "cash",
              "financed"
            ],
            "x-enum-descriptions": [
              "Cash buyer",
              "Needs financing"
            ]
          }
        }
      ],
      "example": {
        "type": "string",
        "enum": [
          "cash",
          "financed"
        ],
        "x-enum-descriptions": [
          "Cash buyer",
          "Needs financing"
        ]
      },
      "additionalProperties": {}
    },
    "required": {
      "type": "boolean",
      "default": false,
      "description": "Whether this property should be considered required. Use this top-level field instead of schema.required.",
      "example": false,
      "nullable": true
    },
    "dataType": {
      "type": "string",
      "default": "STRING",
      "enum": [
        "DATE",
        "DATETIME",
        "ANNIVERSARY_DATE",
        "TIME",
        "STRING",
        "NUMBER",
        "BOOLEAN",
        "ARRAY",
        "ENUM"
      ],
      "description": "Semantic custom property data type. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema plus this semantic value.",
      "example": "ENUM"
    },
    "dataOnly": {
      "type": "boolean",
      "default": false,
      "description": "Whether the property is data-only. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled.",
      "example": false,
      "nullable": true
    },
    "usedForLlmContext": {
      "type": "boolean",
      "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly. When omitted, this value is derived from dataOnly after create defaults are applied.",
      "example": false,
      "nullable": true
    }
  },
  "required": [
    "name",
    "schema"
  ]
}
```

### `CustomPropertyPatchRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "New custom property name. When omitted, the current sanitized name is preserved.",
      "example": "Updated Financing Status"
    },
    "description": {
      "type": "string",
      "description": "Updated description. Explicit null leaves the current value unchanged.",
      "example": "Updated financing details.",
      "nullable": true
    },
    "schema": {
      "type": "object",
      "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
      "oneOf": [
        {
          "type": "object",
          "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            }
          },
          "required": [
            "type"
          ],
          "not": {
            "required": [
              "enum"
            ]
          },
          "example": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "description": "NUMBER value schema. Use with dataType NUMBER.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "number"
          }
        },
        {
          "type": "object",
          "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "boolean"
          }
        },
        {
          "type": "object",
          "description": "ARRAY value schema. items.type supports string, number, or boolean.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "array"
              ]
            },
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "required": [
            "type",
            "items"
          ],
          "example": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "x-enum-descriptions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "enum"
          ],
          "example": {
            "type": "string",
            "enum": [
              "cash",
              "financed"
            ],
            "x-enum-descriptions": [
              "Cash buyer",
              "Needs financing"
            ]
          }
        }
      ],
      "example": {
        "type": "number"
      },
      "additionalProperties": {}
    },
    "required": {
      "type": "boolean",
      "description": "Updated required flag. Explicit null leaves the current value unchanged.",
      "example": true,
      "nullable": true
    },
    "dataType": {
      "type": "string",
      "enum": [
        "DATE",
        "DATETIME",
        "ANNIVERSARY_DATE",
        "TIME",
        "STRING",
        "NUMBER",
        "BOOLEAN",
        "ARRAY",
        "ENUM"
      ],
      "description": "Updated semantic custom property data type. Explicit null leaves the current value unchanged.",
      "example": "NUMBER"
    },
    "dataOnly": {
      "type": "boolean",
      "description": "Updated data-only flag. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled. Explicit null leaves the current value unchanged.",
      "example": false,
      "nullable": true
    },
    "usedForLlmContext": {
      "type": "boolean",
      "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly. Omitted or null values preserve the existing effective setting, even when dataOnly changes in the same request.",
      "example": false,
      "nullable": true
    }
  }
}
```

### `CustomProperty`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "Custom property definition ID.",
      "example": "650ba6ced07cb5552a2467b0",
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "description": "Sanitized custom property camelCase identifier.",
      "example": "financingStatus"
    },
    "description": {
      "type": "string",
      "description": "Custom property description, when set.",
      "example": "How the lead plans to finance the purchase.",
      "nullable": true
    },
    "schema": {
      "type": "object",
      "description": "JSON Schema Draft-07 fragment for the custom property value. Supported fragments are STRING {'type': 'string'}, NUMBER {'type': 'number'}, BOOLEAN {'type': 'boolean'}, ARRAY {'type': 'array', 'items': {'type': 'string'}} with items.type of string, number, or boolean, and ENUM {'type': 'string', 'enum': [...], 'x-enum-descriptions': [...]}. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use a string schema with the semantic dataType; callers do not need to provide format. schema.required is not part of the public Direct API contract and is stripped by custom property validation; use the top-level required field instead.",
      "oneOf": [
        {
          "type": "object",
          "description": "STRING and date/time semantic value schema. Use with dataType STRING, DATE, DATETIME, ANNIVERSARY_DATE, or TIME. DATE, DATETIME, ANNIVERSARY_DATE, and TIME use this same string schema plus semantic dataType; format is optional.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            }
          },
          "required": [
            "type"
          ],
          "not": {
            "required": [
              "enum"
            ]
          },
          "example": {
            "type": "string"
          }
        },
        {
          "type": "object",
          "description": "NUMBER value schema. Use with dataType NUMBER.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "number"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "number"
          }
        },
        {
          "type": "object",
          "description": "BOOLEAN value schema. Use with dataType BOOLEAN.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "boolean"
              ]
            }
          },
          "required": [
            "type"
          ],
          "example": {
            "type": "boolean"
          }
        },
        {
          "type": "object",
          "description": "ARRAY value schema. items.type supports string, number, or boolean.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "array"
              ]
            },
            "items": {
              "type": "object",
              "properties": {
                "type": {
                  "type": "string",
                  "enum": [
                    "string",
                    "number",
                    "boolean"
                  ]
                }
              },
              "required": [
                "type"
              ]
            }
          },
          "required": [
            "type",
            "items"
          ],
          "example": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        {
          "type": "object",
          "description": "ENUM value schema. enum options stay in schema.enum; optional labels stay in x-enum-descriptions.",
          "properties": {
            "type": {
              "type": "string",
              "enum": [
                "string"
              ]
            },
            "enum": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "x-enum-descriptions": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          "required": [
            "type",
            "enum"
          ],
          "example": {
            "type": "string",
            "enum": [
              "cash",
              "financed"
            ],
            "x-enum-descriptions": [
              "Cash buyer",
              "Needs financing"
            ]
          }
        }
      ],
      "example": {
        "type": "string",
        "enum": [
          "cash",
          "financed"
        ],
        "x-enum-descriptions": [
          "Cash buyer",
          "Needs financing"
        ]
      },
      "additionalProperties": {}
    },
    "required": {
      "type": "boolean",
      "description": "Whether this property is required.",
      "example": false
    },
    "dataType": {
      "type": "string",
      "enum": [
        "DATE",
        "DATETIME",
        "ANNIVERSARY_DATE",
        "TIME",
        "STRING",
        "NUMBER",
        "BOOLEAN",
        "ARRAY",
        "ENUM"
      ],
      "description": "Semantic custom property data type.",
      "example": "ENUM"
    },
    "dataOnly": {
      "type": "boolean",
      "description": "Whether this property is data-only. Data-only properties are not extracted from conversations; they can still be injected into LLM context when usedForLlmContext is enabled.",
      "example": false
    },
    "usedForLlmContext": {
      "type": "boolean",
      "description": "This setting controls whether a custom property is included in automatic LLM lead_metadata prompt context. It does not change extraction behavior, which remains controlled by dataOnly.",
      "example": false
    }
  },
  "required": [
    "dataOnly",
    "dataType",
    "id",
    "name",
    "required",
    "schema",
    "usedForLlmContext"
  ]
}
```

### `CustomPropertyListResponse`

```json
{
  "type": "object",
  "properties": {
    "customProperties": {
      "type": "array",
      "description": "Custom property definitions for the authenticated account.",
      "items": {
        "$ref": "#/components/schemas/CustomProperty"
      }
    }
  },
  "required": [
    "customProperties"
  ]
}
```

### `CustomPropertyDeleteResponse`

```json
{
  "type": "object",
  "properties": {
    "ok": {
      "type": "boolean",
      "description": "True when the custom property definition was deleted.",
      "example": true
    }
  },
  "required": [
    "ok"
  ]
}
```

### `WebhookCreateRequest`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "description": "Human-readable webhook name.",
      "example": "my webhook"
    },
    "target": {
      "type": "string",
      "description": "HTTPS URL where webhook events will be delivered.",
      "example": "https://example.com/webhooks"
    },
    "triggers": {
      "type": "array",
      "description": "List of events that should trigger this webhook.",
      "example": [
        "lead:created",
        "message"
      ],
      "items": {
        "type": "string",
        "enum": [
          "lead:created",
          "lead:updated",
          "call:created",
          "call:updated",
          "message",
          "custom-tool"
        ]
      }
    }
  },
  "required": [
    "name",
    "target",
    "triggers"
  ]
}
```

### `WebhookPatchRequest`

```json
{
  "type": "object",
  "properties": {
    "status": {
      "type": "string",
      "enum": [
        "active",
        "disabled"
      ],
      "description": "Webhook status to apply.",
      "example": "active"
    }
  },
  "required": [
    "status"
  ]
}
```

### `WebhookCreateResponse`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "description": "Webhook ID.",
      "example": "650ba6ced07cb5552a2467b0",
      "type": "string",
      "format": "ObjectId"
    },
    "name": {
      "type": "string",
      "description": "Human-readable webhook name.",
      "example": "my webhook"
    },
    "target": {
      "type": "string",
      "description": "HTTPS URL where webhook events are delivered."
    },
    "secret": {
      "type": "string",
      "description": "Webhook signing secret.",
      "example": "A4h5Q8Y3y9D7s2P4n6V1k3R0t8W2x5Z7b9C1d4F6g8H0j2K4"
    },
    "triggers": {
      "type": "array",
      "description": "Events that trigger this webhook.",
      "example": [
        "message"
      ],
      "items": {
        "type": "string",
        "enum": [
          "lead:created",
          "lead:updated",
          "call:created",
          "call:updated",
          "message",
          "custom-tool"
        ]
      }
    },
    "status": {
      "description": "Current webhook status.",
      "example": "active",
      "type": "string",
      "enum": [
        "active",
        "disabled",
        "failed"
      ]
    },
    "consecutiveFailures": {
      "type": "integer",
      "description": "Number of consecutive failed delivery attempts.",
      "example": 0
    },
    "totalSuccessfulRequests": {
      "type": "integer",
      "description": "Total successful webhook delivery attempts.",
      "example": 0
    },
    "totalFailedRequests": {
      "type": "integer",
      "description": "Total failed webhook delivery attempts.",
      "example": 0
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "description": "Webhook creation timestamp."
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "Webhook last update timestamp."
    }
  },
  "required": [
    "consecutiveFailures",
    "createdAt",
    "id",
    "name",
    "secret",
    "status",
    "target",
    "totalFailedRequests",
    "totalSuccessfulRequests",
    "triggers",
    "updatedAt"
  ]
}
```

### `WebhookListResponse`

```json
{
  "type": "object",
  "properties": {
    "webhooks": {
      "type": "array",
      "description": "Webhook resources for the authenticated account.",
      "items": {
        "$ref": "#/components/schemas/WebhookCreateResponse"
      }
    }
  },
  "required": [
    "webhooks"
  ]
}
```

### `KnowledgeBaseAnswer`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "question": {
      "type": "string"
    },
    "answer": {
      "type": "string"
    }
  },
  "required": [
    "answer",
    "question"
  ]
}
```

### `KnowledgeBase`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "ObjectId"
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "nullable": true
    },
    "name": {
      "type": "string"
    },
    "isEnabled": {
      "type": "boolean"
    },
    "type": {
      "type": "string"
    },
    "size": {
      "type": "integer"
    },
    "customAnswers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBaseAnswer"
      }
    }
  },
  "required": [
    "createdAt",
    "customAnswers",
    "id",
    "isEnabled",
    "name",
    "size",
    "type"
  ]
}
```

### `KnowledgeBaseListResponse`

```json
{
  "type": "object",
  "properties": {
    "knowledgeBases": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBase"
      }
    }
  },
  "required": [
    "knowledgeBases"
  ]
}
```

### `CreateKnowledgeBase`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "customAnswers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBaseAnswer"
      }
    }
  },
  "required": [
    "name"
  ]
}
```

### `PatchKnowledgeBase`

```json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "customAnswers": {
      "type": "array",
      "items": {
        "$ref": "#/components/schemas/KnowledgeBaseAnswer"
      }
    }
  }
}
```

### `Channel`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "SMS channel ID.",
      "example": "650ba6ced07cb5552a2467b0",
      "format": "ObjectId"
    },
    "channelType": {
      "type": "string",
      "enum": [
        "SMS"
      ],
      "description": "Channel type.",
      "example": "SMS"
    },
    "address": {
      "type": "string",
      "description": "SMS source address.",
      "example": "+13035555555"
    },
    "enabled": {
      "type": "boolean",
      "description": "Whether the channel is active.",
      "example": true
    },
    "campaignId": {
      "type": "string",
      "description": "Assigned Campaign ID, or null when no Campaign is assigned.",
      "format": "ObjectId",
      "nullable": true
    },
    "voiceAgentId": {
      "type": "string",
      "description": "Assigned Voice AI Agent ID, or null when no Voice AI Agent is assigned.",
      "format": "ObjectId",
      "nullable": true
    }
  },
  "required": [
    "address",
    "campaignId",
    "channelType",
    "enabled",
    "id",
    "voiceAgentId"
  ]
}
```

### `ChannelListResponse`

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "description": "Cursor-paginated SMS channels.",
      "items": {
        "$ref": "#/components/schemas/Channel"
      }
    },
    "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"
  ]
}
```

### `PatchChannel`

```json
{
  "type": "object",
  "properties": {
    "campaignId": {
      "description": "Campaign ID to assign, or null to clear the Campaign assignment.",
      "type": "string",
      "format": "ObjectId",
      "nullable": true
    },
    "voiceAgentId": {
      "description": "Voice AI Agent ID to assign, or null to clear the Voice AI Agent assignment.",
      "type": "string",
      "format": "ObjectId",
      "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"
  ]
}
```

### `CustomReport`

```json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "SHA-256 hex digest of the report file name.",
      "example": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
    },
    "name": {
      "type": "string",
      "description": "S3 object file name relative to the report prefix.",
      "example": "weekly-2026-08-21.csv"
    },
    "category": {
      "type": "string",
      "description": "Custom report category (DirectPlatformCustomReport.name).",
      "example": "weekly"
    },
    "date": {
      "type": "string",
      "format": "date-time",
      "description": "S3 LastModified timestamp in UTC ISO-8601."
    },
    "downloadReport": {
      "type": "string",
      "description": "Direct API URL to download this custom report object.",
      "example": "https://api.structurely.com/api/direct/v2/custom-reports/weekly/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"
    }
  },
  "required": [
    "category",
    "date",
    "downloadReport",
    "id",
    "name"
  ]
}
```

### `CustomReportListResponse`

```json
{
  "type": "object",
  "properties": {
    "items": {
      "type": "array",
      "description": "Custom report objects for the authenticated account.",
      "items": {
        "$ref": "#/components/schemas/CustomReport"
      }
    }
  },
  "required": [
    "items"
  ]
}
```

### `CustomReportDownloadResponse`

```json
{
  "type": "object",
  "properties": {
    "downloadReport": {
      "type": "string",
      "description": "1-hour presigned S3 GET URL for the custom report object."
    }
  },
  "required": [
    "downloadReport"
  ]
}
```

## Security

### `bearer-access-token`

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