Add a lead field
create_lead_fieldAdd a lead field
Adds a custom field to the agent's lead form, after its other custom fields, shown in the
dashboard's table and form. The built-in status, assigned_to, notes and created_at
come last on an agent whose fields were never reordered, so the new field goes before
them. The AI's lead capture starts collecting it in the background, usually within a
minute: the label tells the AI what to ask for, and required makes it treat the field
as needed before it saves a lead. A reserved key is 422 invalid_request (see key); any
other key the agent already has, built-in fields included, is 409 field_key_taken; an
agent that already has 50 custom fields is 422 lead_field_limit_reached.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | Yes | The field's key in a lead's `custom_fields`: lowercase letters, digits and underscores, starting with a letter. It can't change later. A reserved key is `422 invalid_request`: the lead properties `id`, `agent_id`, `status`, `created_at`, `updated_at`, `conversation_id`, `name`, `email`, `phone` and `summary`, and the keys Mojeeb fills itself, `source`, `captured_at` and `user_message`; any other key the agent already has, built-in fields included, is `409 field_key_taken`. | |
| type | Yes | The input type, written in lowercase. An `enum` field takes its choices in `options`. | |
| label | Yes | What your team sees, and what tells the AI what to ask for. Can't contain angle brackets. | |
| options | No | The choices of an `enum` field, in the order they are shown, each `value` distinct. Required for `enum` and refused with any other type. | |
| agent_id | Yes | The agent the resource belongs to. Another company's agent, or the nil UUID, is `404 agent_not_found`; an agent outside the key's agent list is `403 agent_not_authorized`. | |
| required | No | Whether the AI treats the field as needed before it saves a lead. False when left out. |