API Contatti
Gestisci i contatti tramite API REST.
Endpoints
| Metodo | Endpoint | Descrizione |
|---|---|---|
| GET | /contacts | Lista contatti |
| POST | /contacts | Crea contatto |
| GET | /contacts/{id} | Dettaglio contatto |
| PUT | /contacts/{id} | Aggiorna contatto |
| DELETE | /contacts/{id} | Elimina contatto |
| GET | /contacts/{id}/notes | Note del contatto |
Lista Contatti
http
GET /api/v1/contactsQuery Parameters
| Parametro | Tipo | Descrizione |
|---|---|---|
page | int | Numero pagina (default: 1) |
per_page | int | Record per pagina (max 100) |
search | string | Ricerca per nome/email |
company_id | int | Filtra per azienda |
stage | string | Filtra per stadio |
Risposta
json
{
"success": true,
"data": [
{
"id": 1,
"first_name": "Mario",
"last_name": "Rossi",
"email": "mario@example.com",
"phone": "+39 123 456 7890",
"company_id": 5,
"company": {
"id": 5,
"name": "Acme Srl"
},
"stage": "lead",
"created_at": "2025-01-15T10:30:00Z"
}
],
"meta": {
"current_page": 1,
"last_page": 10,
"per_page": 25,
"total": 250
}
}Creare Contatto
http
POST /api/v1/contactsBody
json
{
"first_name": "Mario",
"last_name": "Rossi",
"email": "mario@example.com",
"phone": "+39 123 456 7890",
"mobile": "+39 333 456 7890",
"company_id": 5,
"title": "CEO",
"stage": "lead",
"source": "website",
"custom_fields": {
"budget": "50000",
"industry": "software"
}
}Campi
| Campo | Tipo | Obbligatorio |
|---|---|---|
first_name | string | ✅ |
last_name | string | ✅ |
email | string | |
phone | string | |
mobile | string | |
company_id | int | |
title | string | |
stage | string | |
source | string | |
custom_fields | object |
Risposta
json
{
"success": true,
"data": {
"id": 123,
"first_name": "Mario",
"last_name": "Rossi",
...
}
}Dettaglio Contatto
http
GET /api/v1/contacts/{id}Risposta
json
{
"success": true,
"data": {
"id": 1,
"first_name": "Mario",
"last_name": "Rossi",
"email": "mario@example.com",
"phone": "+39 123 456 7890",
"mobile": "+39 333 456 7890",
"company_id": 5,
"company": {
"id": 5,
"name": "Acme Srl",
"website": "https://acme.it"
},
"title": "CEO",
"stage": "lead",
"source": "website",
"custom_fields": {
"budget": "50000"
},
"tags": ["prospect", "software"],
"created_at": "2025-01-15T10:30:00Z",
"updated_at": "2025-01-16T14:20:00Z"
}
}Aggiornare Contatto
http
PUT /api/v1/contacts/{id}Body
Invia solo i campi da aggiornare:
json
{
"stage": "prospect",
"title": "CTO"
}Eliminare Contatto
http
DELETE /api/v1/contacts/{id}Risposta
json
{
"success": true,
"message": "Contatto eliminato"
}Note del Contatto
http
GET /api/v1/contacts/{id}/notesRestituisce tutte le note associate al contatto.
Esempi
cURL - Lista
bash
curl -X GET "https://bladecrm.it/api/v1/contacts?page=1&per_page=10" \
-H "Authorization: Bearer YOUR_API_KEY"cURL - Crea
bash
curl -X POST "https://bladecrm.it/api/v1/contacts" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"first_name": "Mario",
"last_name": "Rossi",
"email": "mario@example.com"
}'TIP
Usa company_id per collegare automaticamente il contatto a un'azienda esistente.