Companies & Contacts API
All endpoints require a valid Cloudflare Access JWT.
Base path: /api/deals
Companies
Section titled “Companies”GET /api/deals/companies
Section titled “GET /api/deals/companies”List companies with optional search.
| Param | Type | Description |
|---|---|---|
search | query | Filter by name or domain |
page | query | Page number (default 1, 50 per page) |
GET /api/deals/companies/:id
Section titled “GET /api/deals/companies/:id”Get a company with its contacts and deals.
POST /api/deals/companies
Section titled “POST /api/deals/companies”Create a company. Requires can_update on deals.
PUT /api/deals/companies/:id
Section titled “PUT /api/deals/companies/:id”Update a company. Requires can_update on deals.
DELETE /api/deals/companies/:id
Section titled “DELETE /api/deals/companies/:id”Delete a company. Requires can_manage on deals.
Contacts
Section titled “Contacts”GET /api/deals/contacts
Section titled “GET /api/deals/contacts”List contacts with optional search and company filter.
| Param | Type | Description |
|---|---|---|
search | query | Filter by name or email |
company_id | query | Filter by company |
page | query | Page number (default 1, 50 per page) |
GET /api/deals/contacts/:id
Section titled “GET /api/deals/contacts/:id”Get a contact with linked deals.
POST /api/deals/contacts
Section titled “POST /api/deals/contacts”Create a contact. Requires can_update on deals.
PUT /api/deals/contacts/:id
Section titled “PUT /api/deals/contacts/:id”Update a contact. Requires can_update on deals.
DELETE /api/deals/contacts/:id
Section titled “DELETE /api/deals/contacts/:id”Delete a contact. Requires can_manage on deals.
LinkedIn Enrichment
Section titled “LinkedIn Enrichment”POST /api/deals/companies/:id/enrich
Section titled “POST /api/deals/companies/:id/enrich”Enrich a company from LinkedIn via Scrapin.io. Requires can_update on deals.
Calls searchCompany with the company’s name and domain. Stores the raw JSON response in linkedin_data and sets linkedin_enriched_at.
| Param | Type | Description |
|---|---|---|
force | query | Set to true to bypass 24-hour rate guard |
Responses
| Status | Description |
|---|---|
| 200 | { success: true, linkedin_data: {...} } |
| 400 | No LinkedIn data found |
| 404 | Company not found |
| 409 | Already enriched within 24 hours (use ?force=true to override) |
POST /api/deals/contacts/:id/enrich
Section titled “POST /api/deals/contacts/:id/enrich”Enrich a contact from LinkedIn via Scrapin.io. Requires can_update on deals.
If the contact has a linkedin_url, calls enrichLinkedInProfile. Otherwise falls back to searchPerson using the contact’s name, email, and company info. Stores the normalized profile JSON in linkedin_data and sets linkedin_enriched_at. If the contact had no linkedin_url and the enrichment returns one, it is saved automatically.
| Param | Type | Description |
|---|---|---|
force | query | Set to true to bypass 24-hour rate guard |
Responses
| Status | Description |
|---|---|
| 200 | { success: true, linkedin_data: {...} } |
| 400 | No LinkedIn data found |
| 404 | Contact not found |
| 409 | Already enriched within 24 hours (use ?force=true to override) |