The Account Link object

Account Links are the means by which a platform grants a connected account permission to access Zoneless-hosted applications, such as the onboarding flow.

Stripe API equivalent
ENDPOINTS
POST /v1/account_links
Key concept: Account links are single-use URLs that expire after 1 hour. When the user visits the URL, they are taken through the Connect Onboarding flow to complete their account setup and connect their Solana wallet.

After creating a connected account, create an account link and redirect the user to the url to guide them through onboarding. Once they complete onboarding or leave the flow, they will be redirected to your return_url.

Attributes

object string

String representing the object's type. Objects of the same type share the same value. Always account_link.

created timestamp

Time at which the object was created. Measured in seconds since the Unix epoch.

expires_at timestamp

The timestamp at which this account link will expire. Account links expire after 1 hour.

url string

The URL for the account link. Redirect the connected account holder to this URL to take them through the onboarding flow.

THE ACCOUNT LINK OBJECT
{
  "object": "account_link",
  "created": 1704067200,
  "expires_at": 1704070800,
  "url": "https://dashboard.yourdomain.com/onboard?token=al_z_abc123..."
}

Create an account link

Creates an AccountLink object that includes a single-use Zoneless URL that the platform can redirect their user to in order to take them through the Connect Onboarding flow.

ENDPOINTS
POST /v1/account_links
Tip: Account links are single-use and expire after 1 hour. Always generate a new link when redirecting users to onboarding.

Parameters

account string Required

The identifier of the account to create an account link for.

type enum Required

The type of account link the user is requesting.

Possible enum values
account_onboardingProvides a form for inputting outstanding requirements. Send the user to the form in this mode to collect the information you need.
account_updateDisplays the fields that are already populated on the account object, and allows your user to edit previously provided information. Consider framing this as "edit my profile" or "update my verification information".
refresh_url string Required

The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.

return_url string Required

The URL that the user will be redirected to upon leaving or completing the linked flow.

Returns

Returns an AccountLink object if the call succeeds.

POST/v1/account_links
import { Zoneless } from '@zoneless/node';
const zoneless = new Zoneless('sk_live_z_YOUR_API_KEY', 'https://api.yourdomain.com');

const accountLink = await zoneless.accountLinks.create({
  account: 'acct_z_1Nv0FGQ9RKHgCVdK',
  refresh_url: 'https://example.com/reauth',
  return_url: 'https://example.com/return',
  type: 'account_onboarding',
});
RESPONSE
{
  "object": "account_link",
  "created": 1704067200,
  "expires_at": 1704070800,
  "url": "https://dashboard.yourdomain.com/onboard?token=al_z_abc123..."
}