API
Anmelden
Dokumentation › Kontakte › Kontakte im Stapel erstellen
POST

Kontakte im Stapel erstellen

POSThttps://app.sendapp.ai/api/contacts/bulk
Importieren Sie bis zu 10.000 Kontakte in einem einzigen Aufruf. Duplikate (nach Telefon oder E-Mail) werden automatisch mit bestehenden Kontakten zusammengeführt.
Wird das Kontaktlimit des Plans während des Imports erreicht, hat die Antwort den HTTP-Code 207 (teilweise) und gibt an, wie viele Kontakte tatsächlich importiert wurden.
Parameter
apikey erforderlich
La tua API Key (anche header X-API-Key).
contacts erforderlich
Array von Kontaktobjekten — max. 10.000 pro Aufruf. Jedes Objekt akzeptiert name, phone, email, tags, metadata.
Anfrage
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());
Antwort (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
  }
}
Fehler
{
  "status": "error",
  "message": "Error importing contacts."
}