# Send Magic Link

`POST /gate/magic-link/send` · Identity & Access · Sign-in & Sessions

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

| Name | In | Required | Description |
|---|---|---|---|
| `projectSlug` | path | yes | The project's slug: the path segment after `@`. It is unique within the org. Example: `"storefront"`. |

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `email` | string (email) | yes | 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. |
| `redirectUrl` | string | no | 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. |

```json
{
  "email": "jane@demo.example"
}
```

## Responses

- **200**: Success

| Field | Type | Required | Description |
|---|---|---|---|
| `data` | object | yes | 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. |
| `data.magicLink` | object | yes | The send request was accepted. The answer is the same for every address. |
| `data.magicLink.sent` | enum (true) | yes | Always `true`, whether or not the address belongs to an end user, so the response does not reveal who is registered. |
| `data.magicLink.expiresAt` | string (date-time) | yes | When the link expires, 15 minutes from now. Present for every address, registered or not. |
| `data.debugLink` | string | no | The sign-in link itself. Only in a test deployment that turns this on; a production deployment never includes it. |
| `meta` | object | yes | Request metadata: cost, timing and the request and trace ids. |


## Errors

| HTTP | Code | When |
|---|---|---|
| 404 | `K9O_END_USER_NOT_FOUND` | No end-user account is registered for the supplied email address. |

## Code samples

### cURL

```bash
curl -X POST 'https://<org>.api-<region>.k9o.io/@storefront/gate/magic-link/send' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "jane@demo.example"
}'
```

### fetch

```javascript
const res = await fetch('https://<org>.api-<region>.k9o.io/@storefront/gate/magic-link/send', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
  "email": "jane@demo.example"
}),
});
const { data, meta } = await res.json();
```

### @k9o/core

```typescript
// const k9o = new K9o({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })
const { data } = await k9o.gate.passwordless.requestMagicLink({
  email: 'jane@demo.example'
})
```

### k9o

```python
# k9o = create_client(org_slug="playground", project_slug="storefront", api_key="k9o_…")
response = k9o.gate.passwordless.request_magic_link({
    "email": "jane@demo.example"
})
```

### sdk-go

```go
// ctx := context.Background()
// client, _ := k9o.NewClient(k9o.ClientOpts{OrgSlug: "playground", ProjectSlug: "storefront", APIKey: "k9o_…"})
data, _, kerr := client.Gate.Passwordless.RequestMagicLink(ctx, map[string]any{"email": "jane@demo.example"})
```

### k9o

```rust
// let k9o = Client::new(ClientOpts { org_slug: "playground".into(), project_slug: "storefront".into(), api_key: "k9o_…".into() })?;
let resp = k9o.gate.passwordless.request_magic_link(json!({"email": "jane@demo.example"})).await?
```

### dev.k9o:core

```java
// K9o k9o = K9o.createClient(K9o.Opts.builder().orgSlug("playground").projectSlug("storefront").apiKey("k9o_…").build());
var response = k9o.gate().passwordless().requestMagicLink(Map.of("email", "jane@demo.example"))
```

### K9o.Core

```c#
// var k9o = K9oClient.Create(new K9oOptions { OrgSlug = "playground", ProjectSlug = "storefront", ApiKey = "k9o_…" });
var response = await k9o.Gate.Passwordless.RequestMagicLinkAsync(new Dictionary<string, object> { ["email"] = "jane@demo.example" })
```

### k9o

```ruby
# k9o = K9o.create_client(org_slug: "playground", project_slug: "storefront", api_key: "k9o_…")
response = k9o.gate.passwordless.request_magic_link({ email: "jane@demo.example" })
```

### k9o/sdk

```php
// $k9o = K9oClient::create(['org_slug' => 'playground', 'project_slug' => 'storefront', 'api_key' => 'k9o_…']);
$response = $k9o->gate->passwordless->request_magic_link(['email' => 'jane@demo.example'])
```

### K9o

```swift
// let k9o = try K9o.createClient(orgSlug: "playground", projectSlug: "storefront", apiKey: "k9o_…")
let result = try await k9o.gate.passwordless.requestMagicLink({
  email: "jane@demo.example"
})
```

### core-kotlin

```kotlin
// val k9o = createClient { orgSlug = "playground"; projectSlug = "storefront"; apiKey = "k9o_…" }
val result = k9o.gate.passwordless.requestMagicLink({
  email: "jane@demo.example"
})
```

### k9o (Flutter)

```dart
// final k9o = K9o.createClient(orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…');
final result = await k9o.gate.passwordless.requestMagicLink({
  email: 'jane@demo.example'
})
```

### @k9o/react-native

```javascript
// const k9o = createClient({ orgSlug: 'playground', projectSlug: 'storefront', apiKey: 'k9o_…' })  // RN, secure storage
const { data } = await k9o.gate.passwordless.requestMagicLink({
  email: 'jane@demo.example'
})
```


Canonical page: https://docs.kilimanjaro.dev/api-playground/identity-access/send-magic-link
