WACM.in Logo
Back to API Overview
REST API

Contacts API

Manage contacts with custom fields, group assignments, and company-scoped isolation.

Overview

The Contacts API provides a standalone contact management system separate from the Wpbox WhatsApp contacts. Use this API to manage your customer database with custom fields, group assignments, and soft-delete support.

Base URL

https://api.wacm.in/api/v1

Authentication

All Contacts API requests require a valid Laravel Sanctum personal access token:

Authorization Header
curl -H "Authorization: Bearer YOUR_API_TOKEN" \
     https://api.wacm.in/api/v1/contacts

List Contacts

Returns a paginated list of contacts for the authenticated user's company.

GET
/v1/contacts

Query Parameters

ParameterTypeRequiredDescription
limitintegerOptionalNumber of results per page (default: 15)
pageintegerOptionalPage number for pagination
Example Request
curl -H "Authorization: Bearer YOUR_TOKEN" \
     "https://api.wacm.in/api/v1/contacts?limit=10&page=1"

Response

200 OK
{
  "data": [
    {
      "id": 1,
      "name": "John Doe",
      "phone": "+1234567890",
      "email": "john@example.com",
      "avatar": null,
      "country_id": 1,
      "enabled_ai_bot": true,
      "subscribed": true,
      "credits": 0,
      "catalog_token": "abc123...",
      "catalog_link": "https://app.wacm.in/s/abc123...",
      "created_at": "2026-07-14T10:00:00.000000Z",
      "updated_at": "2026-07-14T10:00:00.000000Z",
      "first_name": "John",
      "company_name": "Acme Inc"
    }
  ],
  "links": { "first": "...", "last": "...", "prev": null, "next": "..." },
  "meta": { "current_page": 1, "last_page": 5, "per_page": 15, "total": 75 }
}

Custom fields are flattened into the root object using their snake_cased name (e.g., First Name becomes first_name).

Create Contact

Create a new contact. The phone field is required; all non-digit characters except leading + are stripped automatically.

POST
/v1/contacts

Request Body

ParameterTypeRequiredDescription
phonestringRequiredPhone number in international format (e.g., +1234567890)
namestringOptionalContact name
emailstringOptionalEmail address
[custom_field]stringOptionalAny custom field name (snake_cased)
Example Request
curl -X POST https://api.wacm.in/api/v1/contacts \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "Jane Smith",
       "phone": "+1234567890",
       "email": "jane@example.com",
       "company_name": "Acme Inc"
     }'

Response

201 Created
{
  "message": "Contact created successfully",
  "contact": {
    "id": 2,
    "name": "Jane Smith",
    "phone": "+1234567890",
    "email": "jane@example.com",
    "enabled_ai_bot": true,
    "subscribed": true,
    "created_at": "2026-07-14T10:00:00.000000Z"
  }
}

Get Contact

Retrieve a single contact by ID.

GET
/v1/contacts/{id}

Example Request
curl -H "Authorization: Bearer YOUR_TOKEN" \
     https://api.wacm.in/api/v1/contacts/1

Response

200 OK
{
  "contact": {
    "id": 1,
    "name": "John Doe",
    "phone": "+1234567890",
    "email": "john@example.com",
    "avatar": null,
    "country_id": 1,
    "enabled_ai_bot": true,
    "subscribed": true,
    "credits": 0,
    "catalog_token": "abc123...",
    "catalog_link": "https://app.wacm.in/s/abc123...",
    "created_at": "2026-07-14T10:00:00.000000Z",
    "updated_at": "2026-07-14T10:00:00.000000Z"
  }
}

Update Contact

Update an existing contact. Supports partial updates.

PUT
/v1/contacts/{id}

ParameterTypeRequiredDescription
phonestringOptionalPhone number
namestringOptionalContact name
emailstringOptionalEmail address
enabled_ai_botbooleanOptionalEnable/disable AI bot for this contact
subscribedbooleanOptionalSubscribe/unsubscribe from campaigns
[custom_field]stringOptionalAny custom field name (snake_cased)
Example Request
curl -X PUT https://api.wacm.in/api/v1/contacts/1 \
     -H "Authorization: Bearer YOUR_TOKEN" \
     -H "Content-Type: application/json" \
     -d '{
       "name": "John Updated",
       "enabled_ai_bot": false
     }'

Response

200 OK
{
  "message": "Contact updated successfully",
  "contact": {
    "id": 1,
    "name": "John Updated",
    "phone": "+1234567890",
    "enabled_ai_bot": false,
    "updated_at": "2026-07-14T12:00:00.000000Z"
  }
}

Delete Contact

Soft-delete a contact. The contact is marked as deleted but can be restored within 30 days.

DELETE
/v1/contacts/{id}

Example Request
curl -X DELETE https://api.wacm.in/api/v1/contacts/1 \
     -H "Authorization: Bearer YOUR_TOKEN"

Response

200 OK
{
  "message": "Contact deleted successfully"
}

Error Responses

403No active company — user has no associated company
404Contact not found
422Validation failed — invalid request parameters
500Internal server error
Error Response
{
  "error": "No active company"
}

Custom Fields

Custom fields are dynamically synced from your company's field definitions. When creating or updating a contact, include any custom field name (snake_cased) in the request body. The field must exist in the custom_contacts_fields table.

Custom field values are flattened into the contact response object. For example, a custom field named Company Nameappears as "company_name": "Acme Inc" in the JSON response.

Related Endpoints