Get Contact by ID
GET /api/contacts/:id
Section titled “ /api/contacts/”Gets a specific contact using its unique identifier.
Path Parameters
Section titled “Path Parameters”Parameter | Type | Required | Description |
---|---|---|---|
id | string | Yes | Unique contact ID |
Successful Response (200)
Section titled “Successful Response (200)”{ "id": "contact-uuid-123", "name": "John", "lastName": "Doe", "phone": "3001234567", "countryCode": "57", "status": "ACTIVE", "birthDate": "1990-01-15T00:00:00.000Z", "origin": "API", "organizationId": "org-uuid", "customValues": [], "tags": [ { "id": "tag1-uuid", "name": "VIP Client", "description": "Important clients", "color": "#FF5722", "organizationId": "org-uuid", "createdAt": "2024-01-01T00:00:00.000Z", "updatedAt": "2024-01-01T00:00:00.000Z" } ], "createdAt": "2024-01-01T10:00:00.000Z", "updatedAt": "2024-01-01T10:00:00.000Z"}
Possible Errors
Section titled “Possible Errors”Code | Description |
---|---|
400 | Invalid contact ID |
401 | Missing or invalid API Key |
404 | Contact not found |
500 | Internal server error |
Usage Examples
Section titled “Usage Examples”curl -X GET "https://app.sendme123.com/api/contacts/contact-uuid-123" \ -H "api-key: your-api-key-here" \ -H "Content-Type: application/json"
const getContactById = async (contactId) => { try { const response = await axios.get(`https://app.sendme123.com/api/contacts/${contactId}`, { headers: { 'api-key': 'your-api-key-here', 'Content-Type': 'application/json' } });
console.log('Contact found:', response.data); return response.data; } catch (error) { console.error('Error getting contact:', error.response?.data || error.message); throw error; }};
// UsagegetContactById('contact-uuid-123');
import requests
contact_id = 'contact-uuid-123'headers = {'api-key': 'your-api-key-here', 'Content-Type': 'application/json'}
response = requests.get('https://app.sendme123.com/api/contacts/' + contact_id, headers=headers)
if response.status_code == 200: contact = response.json() print('Contact found:', contact)else: print('Error:', response.status_code)
Use Cases
Section titled “Use Cases”Check contact existence
Section titled “Check contact existence”const contactExists = async (contactId) => { try { await axios.get(`https://app.sendme123.com/api/contacts/${contactId}`, { headers: { 'api-key': 'your-api-key-here' } }); return true; } catch (error) { return false; }};
Get complete information before updating
Section titled “Get complete information before updating”const safeUpdateContact = async (contactId, newData) => { try { // First verify it exists const currentContact = await axios.get(`https://app.sendme123.com/api/contacts/${contactId}`, { headers: { 'api-key': 'your-api-key-here' } });
// Proceed with update const response = await axios.patch(`https://app.sendme123.com/api/contacts/${contactId}`, newData, { headers: { 'api-key': 'your-api-key-here', 'Content-Type': 'application/json' } });
console.log('Contact updated:', response.data); return response.data; } catch (error) { if (error.response?.status === 404) { throw new Error('Contact not found'); } console.error('Error updating contact:', error.response?.data || error.message); throw error; }};