---
title: "Users | tRPC API | Rolebase"
description: "tRPC procedures of the user router: check that an email address can receive the sign-in code, and delete your own account."
url: "https://rolebase.io/en/developers/trpc-api/users"
---

# Users

tRPC procedures of the user router: check that an email address can receive the sign-in code, and delete your own account.

Procedures of the `user` router. The account itself (name, locale, metadata) is read and written through GraphQL; this router groups the checks that need network access on the server side.

## Query `user.checkEmailDomain`

Tells whether a domain can receive emails, by looking up its MX records. The app calls it before sending a sign-in code, to flag right away an address whose domain does not exist or has no mail server. This procedure is public because it is used before signing in, so it receives the domain alone, never the full address.

Input

Type

Description

`domain`

`String`

Domain to check, for example `example.com`. Required.

It returns `{ valid }`. `valid` is `false` when the domain is malformed, unknown, has no MX record, or declares that it accepts no email. Any other DNS error, such as a lookup taking more than two seconds, does not blame the domain: the answer is then `true`, so signing in always stays possible. The backend keeps each answer in memory for an hour.

```typescript
const { valid } = await trpc.user.checkEmailDomain.query({
  domain: 'example.com',
})
```

## Query `user.checkEmailDelivery`

Tells whether the sign-in code sent to an address couldn’t be delivered: unknown mailbox or domain, invalid address, or an address the email provider blocks. The app polls it for two minutes after sending a code, to show right away that the address seems wrong. Bounces are reported to the backend by the email provider and kept in memory for an hour. This procedure is public because it is used before signing in.

Input

Type

Description

`email`

`String`

Address the code was sent to. Required.

`since`

`Number`

Timestamp in milliseconds: only bounces from this moment count. Required.

It returns `{ bounced }`.

```typescript
const { bounced } = await trpc.user.checkEmailDelivery.query({
  email: 'jane@example.com',
  since: Date.now() - 60_000,
})
```

## Query `user.getDeletionPreview`

Lists what deleting the current user’s account would delete or unlink: the account, its API keys and calendar integrations, its archived organizations that are deleted with it, and the content of other organizations kept as is. It takes no input. This procedure is not exposed to the MCP server.

## Mutation `user.deleteAccount`

Deletes the current user’s account for good. It takes no input. The call is refused with `PRECONDITION_FAILED` while the user is still a member of an active organization: they leave it or delete it first. Their archived organizations they owned alone, or where nobody else took part, are deleted with the account. The account is deleted, or anonymized and disabled while content of other organizations still references it. This procedure is not exposed to the MCP server.
