> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://customerhub.com/api/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://customerhub.com/api/_mcp/server.

# Send Login Link

POST https://api.customerhub.com/web_api/login_link
Content-Type: application/json

Send a one-time login link to the user's email address. The link allows passwordless authentication.

**Authentication:** Public — no auth required.

**Request body:**

* `email` (required) — The user's email address
* `callback_url` (optional) — Full base URL for the login link in the email. The login token will be appended as a path segment (e.g. `https://yourapp.example.com/auto-login/{token}`). When omitted, the default platform URL is used.

**Response:**

* `message` — Always returns a generic success message regardless of whether the email exists (prevents email enumeration)

**Side effects:** If the email matches an existing user, sends a one-time login link email.

**Errors:** None — always returns 200 for security.

Reference: https://customerhub.com/api/api-reference/sessions/send-login-link

## Request

### Body (application/json)

This endpoint expects an object.

- `email` (string, optional)
- `callback_url` (string, optional)

## Response

### 200

OK

## Examples

**Request**

```json
{
  "email": "user@example.com",
  "callback_url": "https://yourapp.example.com/auto-login"
}
```

**Response**

```json
{
  "data": {
    "message": "If an account exists for that email, we've sent a one-time login link."
  }
}
```

**SDK Code**

```python Sessions_sendLoginLink_example
import requests

url = "https://api.customerhub.com/web_api/login_link"

payload = {
    "email": "user@example.com",
    "callback_url": "https://yourapp.example.com/auto-login"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Sessions_sendLoginLink_example
const url = 'https://api.customerhub.com/web_api/login_link';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"email":"user@example.com","callback_url":"https://yourapp.example.com/auto-login"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go Sessions_sendLoginLink_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.customerhub.com/web_api/login_link"

	payload := strings.NewReader("{\n  \"email\": \"user@example.com\",\n  \"callback_url\": \"https://yourapp.example.com/auto-login\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby Sessions_sendLoginLink_example
require 'uri'
require 'net/http'

url = URI("https://api.customerhub.com/web_api/login_link")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"email\": \"user@example.com\",\n  \"callback_url\": \"https://yourapp.example.com/auto-login\"\n}"

response = http.request(request)
puts response.read_body
```

```java Sessions_sendLoginLink_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.customerhub.com/web_api/login_link")
  .header("Content-Type", "application/json")
  .body("{\n  \"email\": \"user@example.com\",\n  \"callback_url\": \"https://yourapp.example.com/auto-login\"\n}")
  .asString();
```

```php Sessions_sendLoginLink_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.customerhub.com/web_api/login_link', [
  'body' => '{
  "email": "user@example.com",
  "callback_url": "https://yourapp.example.com/auto-login"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp Sessions_sendLoginLink_example
using RestSharp;

var client = new RestClient("https://api.customerhub.com/web_api/login_link");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"email\": \"user@example.com\",\n  \"callback_url\": \"https://yourapp.example.com/auto-login\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Sessions_sendLoginLink_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "email": "user@example.com",
  "callback_url": "https://yourapp.example.com/auto-login"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.customerhub.com/web_api/login_link")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```