> For the complete documentation index, see [llms.txt](https://api.senderwiz.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://api.senderwiz.com/admin/customer-login-via-token.md).

# Customer Login via Token

### 🔐 Customer Login via Token (Admin Key)

Allow your own application to securely log in customers to SenderWiz without requiring manual entry of email and password on the SenderWiz login screen. This acts as a single sign-on (SSO)-like experience using admin-level API authentication.

With this endpoint, admins can generate a login token for any of their customers and redirect them directly to SenderWiz, bypassing the login form.

***

#### 🔹 HTTP Request

```http
POST ADMIN-API-URL/admin-generate-token
```

***

#### 🔸 Authorization Header

Include your customer API key:

```
X-ADMIN-API-KEY: your-admin-api-key-here
```

***

🔸 Query Parameters

| Parameter | Required | Description                   |
| --------- | -------- | ----------------------------- |
| `email`   | Yes      | Email address of the customer |

#### 🔐 Authorization Header

Include your customer API key:

```
X-ADMIN-API-KEY: your-admin-api-key-here
```

***

**💻 PHP Example**

```php
// GENERATE LOGIN TOKEN FOR CUSTOMER
$response = $endpoint->generateToken([
    'email' => 'emma.waters@demo.com',
]);

// DISPLAY RESPONSE
echo '<hr /><pre>';
print_r($response->body);
echo '</pre>';

```

***

#### 📦 Sample JSON Response

```json
{
  "status": "success",
  "login_url": "https://demo.com/customer/guest/api-login/05530c1914f50d2e07f6318f61c636d7"
}
```

***

#### 🔁 Redirection

Once the login URL is generated, you can automatically redirect your customer to that URL. The token is valid for 10 minutes. After expiration, the customer will be redirected back to your own login system.

***

#### ✅ Benefits

* Seamless login experience for your customers
* Works like Single Sign-On (SSO)
* Secure and time-bound access (10-minute token validity)
* No password entry required

***

#### ⚠️ Note

* Ensure token-based login URLs are used immediately.
* Do not share login URLs externally. Use them only within secure application redirections.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://api.senderwiz.com/admin/customer-login-via-token.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
