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

const client = new Whop({
  apiKey: 'My API Key',
});

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": "<string>",
  "expires_at": "2023-12-01T05:00:00.401Z"
}

Authorizations

Authorization
string
header
required

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

Body

application/json

Parameters for CreateAccountLink

company_id
string
required

The ID of the Company to generate the url for. The company must be a sub-merchant of the API key's company.

Example:

"biz_xxxxxxxxxxxxxx"

refresh_url
string
required

The URL to redirect to if the session expires and needs to be re-authenticated due to the token expiring.

return_url
string
required

The URL to redirect to when the customer wants to return to your site.

use_case
enum<string>
required

The use case for which the link will be used.

Available options:
account_onboarding,
payouts_portal

Response

A successful response

An object representing a url that a user can be directed to to access their account.

url
string
required

The URL to navigate the user to.

expires_at
string<date-time>
required

The expiration timestamp of the url.

Example:

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