Skip to main content
POST
/
leads
JavaScript
import Whop from '@whop/sdk';

const client = new Whop({
  apiKey: process.env['WHOP_API_KEY'], // This is the default and can be omitted
});

const lead = await client.leads.create({ company_id: 'biz_xxxxxxxxxxxxxx' });

console.log(lead.id);
{
  "id": "lead_xxxxxxxxxxxxx",
  "created_at": "2023-12-01T05:00:00.401Z",
  "updated_at": "2023-12-01T05:00:00.401Z",
  "referrer": "<string>",
  "metadata": {},
  "user": {
    "id": "user_xxxxxxxxxxxxx",
    "email": "[email protected]",
    "name": "John Doe",
    "username": "johndoe42"
  },
  "product": {
    "id": "prod_xxxxxxxxxxxxx",
    "title": "<string>"
  },
  "member": {
    "id": "<string>"
  }
}

Authorizations

Authorization
string
header
required

The app API key from an app from the /dashboard/developer page

Body

application/json

Parameters for CreateLeadV2

company_id
string
required

The ID of the company to create a lead for.

Example:

"biz_xxxxxxxxxxxxxx"

metadata
object

Custom metadata for the lead.

product_id
string | null

The ID of the product the lead is interested in.

Example:

"prod_xxxxxxxxxxxxx"

referrer
string | null

The url referrer of the lead, if any.

user_id
string | null

The ID of the user to create a lead for. If the request is made by a user, that user will be used.

Example:

"user_xxxxxxxxxxxxx"

Response

A successful response

An object representing a lead (someone who is interested in a whop).

id
string
required

The ID of the lead.

Example:

"lead_xxxxxxxxxxxxx"

created_at
string<date-time>
required

The timestamp of when the lead was created.

Example:

"2023-12-01T05:00:00.401Z"

updated_at
string<date-time>
required

The timestamp of when the lead was last updated.

Example:

"2023-12-01T05:00:00.401Z"

referrer
string | null
required

The referrer URL that brought this lead.

metadata
object
required

Custom metadata for the lead.

user
object
required

The user who is the lead.

product
object
required

The access pass the lead is interested in, if available.

member
object
required

The converted member, if any.