Documentazione ›
Contatti › Crea contatti in blocco
POST
Crea contatti in blocco
POSThttps://app.sendapp.ai/api/contacts/bulk
Importa fino a 10.000 contatti in una singola chiamata. I duplicati (per telefono o email) vengono uniti automaticamente ai contatti esistenti.
Se il limite di contatti del piano viene raggiunto durante l'import, la risposta ha codice HTTP 207 (parziale) e riporta quanti contatti sono stati effettivamente importati.
Parametri
apikey
obbligatorio
La tua API Key (anche header
X-API-Key).
contacts
obbligatorio
Array di oggetti contatto — max 10.000 per chiamata. Ogni oggetto accetta name, phone, email, tags, metadata.
Richiesta
curl -X POST 'https://app.sendapp.ai/api/contacts/bulk' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{
"contacts": [
{ "name": "Alice", "phone": "+39111111111", "tags": ["newsletter"] },
{ "name": "Bob", "email": "bob@example.com" }
]
}'<?php
$ch = curl_init('https://app.sendapp.ai/api/contacts/bulk');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
'contacts' => [
['name' => 'Alice', 'phone' => '+39111111111', 'tags' => ['newsletter']],
['name' => 'Bob', 'email' => 'bob@example.com'],
],
]),
]);
echo curl_exec($ch);
curl_close($ch);const res = await fetch('https://app.sendapp.ai/api/contacts/bulk', {
method: 'POST',
headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({
contacts: [
{ name: 'Alice', phone: '+39111111111', tags: ['newsletter'] },
{ name: 'Bob', email: 'bob@example.com' }
]
})
});
console.log(await res.json());Risposta (200 OK)
{
"status": "success",
"results": {
"total": 3,
"imported": 2,
"updated": 1,
"unchanged": 0,
"errors": [],
"discarded": [],
"limit_exceeded": false,
"custom_fields_created": 0
},
"limit_info": {
"exceeded": false,
"current": 130,
"max": 5000,
"unlimited": false
}
}Errore
{
"status": "error",
"message": "Error importing contacts."
}