Contacts
Full contact management scoped to a firm. Each contact supports multiple phones, emails, addresses, and free-form tags. Includes bulk operations and asynchronous CSV import via RabbitMQ background queue.
When to use this module
- Add or edit contacts → CRUD endpoints (
POST /contact/create,PUT /contact/update) - Organize contacts with labels → tagging endpoints (
PUT /contact/add-or-remove-tags) - Import contacts from spreadsheet → CSV import (
POST /contact/import/upload) - Send WhatsApp messages → contacts provide recipient data (phone numbers)
All Endpoints
| Method | Route | Auth | Description |
|---|---|---|---|
| POST | /api/v1/Contact/create | Create a new contact | |
| GET | /api/v1/Contact/get/{id} | Get contact by ID | |
| POST | /api/v1/Contact/getall | Paginated contact list (filter, sort, tag filter) | |
| PUT | /api/v1/Contact/update | Update contact + nested children (phones, emails, addresses) | |
| DELETE | /api/v1/Contact/delete | Soft-delete a single contact | |
| DELETE | /api/v1/Contact/bulkdelete | Bulk soft-delete by list of IDs | |
| GET | /api/v1/Contact/search | Search contacts (mode: whatsapp filters by phone) | |
| PUT | /api/v1/Contact/add-or-remove-tags | Add/remove tags on one contact | |
| PUT | /api/v1/Contact/bulk-add-or-remove-tags | Bulk tag operations across multiple contacts | |
| GET | /api/v1/Contact/tags/search | Search existing tag names in the firm | |
| POST | /api/v1/Contact/import/upload | Queue CSV import job (returns 202 Accepted) |
/api/v1/Contact/create
Creates a new contact scoped to the current firm (authenticated via API Key). Accepts nested phone numbers, email addresses, and postal addresses in a single request.
Request Body
{
"firstName": "John",
"lastName": "Smith",
"gender": "Male",
"isActive": true,
"profilePic": "https://url.to.pic/john.png",
"phones": [
{ "phone": "9876543210", "phoneCC": "+91", "type": 1, "isPrimary": true }
],
"emails": [
{ "email": "john@company.com", "type": 1, "isPrimary": true }
],
"addresses": [
{
"type": 1,
"line1": "123 Main St",
"line2": "Suite 400",
"landmark": "Near Central Park",
"city": "Mumbai",
"state": "Maharashtra",
"country": "India",
"pinCode": "400001"
}
],
"tags": ["VIP", "Lead"]
}Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
firstName | string(50) | required | Contact's first name |
lastName | string(50) | required | Contact's last name |
gender | string | optional | Male / Female / Other |
isActive | bool | optional | Defaults to true |
profilePic | string | optional | Azure Blob URL of profile picture |
phones | array | optional | List of phone entries; only one can be isPrimary |
emails | array | optional | List of email entries; only one can be isPrimary |
addresses | array | optional | List of postal addresses |
tags | string[] | optional | List of free-form tags |
/api/v1/Contact/getall
Returns a paginated, filtered, and sortable list of contacts belonging to the current firm. Supports optional tag-based filtering to narrow results by label.
Request Body
{
"page": 1,
"pageSize": 20,
"searchTerm": "",
"sortBy": "firstName",
"sortDesc": false,
"tags": []
}Request Parameters
| Field | Type | Description |
|---|---|---|
page | int | 1-based page number |
pageSize | int | Number of records per page (max 100) |
searchTerm | string | Free-text search across name, email, phone |
sortBy | string | Field to sort by (e.g. firstName, lastName) |
sortDesc | bool | Descending sort when true |
tags | string[] | Filter to contacts having ALL listed tags |
/api/v1/Contact/search
Quick search endpoint with an optional mode query parameter. When mode=whatsapp the results are filtered to contacts that have at least one phone number (suitable for recipient selection in WhatsApp sends).
?searchTerm=john&mode=whatsapp to restrict results to contacts with phone numbers. Omit mode for a general name/email search./api/v1/Contact/bulkdelete
Soft-deletes multiple contacts in a single request. Contacts are not permanently removed — they are marked as deleted and excluded from normal queries.
Request Body
{
"ids": [
"3fa85f64-5717-4562-b3fc-2c963f66afa6",
"7cb2a123-1234-5678-abcd-ef9876543210"
]
}/api/v1/Contact/add-or-remove-tags
Adds and/or removes tags on a single contact in one atomic operation. Tags are free-form strings — they are created on-the-fly if they don't already exist. Use /bulk-add-or-remove-tags for multi-contact tag operations.
Request Body
{
"contactId": "guid-here",
"tagsToAdd": ["VIP", "Lead"],
"tagsToRemove": ["Prospect"]
}Tag Search
Use GET /api/v1/Contact/tags/searchvi to autocomplete tag names from existing firm tags. Ideal for building tag-picker UIs.
/api/v1/Contact/import/upload
Queues an asynchronous CSV import job. The file must first be uploaded via the File Upload module to obtain a fileId. This endpoint publishes the job to a RabbitMQ queue and immediately returns HTTP 202 Accepted.
CSV Import Flow
Response (HTTP 202)
{
"isSuccess": true,
"data": null,
"message": "Import queued successfully"
}FirstName, LastName, PhoneNumber, PhoneCC, Email, City, Country. Additional columns are silently ignored.