The read → enrich → write loop
The most common agent workflow:Read context
GET /v1/contacts/{id}?include=notes,tasks,deals returns the contact plus the top 3 recent notes, open tasks, and open deals — one round-trip, no N+1.Enrich
Use the embedded
recent_notes / open_tasks / open_deals to build a prompt. Each contact row also has a clean first_name / last_name / full_name even if the DB is missing pieces (self-healing on read).cURL — one-call context + log a note
Writing by name (fuzzy lookup)
Agents often have the human’s name but not their UUID. Every create endpoint that takes a parent link accepts both:| Body field | What it does |
|---|---|
contact_id | Explicit UUID. Wins if present. |
contact_name | Fuzzy match within the workspace. Resolves to contact_id. |
company_id / related_company_id | Explicit company UUID. |
company_name | Fuzzy company match. |
Disambiguation
If the fuzzy name is ambiguous, the API returns400 ambiguous_reference with all candidate UUIDs in the message — agents should retry with the correct contact_id:
Embedded parent summaries on reads
GET /v1/notes, GET /v1/tasks, and their sub-resources return a compact linked-entity block per row so agents can render rich context without N+1 lookups:
/v1/tasks (adds event too). One GET → enough data to say “Note on Hans Müller at Roche AG”.
Lexi chat vs direct REST
When should an agent use Lexi’s chat endpoint vs the REST API directly?| If you need… | Use |
|---|---|
| Natural-language understanding, multi-turn context, tool calling orchestration | POST /v1/lexi/chat — Lexi is already configured with 50+ tools |
| Deterministic single-action read or write | REST API (this page) |
Bulk operations (POST /v1/import/contacts, POST /v1/contacts/bulk-delete) | REST API — Lexi’s per-call credit model is too expensive |
| Webhooks on events (contact.created, etc.) | REST API — Lexi’s internal tool calls don’t fire webhooks |
| Embedding your own AI assistant with custom system prompt | REST API — build your own loop over these endpoints |
Agent-friendly conventions
- Every write accepts
created_date— honored if within ±24 h / last 5 years, so you can log historical events with the real timestamp. - Every note/task/meeting requires a parent link —
contact_idORcompany_idORdeal_idORevent_id. Prevents silent orphans that never show up on a detail page. GET /v1/contacts/{id}?include=notes,tasks,dealsis your one-call context primitive. Passinclude=*for everything.- Sub-resource endpoints inherit the parent from the URL — e.g.
POST /v1/contacts/{id}/notesdoesn’t need a body parent-link field. - Workspace scope is enforced — every UUID is validated against
company_id = your-workspace. Cross-tenant references returnnot_found.
Example: a CrewAI researcher agent
Imagine a researcher that enriches a contact from web sources and logs its findings:See also
- Data Integrity — the write-side guarantees this page depends on
- Create Contact — name handling details
- Create Note — parent-link rules + fuzzy write
- Create Task — parent-link rules + fuzzy write