Contacts

Every identity keeps its own contact directory — an address book your agent can lean on. Before sending an email or a text, resolve a name like “Alice” to a real email or phone number, then send with confidence. The same directory works over the CLI, the Python SDK, and the TypeScript SDK.

Every example below runs against one identity. Grab it once (or set it as the active identity in the CLI) and the rest follow. Need one first? See Identities.

Select the identity to work with
ravi identity use <identity-uuid>
from ravi import Ravi

ravi = Ravi(api_key="ravi_id_...")
identity = ravi.identities.get("<identity-uuid>")
import { Ravi } from "@ravi-hq/sdk";

const ravi = new Ravi({ apiKey: process.env.RAVI_API_KEY! });
const identity = await ravi.identities.get("<identity-uuid>");

Add a contact

Save someone to the directory. A contact carries an email, phone_number, display_name, nickname, and an is_trusted flag.

ravi contacts create \
--email user@example.com \
--display-name "Alice Example"
contact = identity.contacts.create(
  email="user@example.com",
  display_name="Alice Example",
)
const contact = await identity.contacts.create({
email: "user@example.com",
display_name: "Alice Example",
});

List contacts

Browse everyone in the directory.

ravi contacts list
contacts = identity.contacts.list()
for c in contacts:
  print(c.display_name, c.email)
const contacts = await identity.contacts.list();
for (const c of contacts) {
console.log(c.display_name, c.email);
}

Search contacts

Fuzzy-match by name, nickname, email, or phone — the move to make right before sending, when you only know “Alice”.

ravi contacts search "alice"
matches = identity.contacts.search("alice")
const matches = await identity.contacts.search("alice");

Find a contact

Look up an exact match by email or phone number when you already know the identifier.

contact = identity.contacts.find(email="user@example.com")
const contact = await identity.contacts.find({ email: "user@example.com" });

Get one contact

Fetch a single contact by id to see all its fields.

ravi contacts get <contact-uuid>
contact = identity.contacts.get("<contact-uuid>")
print(contact.display_name, contact.phone_number)
const contact = await identity.contacts.get("<contact-uuid>");
console.log(contact.display_name, contact.phone_number);

Update a contact

Change any field — here, set a friendlier nickname.

ravi contacts update <contact-uuid> --nickname "Ali"
contact = identity.contacts.update("<contact-uuid>", nickname="Ali")
const contact = await identity.contacts.update("<contact-uuid>", { nickname: "Ali" });

Delete a contact

Remove someone from the directory.

ravi contacts delete <contact-uuid>
identity.contacts.delete("<contact-uuid>")
await identity.contacts.delete("<contact-uuid>");

Looking for exact request and response fields? See the full API reference.