Clients
Client resources contain customer data and require a secret key in trusted server code.
clients.lookup()
clients.lookup(
input: ClientLookupInput,
options?: RequiplyRequestOptions,
): Promise<ClientLookupResponse>
Pass email, phone, or search; at least one is required. The method works in two modes:
| Input | Mode | Response |
|---|---|---|
email and/or phone | Exact match, letter case included. With both, the client must have both. | client is the matching client, or null. |
search | Fuzzy search across first name, last name, email, and phone. | client is null; matches lists up to 10 clients. |
const { client } = await requiply.clients.lookup({ email: 'customer@example.com' });
const { matches } = await requiply.clients.lookup({ search: 'Olena Koval' });
search splits the text into words (up to four), and a client matches when every word appears somewhere in their name, last name, email, or phone. Ukrainian names are also tried in the other alphabet, so Olena finds Олена and Галина finds Halyna.
Each client has id, name, lastName, email, phone, and discountPercentage (0 without a discount). Name, last name, email, and phone can be null.
clients.create()
clients.create(
input: ClientCreateInput,
options?: RequiplyRequestOptions,
): Promise<ClientCreateResponse>
The input accepts optional name, lastName, email, and phone fields. At least one of email or phone is required.
const { client, created } = await requiply.clients.create({
name: 'Alex',
lastName: 'Morgan',
email: 'alex@example.com',
phone: '+380951234567',
});
phone must be in international E.164 format: a leading +, the country code, and 7 to 15 digits in total, for example +380951234567. A national-format number is rejected with a 400 and the message "Phone must be in international E.164 format with a country code, e.g. +380951234567". The same rule applies to the app's client forms and to AI assistants creating clients.The response returns the client and created. clients.create() is duplicate-safe: when a client with that email, or else that phone, already exists, you get that client back with created: false instead of a second record.