Users
Retrieve Users
Finding agents and linking external IDs
Get a list of your agency's agents, find a specific agent, or link an external ID for further synchronization.
Get Agent List
Returns all agents in your agency.
const response = await fetch('https://crm.rentix.md/api/v1/users', {
headers: { 'Authorization': 'ApiKey YOUR_API_KEY' }
});
const { items } = await response.json();
// Find agents without external ID (for initial linking)
const unlinked = items.filter(user => !user.externalId);
console.log(`Agents without external ID: ${unlinked.length}`);
curl https://crm.rentix.md/api/v1/users \
-H "Authorization: ApiKey YOUR_API_KEY"
$ch = curl_init('https://crm.rentix.md/api/v1/users');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: ApiKey YOUR_API_KEY']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
foreach ($data['items'] as $user) {
echo $user['name'] . ' - ' . ($user['externalId'] ?? 'no external ID') . "\n";
}
Response
{
"items": [
{
"id": 1,
"externalId": "agent-001",
"name": "Ivan Petrov",
"phone": "+373 22 123 456",
"avatar": {
"id": 123,
"contentType": "image/jpeg",
"variants": [
{ "url": "https://storage.../avatar_128.webp", "variantSize": "128" }
]
},
"description": "Experienced residential real estate agent...",
"instagram": "https://instagram.com/ivan.petrov",
"youtube": null,
"tiktok": null,
"settings": {
"posting_type": "agent",
"contact_phone": true,
"contact_whatsapp": true,
"contact_viber": false,
"contact_telegram": true
}
}
]
}
Find Agent by ID
Use the Rentix internal ID.
const response = await fetch('https://crm.rentix.md/api/v1/users/1', {
headers: { 'Authorization': 'ApiKey YOUR_API_KEY' }
});
const user = await response.json();
curl https://crm.rentix.md/api/v1/users/1 \
-H "Authorization: ApiKey YOUR_API_KEY"
$ch = curl_init('https://crm.rentix.md/api/v1/users/1');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: ApiKey YOUR_API_KEY']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$user = json_decode($response, true);
Find Agent by External ID
Use the ID from your CRM.
const response = await fetch('https://crm.rentix.md/api/v1/users/external/agent-001', {
headers: { 'Authorization': 'ApiKey YOUR_API_KEY' }
});
const user = await response.json();
curl https://crm.rentix.md/api/v1/users/external/agent-001 \
-H "Authorization: ApiKey YOUR_API_KEY"
$ch = curl_init('https://crm.rentix.md/api/v1/users/external/agent-001');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: ApiKey YOUR_API_KEY']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$user = json_decode($response, true);
Link External ID
Connects a Rentix agent with a record in your CRM. After linking, you can use the external ID for profile updates and listing assignment.
const response = await fetch('https://crm.rentix.md/api/v1/users/1/link', {
method: 'POST',
headers: {
'Authorization': 'ApiKey YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ externalId: 'agent-001' })
});
const result = await response.json();
console.log(`Agent ${result.id} linked to external ID: ${result.externalId}`);
curl -X POST https://crm.rentix.md/api/v1/users/1/link \
-H "Authorization: ApiKey YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "externalId": "agent-001" }'
$ch = curl_init('https://crm.rentix.md/api/v1/users/1/link');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['externalId' => 'agent-001']));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: ApiKey YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
Response
{
"id": 1,
"externalId": "agent-001",
"linked": true
}
Unlink External ID
Removes the connection between a Rentix agent and external ID.
const response = await fetch('https://crm.rentix.md/api/v1/users/1/link', {
method: 'DELETE',
headers: { 'Authorization': 'ApiKey YOUR_API_KEY' }
});
curl -X DELETE https://crm.rentix.md/api/v1/users/1/link \
-H "Authorization: ApiKey YOUR_API_KEY"
$ch = curl_init('https://crm.rentix.md/api/v1/users/1/link');
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE');
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: ApiKey YOUR_API_KEY']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
Response
{
"id": 1,
"externalId": "agent-001",
"unlinked": true
}
Scenario: Initial Linking
When integrating CRM, you need to connect existing Rentix agents with records in your system.
Node.js
// 1. Get all agents from Rentix
const response = await fetch('https://crm.rentix.md/api/v1/users', {
headers: { 'Authorization': 'ApiKey YOUR_API_KEY' }
});
const { items: rentixAgents } = await response.json();
// 2. For each agent, find a match in CRM (e.g., by name or phone)
for (const agent of rentixAgents) {
const crmRecord = await findInCrm(agent.phone); // your search function
if (crmRecord && !agent.externalId) {
// 3. Link external ID
await fetch(`https://crm.rentix.md/api/v1/users/${agent.id}/link`, {
method: 'POST',
headers: {
'Authorization': 'ApiKey YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({ externalId: crmRecord.id })
});
console.log(`Linked: ${agent.name} → ${crmRecord.id}`);
}
}
Common Errors
| Error | Cause | Solution |
|---|---|---|
User not found | Agent doesn't exist or not in your agency | Check the agent ID |
External ID already linked | This external ID is already used by another agent | Use a unique ID for each agent |
User already has external ID | Agent already has an external ID | Unlink the current ID first |