---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://truto.one/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Email a sign-in link

> Source: https://truto.one/docs/api-reference/admin/authentication/send-magic-link/

`POST /auth/send-magic-link`

Resource: **Authentication**

Emails the user a one-time sign-in link. Protected by Turnstile (`cf_token`) and one request per email address a minute (429).

An email with no account is answered 404 with `truto_error_code` `account_not_found`. A turned-off account is answered 403 with `account_deactivated`. A sign-up still waiting for verification gets no link (403): it signs in through its verification link.

## Request body

- **`cf_token`** _(string)_
  The Turnstile token from the sign-in page.
- **`email`** _(string)_
- **`redirect`** _(string)_
  An app path to open after sign-in.

## Response body

- **`success`** _(boolean)_
- **`expires_in`** _(integer)_
  Seconds the link works.
- **`resend_after`** _(integer)_
  Seconds until another link can be requested.

## Errors

| Status | Description |
| :----- | :---------- |
| `400` | A missing `cf_token` or `email`, or a `cf_token` Turnstile refused. |
| `403` | The account is turned off (`truto_error_code` `account_deactivated`), the sign-up is not verified yet, or password and magic-link sign-in are disabled for the organization (use SSO). |
| `404` | No account uses this email (`truto_error_code` `account_not_found`). |
| `429` | Another link for this email in the last 60 seconds. |

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/auth/send-magic-link' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "cf_token": "your_cf_token",
  "email": "your_email",
  "redirect": "your_redirect"
}'
```

### JavaScript

```javascript
const body = {
  "cf_token": "your_cf_token",
  "email": "your_email",
  "redirect": "your_redirect"
};

const response = await fetch('https://api.truto.one/auth/send-magic-link', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/auth/send-magic-link"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "cf_token": "your_cf_token",
    "email": "your_email",
    "redirect": "your_redirect"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```
