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

# Customer Login

> Authenticate a customer

# Customer Login

Authenticates a customer and returns a token for subsequent requests.

## Request

<ParamField header="X-API-Key" type="string" required>
  Your API key
</ParamField>

### Body Parameters

<ParamField body="email" type="string" required>
  Customer's email address
</ParamField>

<ParamField body="password" type="string" required>
  Customer's password
</ParamField>

## Response

<ResponseExample>
  ```json theme={null}
  {
    "status": true,
    "message": "Login successful",
    "data": {
      "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
      "customer": {
        "id": 98765,
        "email": "john@example.com",
        "first_name": "John",
        "last_name": "Doe",
        "is_verified": true
      }
    }
  }
  ```
</ResponseExample>

## Using the Token

Include the token in the `Authorization` header for authenticated endpoints:

```bash theme={null}
curl "https://api.khaime.com/api/v1/orders" \
  -H "X-API-Key: pk_live_your_api_key" \
  -H "Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
```

## Errors

| Error Code                 | Description                    |
| -------------------------- | ------------------------------ |
| `AUTH_INVALID_CREDENTIALS` | Email or password is incorrect |
| `AUTH_ACCOUNT_NOT_FOUND`   | No account with this email     |

## Example

```bash theme={null}
curl -X POST "https://api.khaime.com/api/v1/login" \
  -H "X-API-Key: pk_live_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "email": "john@example.com",
    "password": "securepassword123"
  }'
```
