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": "https://twitter.com/whabormarket",
  "metadata": {},
  "user": {
    "id": "user_xxxxxxxxxxxxx",
    "email": "john.doe@example.com",
    "name": "John Doe",
    "username": "johndoe42"
  },
  "product": {
    "id": "prod_xxxxxxxxxxxxx",
    "title": "Pickaxe Analytics"
  },
  "member": {
    "id": "<string>"
  }
}

Authorizations

Authorization
string
header
required

A company API key, company scoped JWT, app API key, or user OAuth token. You must prepend your key/token with the word 'Bearer', which will look like Bearer ***************************

Body

application/json

Parameters for CreateLeadV2

company_id
string
required

The unique identifier of the company to create the lead for, starting with 'biz_'.

Example:

"biz_xxxxxxxxxxxxxx"

metadata
object | null

A JSON object of custom metadata to attach to the lead for tracking purposes.

product_id
string | null

The unique identifier of the product the lead is interested in, starting with 'prod_'.

Example:

"prod_xxxxxxxxxxxxx"

referrer
string | null

The referral URL that brought the lead to the company, such as 'https://example.com/landing'.

user_id
string | null

The unique identifier of the user to record as the lead. If authenticated as a user, that user is used automatically.

Example:

"user_xxxxxxxxxxxxx"

Response

A successful response

A prospective customer who has expressed interest in a company or product but has not yet purchased.

id
string
required

The unique identifier for the lead.

Example:

"lead_xxxxxxxxxxxxx"

created_at
string<date-time>
required

The datetime the lead was created.

Example:

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

updated_at
string<date-time>
required

The datetime the lead was last updated.

Example:

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

referrer
string | null
required

The URL of the page that referred this lead to the company. Null if no referrer was captured.

Example:

"https://twitter.com/whabormarket"

metadata
object | null
required

Custom key-value pairs attached to this lead. Null if no metadata was provided.

user
object
required

The user account associated with this lead.

product
object | null
required

The product the lead expressed interest in. Null if the lead is not associated with a specific product.

member
object | null
required

The company member record if this lead has converted into a paying customer. Null if the lead has not converted.