# Update a contact's name and description
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Juan Carlos Pérez",
}'
# Update multiple contact fields
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+12125678901",
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}'
// Using Fetch API to update a contact
const updateContact = async (contactId, updateData) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'PATCH',
headers: {
'x-api-key': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
if (!response.ok) {
if (response.status === 404) {
console.error('Contact not found');
return null;
}
const errorData = await response.json();
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData.message || 'Unknown error'}`);
}
const { data: updatedContact } = await response.json();
console.log('Contact updated:', updatedContact);
return updatedContact;
} catch (error) {
console.error('Error updating contact:', error);
}
};
// Example usage
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
const updateData = {
full_name: 'Juan Carlos Pérez',
email: 'juan.perez@ejemplo.com',
};
updateContact(contactId, updateData);
import requests
import json
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to update
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key,
"Content-Type": "application/json"
}
# Update data - only include fields you want to change
update_data = {
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}
# Make the PATCH request
response = requests.patch(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers,
data=json.dumps(update_data)
)
# Check if the request was successful
if response.status_code == 200:
updated_contact = response.json()["data"]
print(f"Contact updated successfully: {updated_contact['full_name']}")
# Print updated field information
if 'email' in update_data:
print(f"New email: {updated_contact['email']}")
if 'additional_data' in update_data:
print("Updated additional information:")
for data in updated_contact['additional_data']:
print(f" {data['field']}: {data['value']} ({data['type']})")
elif response.status_code == 404:
print("Error: Contact not found")
else:
print(f"Error: {response.status_code}")
print(response.text)
{
"statusCode": 200,
"data": {
"id": "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6",
"created_at": "2023-01-01T12:00:00Z",
"phone_number": "+12125678901",
"full_name": "Juan Carlos Pérez",
"country": "México",
"email": "juan.perez@ejemplo.com",
"description": "Lead converted to customer",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
],
"organization_id": "org123456"
}
}
Contactos
Update Contact
Update an existing contact with new information
PATCH
/
v1
/
contacts
/
{contactId}
# Update a contact's name and description
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Juan Carlos Pérez",
}'
# Update multiple contact fields
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+12125678901",
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}'
// Using Fetch API to update a contact
const updateContact = async (contactId, updateData) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'PATCH',
headers: {
'x-api-key': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
if (!response.ok) {
if (response.status === 404) {
console.error('Contact not found');
return null;
}
const errorData = await response.json();
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData.message || 'Unknown error'}`);
}
const { data: updatedContact } = await response.json();
console.log('Contact updated:', updatedContact);
return updatedContact;
} catch (error) {
console.error('Error updating contact:', error);
}
};
// Example usage
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
const updateData = {
full_name: 'Juan Carlos Pérez',
email: 'juan.perez@ejemplo.com',
};
updateContact(contactId, updateData);
import requests
import json
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to update
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key,
"Content-Type": "application/json"
}
# Update data - only include fields you want to change
update_data = {
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}
# Make the PATCH request
response = requests.patch(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers,
data=json.dumps(update_data)
)
# Check if the request was successful
if response.status_code == 200:
updated_contact = response.json()["data"]
print(f"Contact updated successfully: {updated_contact['full_name']}")
# Print updated field information
if 'email' in update_data:
print(f"New email: {updated_contact['email']}")
if 'additional_data' in update_data:
print("Updated additional information:")
for data in updated_contact['additional_data']:
print(f" {data['field']}: {data['value']} ({data['type']})")
elif response.status_code == 404:
print("Error: Contact not found")
else:
print(f"Error: {response.status_code}")
print(response.text)
{
"statusCode": 200,
"data": {
"id": "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6",
"created_at": "2023-01-01T12:00:00Z",
"phone_number": "+12125678901",
"full_name": "Juan Carlos Pérez",
"country": "México",
"email": "juan.perez@ejemplo.com",
"description": "Lead converted to customer",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
],
"organization_id": "org123456"
}
}
This endpoint allows you to update the information of an existing contact in your organization’s database. You only need to include the fields you want to modify - any fields not included in the request will remain unchanged.
Use Cases
- Update a contact’s phone number, email, or other contact information
- Add or modify additional data fields for a contact
- Enrich contact records with new information from external sources
- Update contact status or notes after interaction
Path Parameters
string
requerido
The unique identifier of the contact you want to update. This is a UUID string that was generated when the contact was created.
Headers
string
requerido
Your API key for authentication. You can find this in your dashboard under API settings.
Body Parameters
string
The updated phone number of the contact in international format (e.g., +12124567890)
string
The updated full name of the contact
string
The updated country of the contact
string
The updated email address of the contact
array
Updated array of additional data fields for the contact. Note that this will replace the entire additional_data array, not merge with existing values.
Response
The response is{ "statusCode": number, "data": object }. The fields below describe data.
string
The unique identifier of the updated contact (UUID format)
string
The timestamp when the contact was originally created (ISO 8601 format)
string
The updated phone number of the contact
string
The updated full name of the contact
string
The updated country of the contact
string
The updated email of the contact
string
Updated description or notes about the contact
array
Updated additional data associated with the contact
string
The ID of the organization the contact belongs to
Error Codes
400 Bad Request- Invalid input data format401 Unauthorized- Invalid or missing API key404 Not Found- Contact not found409 Conflict- The update would create a duplicate phone number500 Internal Server Error- Server-side error
Code Examples
# Update a contact's name and description
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"full_name": "Juan Carlos Pérez",
}'
# Update multiple contact fields
curl -X PATCH "https://api.contactship.ai/v1/contacts/c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6" \
-H "x-api-key: your-api-key" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+12125678901",
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}'
// Using Fetch API to update a contact
const updateContact = async (contactId, updateData) => {
try {
const response = await fetch(`https://api.contactship.ai/v1/contacts/${contactId}`, {
method: 'PATCH',
headers: {
'x-api-key': 'your-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify(updateData)
});
if (!response.ok) {
if (response.status === 404) {
console.error('Contact not found');
return null;
}
const errorData = await response.json();
throw new Error(`HTTP error! Status: ${response.status}, Message: ${errorData.message || 'Unknown error'}`);
}
const { data: updatedContact } = await response.json();
console.log('Contact updated:', updatedContact);
return updatedContact;
} catch (error) {
console.error('Error updating contact:', error);
}
};
// Example usage
const contactId = 'c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6';
const updateData = {
full_name: 'Juan Carlos Pérez',
email: 'juan.perez@ejemplo.com',
};
updateContact(contactId, updateData);
import requests
import json
# Replace with your actual API key
api_key = "your-api-key"
# Base URL for the API
base_url = "https://api.contactship.ai"
# Contact ID to update
contact_id = "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6"
# Headers
headers = {
"x-api-key": api_key,
"Content-Type": "application/json"
}
# Update data - only include fields you want to change
update_data = {
"email": "juan.perez@ejemplo.com",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
]
}
# Make the PATCH request
response = requests.patch(
f"{base_url}/v1/contacts/{contact_id}",
headers=headers,
data=json.dumps(update_data)
)
# Check if the request was successful
if response.status_code == 200:
updated_contact = response.json()["data"]
print(f"Contact updated successfully: {updated_contact['full_name']}")
# Print updated field information
if 'email' in update_data:
print(f"New email: {updated_contact['email']}")
if 'additional_data' in update_data:
print("Updated additional information:")
for data in updated_contact['additional_data']:
print(f" {data['field']}: {data['value']} ({data['type']})")
elif response.status_code == 404:
print("Error: Contact not found")
else:
print(f"Error: {response.status_code}")
print(response.text)
{
"statusCode": 200,
"data": {
"id": "c1a2b3c4-d5e6-f7g8-h9i0-j1k2l3m4n5o6",
"created_at": "2023-01-01T12:00:00Z",
"phone_number": "+12125678901",
"full_name": "Juan Carlos Pérez",
"country": "México",
"email": "juan.perez@ejemplo.com",
"description": "Lead converted to customer",
"additional_data": [
{
"type": "location",
"field": "dirección",
"value": "Av. Reforma 456"
},
{
"type": "text",
"field": "notas",
"value": "Cliente activo con suscripción premium"
},
{
"type": "date",
"field": "fecha_conversión",
"value": "2023-03-15"
}
],
"organization_id": "org123456"
}
}
Notes and Best Practices
- Only include the fields you want to update in the request body
- Be careful when updating the additional_data array, as it will replace the entire array rather than merge with existing values
- If you’re updating a phone number, ensure it doesn’t conflict with another contact’s phone number
- Consider implementing validation checks before submitting updates
- Keep track of contact update history in your application if needed for compliance or audit purposes
