Overview
Magic Links are shareable URLs that let your users connect provider accounts or upload files without embedding widgets in your application. There are three types:- Provider — multi-provider authentication (connect one or more providers).
- Authentication — single-provider authentication (connect exactly one provider).
- File Upload — manual file upload through a hosted interface.
https://api.withleaf.io/services/widgets/api
All Magic Link types share the same
expiresIn parameter: lifetime in seconds, minimum 900, maximum approximately 1 year.The GET endpoints return usage-tracking fields such as
usageCount and maxUsage. Magic Links are not inherently single-use.Settings object
Every Magic Link type accepts an optionalsettings object to customize the hosted page:
Provider Magic Link
Lets the end user authenticate with multiple providers in a single session.Endpoints
Create a Provider Magic Link (with Leaf user)
POST /magic-link/users/{leafUserId}/provider
Creates a Magic Link for an existing Leaf user.
Path parameters
Request body
Response
Create a Provider Magic Link (with auto Leaf user)
POST /magic-link/provider
Creates a Magic Link for flows where Leaf creates a Leaf user based on the provided externalId.
Request body
Get all Provider Magic Links
GET /magic-link/provider
Returns all Provider Magic Links for your API owner.
Query parameters
Response
Get a Provider Magic Link
GET /magic-link/provider/{magicLinkId}
Returns a single Provider Magic Link by ID.
Path parameters
Response
Delete a Provider Magic Link
DELETE /magic-link/provider/{magicLinkId}
Permanently deletes a Provider Magic Link. The URL immediately stops working.
Path parameters
Authentication Magic Link
Lets the end user authenticate with a single, specified provider.Endpoints
Create an Authentication Magic Link (with Leaf user)
POST /magic-link/users/{leafUserId}/authentication
Creates a Magic Link scoped to a single provider for an existing Leaf user.
Path parameters
Request body
Response
Create an Authentication Magic Link (with auto Leaf user)
POST /magic-link/authentication
Creates a Magic Link for flows where Leaf creates a Leaf user based on the provided externalId.
Request body
Get, Delete
The Get all, Get one, and Delete endpoints for Authentication Magic Links follow the same pattern as the Provider Magic Link endpoints, but the resource includes a singleprovider field instead of allowedProviders.
Authentication list endpoints also use the same paginated envelope with items and nextPageToken.
Authentication list/get response shape
File Upload Magic Link
Lets the end user upload machine files through a hosted interface.Endpoints
Create a File Upload Magic Link (with Leaf user)
POST /magic-link/users/{leafUserId}/file-upload
Creates a Magic Link for uploading machine files, tied to an existing Leaf user.
Path parameters
Request body
Response
Create a File Upload Magic Link (with auto Leaf user)
POST /magic-link/file-upload
Creates a Magic Link for flows where Leaf creates a Leaf user based on the provided externalId.
Request body
Get, Delete
The Get all, Get one, and Delete endpoints for File Upload Magic Links follow the same paginated pattern as the Provider Magic Link endpoints. File Upload list endpoints also use the same paginated envelope withitems and nextPageToken.

