---
title: supertokens-node/recipe/passwordless
description: References documentation for the supertokens-node/recipe/passwordless package
sidebar:
  order: 50
---

## Classes

### default

Defined in: [recipe/passwordless/index.ts:31](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L31)

#### Constructors

##### Constructor

```ts check=false reason="Generated API signature"
new default(): default;
```

###### Returns

[`default`](#default)

#### Properties

| Property | Modifier | Type | Default value | Defined in |
| ------ | ------ | ------ | ------ | ------ |
| <a id="member-default-error"></a> `Error` | `static` | *typeof* `default` | `SuperTokensError` | [recipe/passwordless/index.ts:34](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L34) |
| <a id="member-default-init"></a> `init` | `static` | (`config`) => [`RecipeListFunction`](types#recipelistfunction) | `Recipe.init` | [recipe/passwordless/index.ts:32](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L32) |

#### Methods

##### checkCode()

```ts check=false reason="Generated API signature"
static checkCode(input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  status: "OK";
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}>;
```

Defined in: [recipe/passwordless/index.ts:219](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L219)

This function will only verify the code (not consume it), and:
NOT create a new user if it doesn't exist
NOT verify the user email if it exists
NOT do any linking
NOT delete the code unless it returned RESTART_FLOW_ERROR

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `status`: `"OK"`;
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}\>

##### consumeCode()

###### Call Signature

```ts check=false reason="Generated API signature"
static consumeCode(input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}>;
```

Defined in: [recipe/passwordless/index.ts:77](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L77)

1. verifies the code
2. creates the user if it doesn't exist
3. tries to link it
4. marks the email as verified

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `session?`: `undefined`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `session?`: `undefined`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `"OK"`;
  `user`: [`User`](types#user);
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}\>

###### Call Signature

```ts check=false reason="Generated API signature"
static consumeCode(input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}
  | {
  reason:   | "EMAIL_VERIFICATION_REQUIRED"
     | "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
  status: "LINKING_TO_SESSION_USER_FAILED";
}>;
```

Defined in: [recipe/passwordless/index.ts:114](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L114)

1. verifies the code
2. creates the user if it doesn't exist
3. tries to link it
4. marks the email as verified

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `session`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `session`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `"OK"`;
  `user`: [`User`](types#user);
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}
  \| \{
  `reason`:   \| `"EMAIL_VERIFICATION_REQUIRED"`
     \| `"RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`
     \| `"ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`
     \| `"SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`;
  `status`: `"LINKING_TO_SESSION_USER_FAILED"`;
\}\>

##### createCode()

```ts check=false reason="Generated API signature"
static createCode(input): Promise<{
  codeId: string;
  codeLifetime: number;
  deviceId: string;
  linkCode: string;
  preAuthSessionId: string;
  status: "OK";
  timeCreated: number;
  userInputCode: string;
}>;
```

Defined in: [recipe/passwordless/index.ts:36](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L36)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; \} \| \{ `phoneNumber`: `string`; \} & `object` |

###### Returns

`Promise`\<\{
  `codeId`: `string`;
  `codeLifetime`: `number`;
  `deviceId`: `string`;
  `linkCode`: `string`;
  `preAuthSessionId`: `string`;
  `status`: `"OK"`;
  `timeCreated`: `number`;
  `userInputCode`: `string`;
\}\>

##### createMagicLink()

```ts check=false reason="Generated API signature"
static createMagicLink(input): Promise<string>;
```

Defined in: [recipe/passwordless/index.ts:331](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L331)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<`string`\>

##### createNewCodeForDevice()

```ts check=false reason="Generated API signature"
static createNewCodeForDevice(input): Promise<
  | {
  codeId: string;
  codeLifetime: number;
  deviceId: string;
  linkCode: string;
  preAuthSessionId: string;
  status: "OK";
  timeCreated: number;
  userInputCode: string;
}
  | {
  status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR";
}>;
```

Defined in: [recipe/passwordless/index.ts:59](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L59)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `deviceId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode?`: `string`; \} |
| `input.deviceId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |
| `input.userInputCode?` | `string` |

###### Returns

`Promise`\<
  \| \{
  `codeId`: `string`;
  `codeLifetime`: `number`;
  `deviceId`: `string`;
  `linkCode`: `string`;
  `preAuthSessionId`: `string`;
  `status`: `"OK"`;
  `timeCreated`: `number`;
  `userInputCode`: `string`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"` \| `"USER_INPUT_CODE_ALREADY_USED_ERROR"`;
\}\>

##### listCodesByDeviceId()

```ts check=false reason="Generated API signature"
static listCodesByDeviceId(input): Promise<DeviceType>;
```

Defined in: [recipe/passwordless/index.ts:313](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L313)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `deviceId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.deviceId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

###### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)\>

##### listCodesByEmail()

```ts check=false reason="Generated API signature"
static listCodesByEmail(input): Promise<DeviceType[]>;
```

Defined in: [recipe/passwordless/index.ts:299](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L299)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.email` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

###### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)[]\>

##### listCodesByPhoneNumber()

```ts check=false reason="Generated API signature"
static listCodesByPhoneNumber(input): Promise<DeviceType[]>;
```

Defined in: [recipe/passwordless/index.ts:306](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L306)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.phoneNumber` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

###### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)[]\>

##### listCodesByPreAuthSessionId()

```ts check=false reason="Generated API signature"
static listCodesByPreAuthSessionId(input): Promise<DeviceType>;
```

Defined in: [recipe/passwordless/index.ts:320](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L320)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.preAuthSessionId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

###### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)\>

##### revokeAllCodes()

```ts check=false reason="Generated API signature"
static revokeAllCodes(input): Promise<{
  status: "OK";
}>;
```

Defined in: [recipe/passwordless/index.ts:269](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L269)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<\{
  `status`: `"OK"`;
\}\>

##### revokeCode()

```ts check=false reason="Generated API signature"
static revokeCode(input): Promise<{
  status: "OK";
}>;
```

Defined in: [recipe/passwordless/index.ts:288](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L288)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `codeId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<\{
  `status`: `"OK"`;
\}\>

##### sendEmail()

```ts check=false reason="Generated API signature"
static sendEmail(input): Promise<void>;
```

Defined in: [recipe/passwordless/index.ts:373](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L373)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | [`TypePasswordlessEmailDeliveryInput`](recipe-passwordless-types#typepasswordlessemaildeliveryinput) & `object` |

###### Returns

`Promise`\<`void`\>

##### sendSms()

```ts check=false reason="Generated API signature"
static sendSms(input): Promise<void>;
```

Defined in: [recipe/passwordless/index.ts:380](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L380)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | [`TypePasswordlessSmsDeliveryInput`](recipe-passwordless-types#typepasswordlesssmsdeliveryinput) & `object` |

###### Returns

`Promise`\<`void`\>

##### signInUp()

```ts check=false reason="Generated API signature"
static signInUp(input): Promise<{
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: string;
  user: User;
}>;
```

Defined in: [recipe/passwordless/index.ts:352](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L352)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `session?`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `session?`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

###### Returns

`Promise`\<\{
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `string`;
  `user`: [`User`](types#user);
\}\>

##### updateUser()

```ts check=false reason="Generated API signature"
static updateUser(input): Promise<
  | {
  status:   | "OK"
     | "EMAIL_ALREADY_EXISTS_ERROR"
     | "UNKNOWN_USER_ID_ERROR"
     | "PHONE_NUMBER_ALREADY_EXISTS_ERROR";
}
  | {
  reason: string;
  status:   | "EMAIL_CHANGE_NOT_ALLOWED_ERROR"
     | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR";
}>;
```

Defined in: [recipe/passwordless/index.ts:257](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L257)

###### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `email?`: `string`; `phoneNumber?`: `string`; `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1); `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.email?` | `string` |
| `input.phoneNumber?` | `string` |
| `input.recipeUserId` | [`RecipeUserId`](index#recipeuserid-1) |
| `input.userContext?` | `Record`\<`string`, `any`\> |

###### Returns

`Promise`\<
  \| \{
  `status`:   \| `"OK"`
     \| `"EMAIL_ALREADY_EXISTS_ERROR"`
     \| `"UNKNOWN_USER_ID_ERROR"`
     \| `"PHONE_NUMBER_ALREADY_EXISTS_ERROR"`;
\}
  \| \{
  `reason`: `string`;
  `status`:   \| `"EMAIL_CHANGE_NOT_ALLOWED_ERROR"`
     \| `"PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"`;
\}\>

## Variables

### checkCode()

```ts check=false reason="Generated API signature"
checkCode: (input) => Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  status: "OK";
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}> = Wrapper.checkCode;
```

Defined in: [recipe/passwordless/index.ts:416](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L416)

This function will only verify the code (not consume it), and:
NOT create a new user if it doesn't exist
NOT verify the user email if it exists
NOT do any linking
NOT delete the code unless it returned RESTART_FLOW_ERROR

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

#### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `status`: `"OK"`;
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}\>

***

### consumeCode()

```ts check=false reason="Generated API signature"
consumeCode: {
  (input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}>;
  (input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}
  | {
  reason:   | "EMAIL_VERIFICATION_REQUIRED"
     | "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
  status: "LINKING_TO_SESSION_USER_FAILED";
}>;
} = Wrapper.consumeCode;
```

Defined in: [recipe/passwordless/index.ts:394](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L394)

#### Call Signature

```ts check=false reason="Generated API signature"
(input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}>;
```

1. verifies the code
2. creates the user if it doesn't exist
3. tries to link it
4. marks the email as verified

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `session?`: `undefined`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `session?`: `undefined`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

##### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `"OK"`;
  `user`: [`User`](types#user);
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}\>

#### Call Signature

```ts check=false reason="Generated API signature"
(input): Promise<
  | {
  consumedDevice: {
     email?: string;
     failedCodeInputAttemptCount: number;
     phoneNumber?: string;
     preAuthSessionId: string;
  };
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: "OK";
  user: User;
}
  | {
  failedCodeInputAttemptCount: number;
  maximumCodeInputAttempts: number;
  status: "INCORRECT_USER_INPUT_CODE_ERROR" | "EXPIRED_USER_INPUT_CODE_ERROR";
}
  | {
  status: "RESTART_FLOW_ERROR";
}
  | {
  reason:   | "EMAIL_VERIFICATION_REQUIRED"
     | "RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"
     | "SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR";
  status: "LINKING_TO_SESSION_USER_FAILED";
}>;
```

1. verifies the code
2. creates the user if it doesn't exist
3. tries to link it
4. marks the email as verified

##### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `deviceId`: `string`; `preAuthSessionId`: `string`; `session`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode`: `string`; \} \| \{ `linkCode`: `string`; `preAuthSessionId`: `string`; `session`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

##### Returns

`Promise`\<
  \| \{
  `consumedDevice`: \{
     `email?`: `string`;
     `failedCodeInputAttemptCount`: `number`;
     `phoneNumber?`: `string`;
     `preAuthSessionId`: `string`;
  \};
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `"OK"`;
  `user`: [`User`](types#user);
\}
  \| \{
  `failedCodeInputAttemptCount`: `number`;
  `maximumCodeInputAttempts`: `number`;
  `status`: `"INCORRECT_USER_INPUT_CODE_ERROR"` \| `"EXPIRED_USER_INPUT_CODE_ERROR"`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"`;
\}
  \| \{
  `reason`:   \| `"EMAIL_VERIFICATION_REQUIRED"`
     \| `"RECIPE_USER_ID_ALREADY_LINKED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`
     \| `"ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`
     \| `"SESSION_USER_ACCOUNT_INFO_ALREADY_ASSOCIATED_WITH_ANOTHER_PRIMARY_USER_ID_ERROR"`;
  `status`: `"LINKING_TO_SESSION_USER_FAILED"`;
\}\>

***

### createCode()

```ts check=false reason="Generated API signature"
createCode: (input) => Promise<{
  codeId: string;
  codeLifetime: number;
  deviceId: string;
  linkCode: string;
  preAuthSessionId: string;
  status: "OK";
  timeCreated: number;
  userInputCode: string;
}> = Wrapper.createCode;
```

Defined in: [recipe/passwordless/index.ts:392](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L392)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; \} \| \{ `phoneNumber`: `string`; \} & `object` |

#### Returns

`Promise`\<\{
  `codeId`: `string`;
  `codeLifetime`: `number`;
  `deviceId`: `string`;
  `linkCode`: `string`;
  `preAuthSessionId`: `string`;
  `status`: `"OK"`;
  `timeCreated`: `number`;
  `userInputCode`: `string`;
\}\>

***

### createMagicLink()

```ts check=false reason="Generated API signature"
createMagicLink: (input) => Promise<string> = Wrapper.createMagicLink;
```

Defined in: [recipe/passwordless/index.ts:412](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L412)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

#### Returns

`Promise`\<`string`\>

***

### createNewCodeForDevice()

```ts check=false reason="Generated API signature"
createNewCodeForDevice: (input) => Promise<
  | {
  codeId: string;
  codeLifetime: number;
  deviceId: string;
  linkCode: string;
  preAuthSessionId: string;
  status: "OK";
  timeCreated: number;
  userInputCode: string;
}
  | {
  status: "RESTART_FLOW_ERROR" | "USER_INPUT_CODE_ALREADY_USED_ERROR";
}> = Wrapper.createNewCodeForDevice;
```

Defined in: [recipe/passwordless/index.ts:404](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L404)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `deviceId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; `userInputCode?`: `string`; \} |
| `input.deviceId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |
| `input.userInputCode?` | `string` |

#### Returns

`Promise`\<
  \| \{
  `codeId`: `string`;
  `codeLifetime`: `number`;
  `deviceId`: `string`;
  `linkCode`: `string`;
  `preAuthSessionId`: `string`;
  `status`: `"OK"`;
  `timeCreated`: `number`;
  `userInputCode`: `string`;
\}
  \| \{
  `status`: `"RESTART_FLOW_ERROR"` \| `"USER_INPUT_CODE_ALREADY_USED_ERROR"`;
\}\>

***

### Error

```ts check=false reason="Generated API signature"
Error: typeof default = Wrapper.Error;
```

Defined in: [recipe/passwordless/index.ts:390](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L390)

***

### init()

```ts check=false reason="Generated API signature"
init: (config) => RecipeListFunction = Wrapper.init;
```

Defined in: [recipe/passwordless/index.ts:388](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L388)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `config` | [`TypeInput`](recipe-passwordless-types#typeinput) |

#### Returns

[`RecipeListFunction`](types#recipelistfunction)

***

### listCodesByDeviceId()

```ts check=false reason="Generated API signature"
listCodesByDeviceId: (input) => Promise<DeviceType> = Wrapper.listCodesByDeviceId;
```

Defined in: [recipe/passwordless/index.ts:396](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L396)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `deviceId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.deviceId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

#### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)\>

***

### listCodesByEmail()

```ts check=false reason="Generated API signature"
listCodesByEmail: (input) => Promise<DeviceType[]> = Wrapper.listCodesByEmail;
```

Defined in: [recipe/passwordless/index.ts:398](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L398)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.email` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

#### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)[]\>

***

### listCodesByPhoneNumber()

```ts check=false reason="Generated API signature"
listCodesByPhoneNumber: (input) => Promise<DeviceType[]> = Wrapper.listCodesByPhoneNumber;
```

Defined in: [recipe/passwordless/index.ts:400](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L400)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.phoneNumber` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

#### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)[]\>

***

### listCodesByPreAuthSessionId()

```ts check=false reason="Generated API signature"
listCodesByPreAuthSessionId: (input) => Promise<DeviceType> = Wrapper.listCodesByPreAuthSessionId;
```

Defined in: [recipe/passwordless/index.ts:402](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L402)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.preAuthSessionId` | `string` |
| `input.tenantId` | `string` |
| `input.userContext?` | `Record`\<`string`, `any`\> |

#### Returns

`Promise`\<[`DeviceType`](recipe-passwordless-types#devicetype)\>

***

### revokeAllCodes()

```ts check=false reason="Generated API signature"
revokeAllCodes: (input) => Promise<{
  status: "OK";
}> = Wrapper.revokeAllCodes;
```

Defined in: [recipe/passwordless/index.ts:408](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L408)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

#### Returns

`Promise`\<\{
  `status`: `"OK"`;
\}\>

***

### revokeCode()

```ts check=false reason="Generated API signature"
revokeCode: (input) => Promise<{
  status: "OK";
}> = Wrapper.revokeCode;
```

Defined in: [recipe/passwordless/index.ts:410](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L410)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `codeId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `preAuthSessionId`: `string`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

#### Returns

`Promise`\<\{
  `status`: `"OK"`;
\}\>

***

### sendEmail()

```ts check=false reason="Generated API signature"
sendEmail: (input) => Promise<void> = Wrapper.sendEmail;
```

Defined in: [recipe/passwordless/index.ts:420](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L420)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | [`TypePasswordlessEmailDeliveryInput`](recipe-passwordless-types#typepasswordlessemaildeliveryinput) & `object` |

#### Returns

`Promise`\<`void`\>

***

### sendSms()

```ts check=false reason="Generated API signature"
sendSms: (input) => Promise<void> = Wrapper.sendSms;
```

Defined in: [recipe/passwordless/index.ts:422](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L422)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | [`TypePasswordlessSmsDeliveryInput`](recipe-passwordless-types#typepasswordlesssmsdeliveryinput) & `object` |

#### Returns

`Promise`\<`void`\>

***

### signInUp()

```ts check=false reason="Generated API signature"
signInUp: (input) => Promise<{
  createdNewRecipeUser: boolean;
  recipeUserId: RecipeUserId;
  status: string;
  user: User;
}> = Wrapper.signInUp;
```

Defined in: [recipe/passwordless/index.ts:414](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L414)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \| \{ `email`: `string`; `session?`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} \| \{ `phoneNumber`: `string`; `session?`: `SessionContainerInterface`; `tenantId`: `string`; `userContext?`: `Record`\<`string`, `any`\>; \} |

#### Returns

`Promise`\<\{
  `createdNewRecipeUser`: `boolean`;
  `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1);
  `status`: `string`;
  `user`: [`User`](types#user);
\}\>

***

### updateUser()

```ts check=false reason="Generated API signature"
updateUser: (input) => Promise<
  | {
  status:   | "OK"
     | "EMAIL_ALREADY_EXISTS_ERROR"
     | "UNKNOWN_USER_ID_ERROR"
     | "PHONE_NUMBER_ALREADY_EXISTS_ERROR";
}
  | {
  reason: string;
  status:   | "EMAIL_CHANGE_NOT_ALLOWED_ERROR"
     | "PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR";
}> = Wrapper.updateUser;
```

Defined in: [recipe/passwordless/index.ts:406](https://github.com/supertokens/supertokens-node/blob/8353a9a70d8b17dd9ff6ffe41201fa2ef0e60218/lib/ts/recipe/passwordless/index.ts#L406)

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `input` | \{ `email?`: `string`; `phoneNumber?`: `string`; `recipeUserId`: [`RecipeUserId`](index#recipeuserid-1); `userContext?`: `Record`\<`string`, `any`\>; \} |
| `input.email?` | `string` |
| `input.phoneNumber?` | `string` |
| `input.recipeUserId` | [`RecipeUserId`](index#recipeuserid-1) |
| `input.userContext?` | `Record`\<`string`, `any`\> |

#### Returns

`Promise`\<
  \| \{
  `status`:   \| `"OK"`
     \| `"EMAIL_ALREADY_EXISTS_ERROR"`
     \| `"UNKNOWN_USER_ID_ERROR"`
     \| `"PHONE_NUMBER_ALREADY_EXISTS_ERROR"`;
\}
  \| \{
  `reason`: `string`;
  `status`:   \| `"EMAIL_CHANGE_NOT_ALLOWED_ERROR"`
     \| `"PHONE_NUMBER_CHANGE_NOT_ALLOWED_ERROR"`;
\}\>

## References

### APIInterface

Re-exports [APIInterface](recipe-passwordless-types#apiinterface)

***

### APIOptions

Re-exports [APIOptions](recipe-passwordless-types#apioptions)

***

### RecipeInterface

Re-exports [RecipeInterface](recipe-passwordless-types#recipeinterface)
