Skip to content
TriedDocs
Contacts

Backfill contacts

Link past phone calls to contacts and re-apply the contact field mappings to them.

POSThttps://api.tried.com.au/backfill-contacts

Scans ended phone calls, oldest first. A call with no contact is linked to the contact for its caller or callee number, and that contact is created if it does not exist. With apply_mappings on, the workspace's contact field mappings are then applied from each call, so later calls win for overwrite mappings. The request runs synchronously.

Request#

Field Type Required Description
from number No Unix ms. Only calls created at or after this time.
to number No Unix ms. Only calls created at or before this time.
agent_ids array of strings No Only calls handled by these agents. Default [] (all agents).
limit integer No Most calls to scan, 1 to 5000. Default 1000.
apply_mappings boolean No Apply field mappings, including to calls that already have a contact. Default true.

An empty body scans the 1000 oldest ended phone calls.

Example request#

curl -X POST https://api.tried.com.au/backfill-contacts \
  -H "Authorization: Bearer $TRIED_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "from": 1759276800000, "agent_ids": ["agent_3e4f5a6b7c8d9e0f1a2b3c4d"], "limit": 5000 }'
const res = await fetch("https://api.tried.com.au/backfill-contacts", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.TRIED_API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({ from: 1759276800000, agent_ids: ["agent_3e4f5a6b7c8d9e0f1a2b3c4d"], limit: 5000 }),
});
const result = await res.json();
import os, requests

res = requests.post(
    "https://api.tried.com.au/backfill-contacts",
    headers={"Authorization": f"Bearer {os.environ['TRIED_API_KEY']}"},
    json={"from": 1759276800000, "agent_ids": ["agent_3e4f5a6b7c8d9e0f1a2b3c4d"], "limit": 5000},
)
result = res.json()

Response#

200 OK

{
  "calls_scanned": 842,
  "calls_linked": 37,
  "contacts_created": 12,
  "contacts_updated": 205
}
Field Type Description
calls_scanned integer Ended phone calls that matched the filters.
calls_linked integer Calls that had no contact and were linked to one.
contacts_created integer Contacts created for numbers with no contact.
contacts_updated integer Calls whose mappings changed at least one contact field.

A call with no contact is skipped when its number is not E.164. accumulate mappings on custom fields merge values with OpenAI when a key is set. Without a key they keep a de-duplicated list joined by "; ", capped at 1000 characters.

Errors#

Status When
400 Body fails validation, for example limit: Number must be less than or equal to 5000.
401 Missing or invalid API key.
403 The key's IP allowlist or scopes reject the request, or the caller has the read-only member role. This route needs the calls scope.
429 Rate limit exceeded. See Rate limits.

See Errors for the body format.

Retell compatibility#

Retell backfills with POST /backfill-contact-analysis-data as a queued job with a different body. Tried uses this path, runs synchronously, and returns counts.