Contacts
Create and manage polymorphic contacts belonging to customers or prospects, with phone number lookup for call center integrations.
Base URL: /api/v1/contacts
Auth required: Yes (auth:api) for all endpoints.
Contacts are polymorphic: they belong to either a Customer or a Prospect (the contactable).
Model Properties
| Property | Type | Required | Description |
|---|---|---|---|
id |
integer | auto | Unique identifier |
contactable_type |
string | Yes | PHP class name of the owning entity (e.g. App\Customer, App\Prospect) |
contactable_id |
integer | Yes | ID of the owning entity |
civility |
string | No | Civility/title (e.g. M., Mme) |
first_name |
string | No | First name |
last_name |
string | Yes | Last name |
email_address |
string | Yes | Email address. Must be a valid email |
mobile_phone |
string | No | Mobile phone number |
landline_phone |
string | No | Landline phone number |
role |
string | No | Job title or role within the company |
service |
string | No | Department or service within the company |
legal_representative |
boolean | No | Whether this contact is a legal representative (default: false) |
invoices_recipient |
boolean | No | Whether this contact receives invoices (default: false) |
newsletters_recipient |
boolean | No | Whether this contact receives newsletters (default: true) |
is_signer_contract |
boolean | No | Whether this contact is authorized to sign contracts |
is_signer_iban |
boolean | No | Whether this contact is authorized to sign IBAN/SEPA mandates |
profunction_id |
integer | No | FK to profunctions. Professional function classification |
comment |
text | No | Internal comments |
permissions |
array | No | Customer portal permissions array. Synced to the linked client account when updated |
created_at |
datetime | auto | Creation timestamp |
updated_at |
datetime | auto | Last update timestamp |
Read-only computed fields (returned in GET /v1/contacts/{id}):
| Property | Type | Description |
|---|---|---|
company |
string | Name of the owning entity (customer or prospect) |
customer_id |
integer | ID of the owning entity |
customer_account |
string | Account number of the owning entity (e.g. CL000123) |
has_client |
boolean | Whether this contact has a customer portal account |
GET /v1/contacts
List contacts for a specific entity (customer or prospect). Results are ordered by last_name, first_name.
Query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
contactable_type |
string | Yes | PHP class name (e.g. App\Customer, App\Prospect) |
contactable_id |
integer | Yes | ID of the owning entity |
Response 200: Array of contact objects.
Examples:
curl -s -X GET "https://your-instance.bluerocktel.net/api/v1/contacts?contactable_type=App%5CCustomer&contactable_id=10" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json"
import requests
response = requests.get(
"https://your-instance.bluerocktel.net/api/v1/contacts",
params={"contactable_type": "App\\Customer", "contactable_id": 10},
headers={"Authorization": f"Bearer {token}", "Accept": "application/json"},
)
contacts = response.json()
use Illuminate\Support\Facades\Http;
$response = Http::withToken($token)
->acceptJson()
->get('https://your-instance.bluerocktel.net/api/v1/contacts', [
'contactable_type' => 'App\\Customer',
'contactable_id' => 10,
]);
$contacts = $response->json();
const response = await fetch(
"https://your-instance.bluerocktel.net/api/v1/contacts?contactable_type=App%5CCustomer&contactable_id=10",
{
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/json",
},
}
);
const contacts = await response.json();
POST /v1/contacts
Create a new contact for an entity. Sets sync_needed = true and triggers reindexing of the contactable.
Query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
contactable_type |
string | Yes | PHP class name |
contactable_id |
integer | Yes | ID of the owning entity |
Body (JSON): Validated via contact model attributes.
Response 201: Created contact object. Response 422: Validation error.
Examples:
curl -s -X POST "https://your-instance.bluerocktel.net/api/v1/contacts?contactable_type=App%5CCustomer&contactable_id=10" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{"first_name": "Jane", "last_name": "Doe", "email": "jane.doe@example.com"}'
import requests
response = requests.post(
"https://your-instance.bluerocktel.net/api/v1/contacts",
params={"contactable_type": "App\\Customer", "contactable_id": 10},
json={"first_name": "Jane", "last_name": "Doe", "email": "jane.doe@example.com"},
headers={"Authorization": f"Bearer {token}", "Accept": "application/json"},
)
contact = response.json()
$response = Http::withToken($token)
->acceptJson()
->post('https://your-instance.bluerocktel.net/api/v1/contacts?contactable_type=App%5CCustomer&contactable_id=10', [
'first_name' => 'Jane',
'last_name' => 'Doe',
'email' => 'jane.doe@example.com',
]);
$contact = $response->json();
const response = await fetch(
"https://your-instance.bluerocktel.net/api/v1/contacts?contactable_type=App%5CCustomer&contactable_id=10",
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/json",
"Content-Type": "application/json",
},
body: JSON.stringify({
first_name: "Jane",
last_name: "Doe",
email: "jane.doe@example.com",
}),
}
);
const contact = await response.json();
GET /v1/contacts/{id}
Get a single contact with company info, customer_account, client permissions, and contactable metadata.
URL parameters:
| Parameter | Type | Description |
|---|---|---|
id |
integer | Contact ID |
Response 200: Contact object with permissions. Response 404: Not found.
PUT /v1/contacts/{id}
Update a contact. If a client account is linked, permissions are synced. Triggers contactable reindexing.
URL parameters:
| Parameter | Type | Description |
|---|---|---|
id |
integer | Contact ID |
Body (JSON): Validated contact fields.
Response 201: Updated contact object. Response 404: Not found. Response 422: Validation error.
DELETE /v1/contacts/{id}
Delete a contact.
URL parameters:
| Parameter | Type | Description |
|---|---|---|
id |
integer | Contact ID |
Response 200: Success message. Response 404: Not found.
GET /v1/contacts/numbers
Find a contact by phone number. Used by 3CX call flow integrations.
Query parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
phone_number |
string | Yes | Phone number to search |
Response 200:
{
"data": { ...contact object... }
}
Response 404: Not found.
Examples:
curl -s -X GET "https://your-instance.bluerocktel.net/api/v1/contacts/numbers?phoneNumber=%2B33612345678" \
-H "Authorization: Bearer $TOKEN" \
-H "Accept: application/json"
import requests
response = requests.get(
"https://your-instance.bluerocktel.net/api/v1/contacts/numbers",
params={"phone_number": "+33612345678"},
headers={"Authorization": f"Bearer {token}", "Accept": "application/json"},
)
contact = response.json()
$response = Http::withToken($token)
->acceptJson()
->get('https://your-instance.bluerocktel.net/api/v1/contacts/numbers', [
'phone_number' => '+33612345678',
]);
$contact = $response->json();
const response = await fetch(
"https://your-instance.bluerocktel.net/api/v1/contacts/numbers?phoneNumber=%2B33612345678",
{
headers: {
Authorization: `Bearer ${token}`,
Accept: "application/json",
},
}
);
const contact = await response.json();
GET /v1/contacts/{id}/accounts
Find all accounts (customers or prospects) sharing the same email address as this contact.
URL parameters:
| Parameter | Type | Description |
|---|---|---|
id |
integer | Contact ID |
Response 200: Array of account objects.
GET /v1/contacts/{id}/coworkers
Get all contacts at the same organization as the given contact (same company/domain).
URL parameters:
| Parameter | Type | Description |
|---|---|---|
id |
integer | Contact ID |
Response 200: Array of contact objects.
On this page