API reference
Leads
People who left their details, where they stand, and an agent's own lead fields.
GET /leads
List leads
Leads across the workspace's agents, newest first: name, how to reach them, what they asked about, the agent's own fields in data, the team's notes, and the conversation they came from.
Scope: leads:read
Parameters
limitoptional in the query ·integerRows per page, 1 to 100.
cursoroptional in the query ·stringThe next_cursor of the previous page.
agent_idoptional in the query ·stringOnly leads captured by this agent.
statusoptional in the query ·"new" | "qualified" | "closed"Only leads in this status.
Returns Lead
idrequiredstringId
agent_idoptionalstringAgent Id
nameoptionalstringName
contactoptionalstringContact
interestoptionalstringInterest
channeloptionalstringChannel
statusrequiredstringnew, qualified or closed.
dataoptionalobjectThe agent's lead fields and job details, by key.
notesoptionalstringThe team's own notes on the lead.
conversation_idoptionalstringConversation Id
created_atrequiredstringCreated At
updated_atoptionalstringWhen the lead was last edited; null until it is.
utmoptionalobjectThe campaign that brought the visitor: any of utm_source, utm_medium, utm_campaign, utm_term and utm_content, as the first page of the visit carried them. Empty when there was none. Read from the lead's conversation.
referreroptionalstringThe site that sent the visitor (scheme, host and path, never the query string). Empty when there was none. Read from the lead's conversation.
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/leads \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"GET /leads/{lead_id}
Get a lead
One lead by id.
Scope: leads:read
Parameters
lead_idrequired in the path ·string
Returns Lead
idrequiredstringId
agent_idoptionalstringAgent Id
nameoptionalstringName
contactoptionalstringContact
interestoptionalstringInterest
channeloptionalstringChannel
statusrequiredstringnew, qualified or closed.
dataoptionalobjectThe agent's lead fields and job details, by key.
notesoptionalstringThe team's own notes on the lead.
conversation_idoptionalstringConversation Id
created_atrequiredstringCreated At
updated_atoptionalstringWhen the lead was last edited; null until it is.
utmoptionalobjectThe campaign that brought the visitor: any of utm_source, utm_medium, utm_campaign, utm_term and utm_content, as the first page of the visit carried them. Empty when there was none. Read from the lead's conversation.
referreroptionalstringThe site that sent the visitor (scheme, host and path, never the query string). Empty when there was none. Read from the lead's conversation.
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/leads/LEAD_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"PATCH /leads/{lead_id}
Update a lead
Change any of: status (new, qualified, closed), name, contact, interest, notes, and data (merged into the lead's fields by key; a null removes a key; a select field takes only one of its options). Send at least one. A status change emits lead.status_changed; every change emits lead.updated.
Scope: leads:write
Parameters
lead_idrequired in the path ·string
Request body
statusoptional"new" | "qualified" | "closed"Status
nameoptionalstringName
contactoptionalstringContact
interestoptionalstringInterest
notesoptionalstringNotes
dataoptionalobjectData
Returns Lead
idrequiredstringId
agent_idoptionalstringAgent Id
nameoptionalstringName
contactoptionalstringContact
interestoptionalstringInterest
channeloptionalstringChannel
statusrequiredstringnew, qualified or closed.
dataoptionalobjectThe agent's lead fields and job details, by key.
notesoptionalstringThe team's own notes on the lead.
conversation_idoptionalstringConversation Id
created_atrequiredstringCreated At
updated_atoptionalstringWhen the lead was last edited; null until it is.
utmoptionalobjectThe campaign that brought the visitor: any of utm_source, utm_medium, utm_campaign, utm_term and utm_content, as the first page of the visit carried them. Empty when there was none. Read from the lead's conversation.
referreroptionalstringThe site that sent the visitor (scheme, host and path, never the query string). Empty when there was none. Read from the lead's conversation.
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl -X PATCH https://www.bidii.ai/api/v2/leads/LEAD_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "qualified"}'DELETE /leads/{lead_id}
Delete a lead
Delete the lead for good. The conversation it came from and any booking made for it stay, no longer linked to it. The workspace's audit log records that a lead was deleted, and by which key.
Scope: leads:write
Parameters
lead_idrequired in the path ·string
Responses
204Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl -X DELETE https://www.bidii.ai/api/v2/leads/LEAD_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"GET /agents/{agent_id}/lead-fields
List an agent's lead fields
The extra details this agent collects with a lead, in the order the owner arranged them: the key each value is stored under in a lead's data, its English and Arabic labels, its kind and, for a select, its options.
Scope: leads:read
Parameters
agent_idrequired in the path ·string
Returns LeadField
idrequiredstringId
agent_idrequiredstringAgent Id
keyrequiredstringThe name the value is stored under in a lead's data.
label_enrequiredstringLabel En
label_arrequiredstringThe Arabic label; empty when the owner gave none.
kindrequiredstringtext, email, phone, number, date or select.
optionsrequiredstring[]The choices of a select field.
requiredrequiredbooleanRequired
ask_whenrequiredstringalways or if_missing.
positionrequiredintegerPosition
created_atoptionalstringCreated At
Responses
200Successful Response401Missing, invalid, revoked or expired key. Leaving the workspace, or being removed from it, revokes the keys a teammate made; a key whose maker's membership ended any other way answerskey_maker_left.403The plan has no API, the key lacks the scope, or the role of the teammate who made the key no longer allows it (maker_role_limit; a publishable key saysinsufficient_scope).404Nothing by that id in this workspace.413The request body is larger than this route accepts (1 MB; 3 MB for a text source). On a source:plan_text_limit, the agent's plan cannot hold more text (limit_chars,used_chars).422The request did not validate;detailslists the fields.429Rate limit reached; waitRetry-Afterseconds.500Our fault; quoterequest_idto support.
curl https://www.bidii.ai/api/v2/agents/AGENT_ID/lead-fields \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"