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

# Login platform user

> Authenticate a platform user and receive an API token

This endpoint allows white label admins to authenticate one of their platform users and receive an API token for that user. Use this to build custom authentication flows for your white label platform.

<Note>
  This endpoint requires authentication as a **white label admin**. Only users belonging to your platform can be logged in.
</Note>

### Request Body

<ParamField body="email" type="string" required>
  The platform user's email address
</ParamField>

<ParamField body="password" type="string" required>
  The platform user's password
</ParamField>

<ParamField body="token_name" type="string">
  Optional name/label for the API token (e.g., "Mobile App", "Web Dashboard"). Defaults to "api-token".
</ParamField>

### Response

<ResponseField name="message" type="string">
  Success message
</ResponseField>

<ResponseField name="user" type="object">
  The authenticated user's information

  <Expandable title="user properties">
    <ResponseField name="id" type="integer">
      The user's unique identifier
    </ResponseField>

    <ResponseField name="name" type="string">
      The user's full name
    </ResponseField>

    <ResponseField name="email" type="string">
      The user's email address
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="token" type="string">
  The API token for the platform user
</ResponseField>

<ResponseField name="token_name" type="string">
  The name/label of the token
</ResponseField>

<ResponseExample>
  ```json 200 Response theme={null}
  {
    "message": "Login successful.",
    "user": {
      "id": 123,
      "name": "John Doe",
      "email": "john@example.com"
    },
    "token": "2|abc123xyz789...",
    "token_name": "api-token"
  }
  ```

  ```json 401 Invalid Credentials theme={null}
  {
    "message": "These credentials do not match our records.",
    "errors": {
      "email": ["These credentials do not match our records."]
    }
  }
  ```

  ```json 403 Not White Label Admin theme={null}
  {
    "error": "You are not a white label admin."
  }
  ```

  ```json 422 Validation Error theme={null}
  {
    "message": "The email field is required.",
    "errors": {
      "email": ["The email field is required."]
    }
  }
  ```
</ResponseExample>

### Example Request

```bash theme={null}
curl -X POST https://app.autocalls.ai/api/white-label/login \
  -H "Authorization: Bearer YOUR_ADMIN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "platformuser@example.com",
    "password": "userpassword123",
    "token_name": "Mobile App"
  }'
```

### Using the User Token

The returned token belongs to the platform user and can be used for their authenticated requests:

```bash theme={null}
curl -X GET https://app.autocalls.ai/api/user/me \
  -H "Authorization: Bearer 2|abc123xyz789..."
```
