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

# auth

> Who am I, person sign-in, registration, and recovery — client.auth.

Eight methods. Everything else in the client authenticates with the `apiKey` the client was constructed with; this namespace is how a **person** gets a credential in the first place. API detail: [Authentication](https://vetta.sh/docs/api/authentication.md).

## me

```ts theme={"system"}
client.auth.me(): Promise<Identity>
```

`GET /v1/me` — who this credential is: principal, organization, scopes, and (for a person) email and role. The first call any client makes, and the reason none of them needs an `org_` id as input.

## session

```ts theme={"system"}
client.auth.session(body: { email?: string; code?: string; password?: string; organization_id?: string }): Promise<AuthSession>
```

`POST /v1/auth/session`. Two uses of one route:

* **Sign in** with `email` + the 6-digit `code` mailed to it (or `password`, for an account that set one) — answers a short-lived `vt_` bearer `token`, its `expires_at`, and the person's `organizations`.
* **Re-scope**: present an existing `vt_` token (as the client's `apiKey`) with an `organization_id` to switch organizations. An org you are not a member of is a `404 not_found`, the same answer as one that does not exist.

The `token` is a bearer credential — never put it in a browser.

## register

```ts theme={"system"}
client.auth.register(body: { email: string }): Promise<{ object: "auth_user"; email: string; confirmation_required: boolean; session?: AuthSession }>
```

`POST /v1/auth/users`. An email and nothing else: the address gets a 6-digit code, and no password exists until it is proved. A new dashboard account comes back with `session`, signed in unproved: it can set up a company, and is refused `403 email_unconfirmed` on paying or acting outward until `session({ email, code })` proves it. A taken address gets no `session`, only a code to sign in with.

## joinTournament

```ts theme={"system"}
client.auth.joinTournament(body: { answers: {
  name: string; company: string; building: string; knowledge: string; motivation: string;
  university?: string; x?: string; github?: string; linkedin?: string; projects?: string;
} }): Promise<TournamentEntry>
```

`POST /v1/tournament/entries`. Enters the signed-in person in the tournament, or rewrites their answers: one entry per email, same `tne_` id. A person's `vt_` session only; an API key is `forbidden`. No organization or plan is needed. Answers `201` with `{ id, object: "tournament_entry", email, answers, created_at, updated_at }`. `building` is 20–2000 characters; the other required answers are capped at 100 (`name`, `company`) or 1000 (`knowledge`, `motivation`).

## tournamentEntry

```ts theme={"system"}
client.auth.tournamentEntry(): Promise<{ object: "tournament_status"; entry: TournamentEntry | null }>
```

`GET /v1/tournament/entry`. The signed-in person's entry, or `entry: null` when they have not joined. A person's session only, like `joinTournament`.

## setPassword

```ts theme={"system"}
client.auth.setPassword(body: { password: string }): Promise<{ object: "auth_password"; updated: boolean }>
```

`POST /v1/auth/password`. Sets a password for the signed-in person (the client's `vt_`). Refused `403 email_unconfirmed` until the address is proved. There is no reset by mailed link: a person who forgot a password signs in with a code, then calls this.

## resendConfirmation

```ts theme={"system"}
client.auth.resendConfirmation(body: { email: string }): Promise<Acknowledged>
```

`POST /v1/auth/confirmations`. Mails a new 6-digit sign-in code. Answers `202` with `{ object, delivery }` **whether or not the address has an account**, and refuses alike at the limits — do not branch on it. A code is checked at most 5 times, then is dead.


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