---
title: "Clients"
description: "Look up and create clients from trusted server integrations."
canonical_url: "https://requiply.com/docs/en/developers/typescript-sdk/clients"
---
# Clients

> Look up and create clients from trusted server integrations.

Client resources contain customer data and require a secret key in trusted server code.

## `clients.lookup()`

```ts
clients.lookup(
  input: ClientLookupInput,
  options?: RequiplyRequestOptions,
): Promise<ClientLookupResponse>
```

Pass `email`, `phone`, or `search`; at least one is required. The method works in two modes:

<table>
<thead>
  <tr>
    <th>
      Input
    </th>
    
    <th>
      Mode
    </th>
    
    <th>
      Response
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      <code>
        email
      </code>
      
       and/or <code>
        phone
      </code>
    </td>
    
    <td>
      Exact match, letter case included. With both, the client must have both.
    </td>
    
    <td>
      <code>
        client
      </code>
      
       is the matching client, or <code>
        null
      </code>
      
      .
    </td>
  </tr>
  
  <tr>
    <td>
      <code>
        search
      </code>
    </td>
    
    <td>
      Fuzzy search across first name, last name, email, and phone.
    </td>
    
    <td>
      <code>
        client
      </code>
      
       is <code>
        null
      </code>
      
      ; <code>
        matches
      </code>
      
       lists up to 10 clients.
    </td>
  </tr>
</tbody>
</table>

```ts
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()`

```ts
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.

```ts
const { client, created } = await requiply.clients.create({
  name: 'Alex',
  lastName: 'Morgan',
  email: 'alex@example.com',
  phone: '+380951234567',
});
```

<warning>

**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.

</warning>

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.


## Sitemap

See the full [sitemap](https://requiply.com/docs/sitemap.md) for all pages.
