Skip to main content
POST
/
account_links
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 accountLink = await client.accountLinks.create({
  company_id: 'biz_xxxxxxxxxxxxxx',
  refresh_url: 'refresh_url',
  return_url: 'return_url',
  use_case: 'account_onboarding',
});

console.log(accountLink.expires_at);
{
  "url": "https://whop.com/payouts/biz_xxxxxxxxx/verify",
  "expires_at": "2023-12-01T05:00:00.401Z"
}

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 CreateAccountLink

company_id
string
required

The unique identifier of the company to generate the link for, starting with 'biz_'. Must be a sub-merchant of the API key's company.

Example:

"biz_xxxxxxxxxxxxxx"

refresh_url
string
required

The URL to redirect the user to if the session expires and needs to be re-authenticated, such as 'https://example.com/refresh'.

return_url
string
required

The URL to redirect the user to when they want to return to your site, such as 'https://example.com/return'.

use_case
enum<string>
required

The purpose of the account link, such as hosted payouts portal or hosted KYC onboarding.

Available options:
account_onboarding,
payouts_portal

Response

A successful response

A temporary, time-limited URL that grants a user access to an external account management page.

url
string
required

The temporary URL to redirect the user to for account access. Expires at the time specified by expires_at.

Example:

"https://whop.com/payouts/biz_xxxxxxxxx/verify"

expires_at
string<date-time>
required

The timestamp after which this account link URL is no longer valid.

Example:

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