📍 Bolt Help / Products / Accounts / Implementing the Authorization Modal / Account Detection via API
Account Detection via API
Check whether or not a shopper has a Bolt account.

DEPRECATION

We recommend using our Email Detection component to find and validate Bolt Accounts. This component will be deprecated soon.

The Account Detection API Component queries Bolt via our Detect Account API to determine whether the shopper has an existing Bolt Account for the inputted shopper information, such as email address. Account information displays upon recognizing a shopper with a Bolt account.

TIP

Bolt Accounts can detect shoppers when they enter either an email address or a phone number associated with their account. Bolt recommends that you configure at least an email address input field.

Shopper Experience

Shoppers should be prompted to enter their email address into a field enabled to query Bolt’s Detect Account API.

Check for a Bolt Account

To check whether a shopper has an existing Bolt Account, you can either use Bolt’s front-end detect account component or the Detect Account API.

Detect Account Component

Call the account detection function to check whether a Bolt account exists for a shopper:

let hasAccountResponse = await authorizationComponent.hasAccount({email: $email});  
// hasAccountResponse returns a boolean value that indicates whether a  Bolt account exists for this email
let hasAccountResponse = await authorizationComponent.hasAccount({emailSha256: Bolt.helpers.normalizeEmail(email)})
// hasAccountResponse returns a boolean value that indicates whether a  Bolt account exists for this email

Detect Account Endpoint

Send a GET request from the browser to https://api.bolt.com/v1/account/exists to check whether a Bolt account exists for a user.

INFO

You must call this endpoint from the browser. It is designed to be a browser endpoint for a better user experience and per-IP address rate limiting. Additionally, calling from the browser enables the collection of shopper IP addresses for use in authentication.

async function accountExists(email) {
	const response = await fetch("https://api-sandbox.bolt.com/v1/account/exists?email=" +
		encodeURIComponent(email));
	const responseAsJson = await response.json();
	return responseAsJson.has_bolt_account;
}

Success Response

{
    "has_bolt_account": true,
    ...
}

Error Response

{ 
	"result": { 
    	"success": false 
	}, 
	"errors": [{ 
      	"code": 1005, 
      	"message": "Authentication error. Invalid merchant key." 
	}] 
} 

Next Step in Shopper Flow

  • On Success + True: Authorize the shopper, retrieve shopper data, then open the Bolt Checkout modal using the embed.js script previously installed.
  • On Success + False: Send the shopper to your guest checkout experience.
  • On Failure: Send the shopper to your guest checkout experience.

Next Step

After you implement the Authorization Modal, you will fetch the OAuth tokens to access Bolt Account APIs.

Filter by Section
Filter by Topic