Skip to content

Create a magic link

Magic links let you authenticate patients and redirect them to a specific page — like a vitals scan — without requiring them to log in. This is useful when you’re integrating scans into your own app and want a seamless experience for patients.

  1. Register the patient with their name and email. If a patient with the same email already exists, their record is updated by default.

    const { data: patient } =
    await client.v1.core.patients.create({
    name: 'Jane Smith',
    email: 'jane@example.com',
    })
  2. Construct the URL for the scan page using your business alias and the link slug. You can find both in the Vitals dashboard or by calling client.v1.vitals.links.list().

    const alias = process.env.UPVIO_BUSINESS_ALIAS
    const slug = 'your-link-slug'
    const scanUrl =
    `https://scan.upvio.com/${alias}/links/${slug}`
  3. Create a magic link that authenticates the patient and redirects them to the scan URL:

    const { data: magicLink } =
    await client.v1.core.patients.createMagicLink(
    patient.id,
    { redirectUrl: scanUrl },
    )
    console.log(magicLink.url)
    // https://account.upvio.com/auth/magic?token=...

    Send magicLink.url to the patient via email, SMS, or display it in your app. When they open the link, they’re authenticated and taken straight to the scan.