---
title: "Invites namespace"
label: "Invites"
description: "Reference for previewing company member invites before sign-in."
publishedAt: 2026-10-06
order: 9
status: "published"
---

Look up a company member invite from its link before the person signs in, so your "Join company" page can show the company and the right next step.

Company admins invite teammates with [`board.me.companies.createInvite`](/docs/sdk/reference/me). The email links to `/employers/invites/accept?token=…` on your board. Accepting still needs a signed-in employer; this namespace only reads.

## `board.invites.preview()`

```ts
preview(
  body: PreviewCompanyMemberInviteBody,
  options?: FetchOptions,
): Promise<CompanyMemberInvitePreview>
```

Send the `token` from the link. The token travels in the request body, not the URL. The result:

| Field | Type | Notes |
| --- | --- | --- |
| `status` | `'pending' \| 'expired' \| 'accepted' \| 'revoked'` | Only `pending` can be accepted. |
| `email` | `string \| null` | The invited address. `null` unless `status` is `pending`. |
| `expiresAt` | `string` | ISO 8601. Invites last 7 days. |
| `account` | `'none' \| 'employer' \| 'candidate' \| null` | Whether the invited address already has an account on the board. `null` unless `status` is `pending`. |
| `company` | `{ slug, name, logoUrl }` | The company the invite is for. |

```ts
import { isBoardApiError } from '@cavuno/board';

const token = new URL(request.url).searchParams.get('token') ?? '';

try {
  const invite = await board.invites.preview({ token });
  if (invite.status !== 'pending') {
    return { state: 'link_used_or_expired' as const, invite };
  }
  if (invite.account === 'none') return { state: 'sign_up' as const, invite };
  if (invite.account === 'employer') return { state: 'sign_in' as const, invite };
  return { state: 'candidate_account' as const, invite };
} catch (error) {
  if (isBoardApiError(error) && error.code === 'employer_invite_not_found') {
    return { state: 'not_found' as const };
  }
  throw error;
}
```

## Signing up from an invite

Prefill the sign-up form with `invite.email` and pass the token to `register` as `inviteToken`. When it matches a pending invite for the same email, no verification email is sent, because accepting the invite verifies the address. Then accept the invite:

```ts
await board.auth.register({
  role: 'employer',
  method: 'emailpass',
  email: invite.email!,
  password,
  displayName,
  inviteToken: token,
});
const { companySlug } = await board.me.acceptInvite({ token });
```

Registration never accepts the invite itself. A token that does not match is ignored and the verification email is sent as usual.

## Errors

- `employer_invite_not_found` (404): no invite on this board matches the token, or the company no longer exists.
- `board_auth_registration_disabled` (403): employer accounts are turned off on this board.
