> ## Documentation Index
> Fetch the complete documentation index at: https://sitespeak.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Client Login Link

> Creates a one-time link that logs a client user in to their workspace on your custom domain

Available on agency plans with a verified [custom domain](https://sitespeak.ai/docs/agency/custom-domain.md). The API token must belong to the agency owner.

Use this when your customers already sign in on your own site. After you check who the customer is, request a login link and redirect their browser to it. They land in their workspace on your domain, logged in, with no password to create.

* The link works one time and expires 5 minutes after you create it. Request a new link for each login.
* If no user with this email exists, the user is created and added to the client workspace.
* A user who already exists must be a member of one of your client workspaces. They are added to this workspace when they are not a member of it yet. For a person who already has an account and is not in your workspaces, send an invitation first.
* Redirect the customer's browser to the link. Do not send the link by email or chat: a mail scanner or a link preview can open it first and use it up.
* You are responsible for checking the customer's identity before you request a link. Request it from your server, never from the browser.

## Path Parameters

| Name | Type | Description |
| - | - | - |
| client\_id\* | String | The ID of the client workspace. |

## Headers

| Name | Type | Description |
| - | - | - |
| Accept\* | String | application/json |
| Authorization\* | String | Bearer {api_token} |
| Content-Type\* | String | application/json |

## Body Parameters

| Name | Type | Description |
| - | - | - |
| email\* | String | The email address of the client user. |
| name | String | The user's name. Used only when the user is created. Defaults to the part of the email before the @. |
| role | String | The role the user gets when they are added to the workspace: `admin`, `editor` or `member`. Defaults to `admin`. The role of an existing member does not change. |

```bash cURL theme={null}
curl -X POST "https://api.sitespeak.ai/v1/agency/clients/{client_id}/login-link" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "owner@acme.example",
    "name": "Jane Owner"
  }'
```

```javascript JavaScript theme={null}
const response = await fetch(
  'https://api.sitespeak.ai/v1/agency/clients/{client_id}/login-link',
  {
    method: 'POST',
    headers: {
      'Accept': 'application/json',
      'Authorization': 'Bearer YOUR_API_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      email: 'owner@acme.example',
      name: 'Jane Owner'
    })
  }
);

const data = await response.json();
// Redirect the customer's browser to data.login_link.url
```

## Response

> [tab] 201 Created
>
> ```json theme={null}
> {
>   "login_link": {
>     "email": "owner@acme.example",
>     "url": "https://dashboard.youragency.com/login-link/3VAsURcnAO1pe22wf7bv8U95bWNkWkK5UO4wxzZaaGpn4sQIvEHjOstHZ25T2Esj",
>     "expires_at": "2026-12-02T11:53:18+00:00"
>   }
> }
> ```

> [tab] 403 Not an agency account
>
> Returns when the API token does not belong to an agency account owner.

> [tab] 404 Not found
>
> Returns when no client workspace with this ID exists in your agency.

> [tab] 422 Validation error
>
> Returns when a field is invalid, when your agency has no verified custom domain, or when a login link is not available for this user. A link is not available for the agency owner, for your agency team members, for an existing user who is not a member of one of your client workspaces, for a user who has their own account or belongs to a workspace outside your agency, for a user who has not verified their email, or for a user who turned on two-factor authentication. These users log in with their email and password.

A link that is expired, already used, opened on a different domain, or made for a user who was removed from the workspace sends the user to your login page.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.