---
title: "Generates a Magic Link to be used to login."
method: POST
path: "/api/auth/magic-link-generate"
tags: ["Authentication"]
deprecated: true
---

# Generates a Magic Link to be used to login.

`POST /api/auth/magic-link-generate`

## Request

- Base URL: `https://passivelogic.com` (the document declares no server; this is the origin it was published from)
- URL: `https://passivelogic.com/api/auth/magic-link-generate`
- Auth: one of:
  - API key in header `X-PL-AUTH`
  - API key in header `Authorization: PL-API-KEY`
  - API key in header `PL-API-KEY`
  - HTTP basic
- TypeScript: <https://skmtc.dev/passivelogic/apis/passivelogic-http-api/docs/api/auth/magic-link-generate/post.ts> (a function with typed inputs; its response is checked against the schema)

> **Deprecated.**

DEPRECATED: This endpoint is not available when Keycloak authentication is turned on and will be removed in the future.

Generates magic link containing `?token=<signed JWT with user email contained>` and sends it in an email to the user.
This is the secure mode and MUST be used in production.
This will not return a link to the client.

If User does not exist in Database, will throw 400 bad request. If user exists, will return 200 ok.
These links can then be used to login from GET magic-link-login.

## Request body

- UserRegistrationInitiation: Information for intiating user registration
  - `lastName` string, nullable
  - `firstName` string, nullable
  - `email` string, required: Email that is registering for a new account.

## Response `200`

OK

- MagicLinkResponse: Email for use signing up with a magic link
  - `message` string, nullable: Message describing the response type.
  - `url` string, nullable: Url to be used a magic link login.

---

[API](https://skmtc.dev/passivelogic/apis/passivelogic-http-api.md) - [All operations](https://skmtc.dev/passivelogic/apis/passivelogic-http-api/llms.txt) - [OpenAPI document](https://skmtc.dev/passivelogic/apis/passivelogic-http-api/revisions/28fce63bcdbb?raw)
