Skip to main content
POST/gate/magic-link/send

Send Magic Link

Sends a single-use magic link to the end-user's email address to initiate passwordless sign-in.

The magic link token has a 15-minute TTL.

Returns 202 Accepted regardless of whether the email matches an existing end-user, preventing enumeration.

Parameters
projectSlug *path

The project's slug: the path segment after @.

It is unique within the org.

Request body
email *string <email>

The address to send the sign-in link to.

The response is the same whether or not an active end user has this address; a link is only sent when one does.

redirectUrlstring

The page the link opens.

It must exactly match an entry on the project's magic-link redirect list, or the request gets 400 K9O_GATE_REDIRECT_NOT_ALLOWED.

Omitted, the project's default redirect is used.

The link adds token and project query parameters to it.

Responses
HTTPK9O CodeDescription
200Success
404K9O_END_USER_NOT_FOUNDNo end-user account is registered for the supplied email address.
Response body (200)
data *object

The result of the send request.

If the address belongs to an end user of the project, a sign-in link is emailed to it.

magicLink *object

The send request was accepted.

The answer is the same for every address.

sent *true

Always true, whether or not the address belongs to an end user, so the response does not reveal who is registered.

expiresAt *string <date-time>

When the link expires, 15 minutes from now.

Present for every address, registered or not.

debugLinkstring

The sign-in link itself.

Only in a test deployment that turns this on; a production deployment never includes it.

meta *any

Request metadata: cost, timing and the request and trace ids.

TypeScript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.passwordless.requestMagicLink({
  email: '[email protected]'
})

Showing example in TypeScript

Request example
{
  "email": "[email protected]"
}
Response example (200)
{
  "data": {
    "magicLink": {
      "sent": true,
      "expiresAt": "string"
    },
    "debugLink": "string"
  }
}

More in Sign-in & Sessions