API reference
Contacts
The people the workspace knows: their details, attributes and whether your site verified them.
GET /contacts
List contacts
The workspace's contacts, most recently seen first: who they are, how to reach them, their attributes and whether a host site verified them. Filter by email, phone or external_id to look one person up. A key limited to some agents lists the contacts of those agents.
Scope: contacts:read
Parameters
limitoptional in the query ·integerRows per page, 1 to 100.
cursoroptional in the query ·stringThe next_cursor of the previous page.
emailoptional in the query ·stringOnly the contact with this email (any casing).
phoneoptional in the query ·stringOnly the contact with this phone number, however it is written.
external_idoptional in the query ·stringOnly the contact with this external_id.
verifiedoptional in the query ·booleanOnly verified (true) or unverified (false) contacts.
Returns Contact
idrequiredstringId
external_idoptionalstringYour own id for this person; null when none was given.
namerequiredstringName
emailrequiredstringEmail
phonerequiredstringPhone
attributesrequiredobjectA flat object of text, numbers and booleans.
verifiedrequiredbooleanTrue when a host site proved this person's identity with an agent's identity secret.
sourcerequiredstringHow the contact first arrived: manual, import, identify, lead or api.
first_seen_atoptionalstringFirst Seen At
last_seen_atoptionalstringLast Seen At
created_atoptionalstringCreated At
updated_atoptionalstringUpdated At
consent_marketingoptionalbooleanThe person explicitly agreed to campaign emails.
consent_marketing_atoptionalstringConsent Marketing At
localeoptionalstringThe language campaign emails reach them in: en, ar, or empty.
marketing_statusoptionalstringsubscribed, not_subscribed, unsubscribed, bounced or complained.
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/contacts \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"POST /contacts
Create or update a contact
Add a person, or complete the contact they already are: matched by external_id, then by email, then by phone. Send at least one of the three. A new contact answers 201 with a Location; an existing one answers 200 with the values you sent written over it (an empty value leaves what is there) and attributes merged by key. An email or phone that already belongs to another contact is kept for reading and does not become a second key for the same number. New contacts emit contact.created. Needs a key that reaches every agent.
Scope: contacts:write
Request body
external_idoptionalstringYour own id for this person. Unique in the workspace.
nameoptionalstringName
emailoptionalstringEmail
phoneoptionalstringPhone
attributesoptionalobjectA flat object: up to 20 keys (lower-case names), values of text (200 characters), numbers or booleans.
consent_marketingoptionalbooleanTrue only when the person explicitly agreed to campaign emails from you; false withdraws it. A person who unsubscribed, bounced or complained is not given consent again; the rest of the contact is still saved.
localeoptionalstringThe language campaign emails reach them in: en or ar (an empty string clears it).
Returns Contact
idrequiredstringId
external_idoptionalstringYour own id for this person; null when none was given.
namerequiredstringName
emailrequiredstringEmail
phonerequiredstringPhone
attributesrequiredobjectA flat object of text, numbers and booleans.
verifiedrequiredbooleanTrue when a host site proved this person's identity with an agent's identity secret.
sourcerequiredstringHow the contact first arrived: manual, import, identify, lead or api.
first_seen_atoptionalstringFirst Seen At
last_seen_atoptionalstringLast Seen At
created_atoptionalstringCreated At
updated_atoptionalstringUpdated At
consent_marketingoptionalbooleanThe person explicitly agreed to campaign emails.
consent_marketing_atoptionalstringConsent Marketing At
localeoptionalstringThe language campaign emails reach them in: en, ar, or empty.
marketing_statusoptionalstringsubscribed, not_subscribed, unsubscribed, bounced or complained.
Responses
201Successful 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.200The person was already a contact and was completed.
curl -X POST https://www.bidii.ai/api/v2/contacts \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"external_id": "u_42", "name": "Sara", "email": "sara@example.ae", "attributes": {"plan": "Gold"}}'GET /contacts/{contact_id}
Get a contact
One contact by id.
Scope: contacts:read
Parameters
contact_idrequired in the path ·string
Returns Contact
idrequiredstringId
external_idoptionalstringYour own id for this person; null when none was given.
namerequiredstringName
emailrequiredstringEmail
phonerequiredstringPhone
attributesrequiredobjectA flat object of text, numbers and booleans.
verifiedrequiredbooleanTrue when a host site proved this person's identity with an agent's identity secret.
sourcerequiredstringHow the contact first arrived: manual, import, identify, lead or api.
first_seen_atoptionalstringFirst Seen At
last_seen_atoptionalstringLast Seen At
created_atoptionalstringCreated At
updated_atoptionalstringUpdated At
consent_marketingoptionalbooleanThe person explicitly agreed to campaign emails.
consent_marketing_atoptionalstringConsent Marketing At
localeoptionalstringThe language campaign emails reach them in: en, ar, or empty.
marketing_statusoptionalstringsubscribed, not_subscribed, unsubscribed, bounced or complained.
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/contacts/CONTACT_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"PATCH /contacts/{contact_id}
Update a contact
Change any of name, email, phone and attributes. Only what you send changes. An email or phone that already belongs to another contact answers 409.
Scope: contacts:write
Parameters
contact_idrequired in the path ·string
Request body
nameoptionalstringName
emailoptionalstringAn empty string clears it.
phoneoptionalstringAn empty string clears it.
attributesoptionalobjectMerged by key; a null value removes its key.
consent_marketingoptionalbooleanTrue only when the person explicitly agreed to campaign emails from you; false withdraws it. A person who unsubscribed, bounced or complained cannot be given consent again (409
conflict,marketing_suppressed).localeoptionalstringThe language campaign emails reach them in: en or ar (an empty string clears it).
Returns Contact
idrequiredstringId
external_idoptionalstringYour own id for this person; null when none was given.
namerequiredstringName
emailrequiredstringEmail
phonerequiredstringPhone
attributesrequiredobjectA flat object of text, numbers and booleans.
verifiedrequiredbooleanTrue when a host site proved this person's identity with an agent's identity secret.
sourcerequiredstringHow the contact first arrived: manual, import, identify, lead or api.
first_seen_atoptionalstringFirst Seen At
last_seen_atoptionalstringLast Seen At
created_atoptionalstringCreated At
updated_atoptionalstringUpdated At
consent_marketingoptionalbooleanThe person explicitly agreed to campaign emails.
consent_marketing_atoptionalstringConsent Marketing At
localeoptionalstringThe language campaign emails reach them in: en, ar, or empty.
marketing_statusoptionalstringsubscribed, not_subscribed, unsubscribed, bounced or complained.
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.409conflict:detailssays why:contact_exists, the email or phone belongs to another contact;marketing_suppressed, the person unsubscribed, so consent cannot be given for them.
curl -X PATCH https://www.bidii.ai/api/v2/contacts/CONTACT_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"attributes": {"plan": "Platinum"}}'DELETE /contacts/{contact_id}
Delete a contact
Delete the contact, everything an agent remembers of them and their leads. Their conversations stay, no longer linked to a contact. Needs a key that reaches every agent; a contact with leads needs leads:write as well (403 insufficient_scope otherwise, and nothing is deleted).
Scope: contacts:write
Parameters
contact_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/contacts/CONTACT_ID \
-H "Authorization: Bearer bidi_sk_YOUR_KEY"