# Lookup email

Quick example: <https://loginwithlink.com/api/lookup-email?email=m@rkmoriarty.com&STRIPE_PUBLIC_KEY=pk_live_51JocsEAGmp0k5LnwNUl7SJzZMhMMcMJ4X4PWg928nJLm5ocPpzHLhBOBMbTLBrXPYdkepbg9HX0AJFY8ixt2bXTV00vg5Ja3DP> <- That uses my public key — please use your own once you get the idea!

## Request

This is a GET request.

```
GET https://loginwithlink.com/api/lookup-email
```

Include the following query parameters

| Parameter           | Example                                                                                                       |
| ------------------- | ------------------------------------------------------------------------------------------------------------- |
| email               | <m@rkmoriarty.com>                                                                                            |
| STRIPE\_PUBLIC\_KEY | pk\_live\_51JocsEAGmp0k5LnwNUl7SJzZMhMMcMJ4X4PWg928nJLm5ocPpzHLhBOBMbTLBrXPYdkepbg9HX0AJFY8ixt2bXTV00vg5Ja3DP |
|                     |                                                                                                               |

In total, your request will look like this

```
GET 
https://loginwithlink.com/api/lookup-email?email=m@rkmoriarty.com&STRIPE_PUBLIC_KEY=pk_live_51JocsEA_YOUR_KEY_HERE
```

e.g., if using \`fetch\`, you might compose a request like so:

```javascript
const url = "https://loginwithlink.com/api/lookup-email";
const queryParams = {
  email: "m@rkmoriarty.com",
  STRIPE_PUBLIC_KEY: "pk_live_51JocsEAGmp0k5LnwNUl7SJzZMhMMcMJ4X4PWg928nJLm5ocPpzHLhBOBMbTLBrXPYdkepbg9HX0AJFY8ixt2bXTV00vg5Ja3DP"
};

const queryString = Object.entries(queryParams)
  .map(([key, value]) => `${encodeURIComponent(key)}=${encodeURIComponent(value)}`)
  .join("&");

const fullUrl = `${url}?${queryString}`;

fetch(fullUrl)
  .then(response => response.json())
  .then(data => {
    // Handle the response data here
    console.log(data);
  })
  .catch(error => {
    // Handle any errors that occur during the fetch request
    console.error(error);
  });
```

##

## Response

The response will look something like this, if a match is found:

```json
{
  "result": "success",
  "parametersSubmitted": {
    "email": "m@rkmoriarty.com",
    "STRIPE_PUBLIC_KEY": "pk_live_51JocsEAGredacted [you provided in your request]"
  },
  "userExistsOnLink": true, // or false, if user not found on Link
  "client_secret": "ABCD1234redacted" // Keep this handy; you'll need to re-submit in the final step
  "redacted_phone_number": "+3*********90" // you may wish to display this: "SMS has been sent to…"
}
```

You will see `"userExistsOnLink": false` if user is not found on Link.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.loginwithlink.com/use-api-only/lookup-email.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
