Documentation ›
Contacts › Add tag
POST
Add tag
POSThttps://app.sendapp.ai/api/contacts/{id}/tags
Aggiunge uno o più tag a un contatto mantenendo quelli esistenti. I tag già presenti vengono ignorati.
Parameters
apikey
required
La tua API Key (anche header
X-API-Key).
id
required
Contact ID (integer, in the path). Use
GET /api/contacts to find it.
tags
required
Array o stringa di tag separati da virgole.
Request
curl -X POST 'https://app.sendapp.ai/api/contacts/42/tags' \
-H 'X-API-Key: YOUR_API_KEY' \
-H 'Content-Type: application/json' \
-d '{ "tags": ["vip", "newsletter"] }'<?php
$ch = curl_init('https://app.sendapp.ai/api/contacts/42/tags');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['X-API-Key: YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode(['tags' => ['vip', 'newsletter']]),
]);
echo curl_exec($ch);
curl_close($ch);const res = await fetch('https://app.sendapp.ai/api/contacts/42/tags', {
method: 'POST',
headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' },
body: JSON.stringify({ tags: ['vip', 'newsletter'] })
});
console.log(await res.json());Response (200 OK)
{
"status": "success",
"added": ["newsletter"],
"tags": ["cliente", "vip", "newsletter"],
"contact": { "id": 42, "...": "..." }
}Error
{
"status": "error",
"message": "The tags field is required (array or comma-separated string)."
}