Update Contacts API
This API allows you to update contact details in your Cellcast account. Refer to Get Available Contact Fields API for your request body. Adding a custom field outside the Available Contact Fields will automatically create a new Dynamic Field. This allows you to extend contact details with fields tailored to your requirements.
Parameters for Update Contact API
Headers Parameters
Parameters | Description |
---|---|
Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Content-Type | application/json |
Request Query Parameters
Name | Example | Description |
---|---|---|
contactID | 674d9650b000000000000000 | Required. The ID to a specific contact in your Cellcast account. This ID is required when retrieving or updating contact details using the API. Refer to Contact ID Information |
Request Body Parameters
Name | Example | Description |
---|---|---|
Number | +61400000000 | StaticFields - The phone number of the contact |
First Name | John | StaticFields - The first name of the contact |
Last Name | Doe | StaticFields - The last name of the contact |
[email protected] | StaticFields - The email of the contact | |
Birthday | 1990-05-14 | StaticFields - The birth date of the contact |
Address | 123 Main St, Sydney, NSW | DynamicFields - The address of the contact |
Postal Code | 2000 | DynamicFields - The postal code of the contact |
Gender | male | DynamicFields - The gender of the contact |
Code Samples
Post https://api.cellcast.com/api/v2/contact/:contactId
bash
curl --location --request PUT 'https://api.cellcast.com/api/v2/contact/:contactId' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {{API_KEY}}' \
--data-raw '{
"First Name": "John",
"Last Name": "Doe",
"Email": "[email protected]",
"Address": "123 Main St, Sydney, NSW",
"Number": "+61400000000"
}'
js
const axios = require('axios');
const updateContact = async () => {
const contactId = 'your-contact-id';
const apiKey = 'your-api-key';
const url = `https://api.cellcast.com/api/v2/contact/${contactId}`;
const data = {
"First Name": "John",
"Last Name": "Doe",
"Email": "[email protected]",
"Address": "123 Main St, Sydney, NSW",
"Number": "+61400000000",
};
try {
const response = await axios.put(url, data, {
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`,
},
});
console.log('Response:', response.data);
} catch (error) {
console.error('Error:', error.response ? error.response.data : error.message);
}
};
updateContact();
Replace with the actual API key that you own.
Response
200 Success
json
{
"message": "success update contact"
}
404 Not Found
json
{
"code": 404,
"message": "contact with id 674d9650b000000000000000 is not exist",
}