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

# Send Proposal Sign-in Code

> Emails the customer of a proposal a six-digit code to sign in with, so an existing customer can accept it without leaving the page.

# Send Proposal Sign-in Code

When [Proposal Login](https://learn.nexudus.com/api/endpoints/proposals/proposal-login.md) answers `mustSignIn: true`, the proposal is for a customer who already has an account and is not signed in. This endpoint emails that customer the **SignInCode** email: a six-digit code to send back to Proposal Login, and a link that signs them in and brings them back to `returnUrl`. See [Sign-in Codes](https://learn.nexudus.com/member-portal/auth/sign-in-codes.md).

The code goes to the address on the proposal's customer account, never to an address the caller chooses.

## Authentication

No authentication required.

At most 5 code emails go to one account in 15 minutes.

## Path Parameters

**proposalId** `string` *required*

The unique string identifier (GUID) of the proposal.

## Query Parameters

**returnUrl** `string` (default: /)

The page the email's link brings the customer back to, normally the proposal page itself. Only a path on the portal is used; anything else falls back to `/`.

## Response

**CodeSent** `boolean`

`true` when the email went out.

**Email** `string`

The address it went to, masked (`j•••@example.com`), so the page can say where to look without disclosing whose proposal it is.

### Errors

| Message | When |
| - | - |
| `NO_ACCOUNT` | The customer has no account yet. Proposal Login creates it and signs them in, so there is nothing to prove |
| `TWO_FACTOR_REQUIRED` | The account has two-factor authentication: a code cannot open a session there. Send the customer to the sign-in page |
| `TOO_MANY_CODES` | More than 5 code emails in 15 minutes. No email goes out and the last code sent keeps working |
| `PROPOSAL_EXPIRED`, `PROPOSAL_REJECTED` | As for Proposal Login |

A `404` comes from a proposal that is not this location's, or from a platform version without codes. The portal treats both, and `TWO_FACTOR_REQUIRED`, by sending the customer to the sign-in page.

## Examples

```http theme={null}
POST /api/public/proposals/abc123-def456/login/code?returnUrl=%2Fhoxton%2Fcheckout%2Fproposal%3Fproposal_id%3Dabc123-def456
```

```json theme={null}
{
  "CodeSent": true,
  "Email": "j•••@example.com"
}
```

## TypeScript Integration

```typescript theme={null}
import { useProposalData } from '@/views/checkout/useProposalData'

const { loginWithProposal, sendLoginCode, loginWithCode, redirectToSignIn } = useProposalData()

if ((await loginWithProposal()) === 'mustSignIn') {
  const sent = await sendLoginCode() // null: no code possible, use the sign-in page
  if (!sent) redirectToSignIn()
  // ...ask for the code sent to sent.email, then:
  await loginWithCode(code)
}
```


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