> ## Documentation Index
> Fetch the complete documentation index at: https://docs.revenuebee.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# contacts.upsert

> Create a customer the first time, update them every time after.

```ts theme={null}
const [contact, error] = await crm.contacts.upsert({
  dbId: "user_42",
  name: "Ada Lovelace",
  kind: "person",
  emails: ["ada@example.com"],
  phones: ["+14155550123"],
});
```

> [!TIP]
>
> Save the `id` it returns in your own database. Every other call takes it as `partyId`, so you never have to look the
> customer up again.

**dbId** `string` *required*

Your own id for this customer. Every later call finds them by it.

**name** `string` *required*

Shown everywhere the customer appears. Your name always wins over Stripe's.

**kind** `"person" | "organization"` (default: person)

Whether this is a person or a company.

**emails** `string[]`

Their addresses. The first is the primary one.

**phones** `string[]`

E.164 numbers, such as `+14155550123`. A number without a country code is rejected.

## Returns

**contact** `Contact`

**properties**

**id** `string`

The CRM's own id.

**dbId** `string`

The id you sent.

**name** `string`

**kind** `"person" | "organization"`

**emails** `string[]`

**phones** `string[]`

**externalAccounts** `ExternalAccount[]`

See [externalAccounts.list](https://docs.revenuebee.ai/sdk/list-external-accounts.md).

**createdAt** `string`

ISO 8601.

**updatedAt** `string`

ISO 8601.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.