Login
Authenticate a client user and receive an access token for subsequent API requests. This is the primary entry point for users who already have an account with the car sharing platform.
Upon successful authentication, the API returns a bearer token that must be included in the Authorization header of all subsequent requests. This token grants access to protected endpoints like booking vehicles, managing profiles, and controlling vehicle locks.
The login endpoint is agency-specific, meaning users can only log in through the agency where they registered. The agency context is determined by the X-Agency-Signature header, which ensures proper multi-tenant isolation.
Token Validity
Access tokens remain valid until explicitly revoked via the logout endpoint. For security, tokens should be stored securely on the client device and cleared when the user logs out.
Endpoint
INFO
POST /api/v1/client/auth/login
Headers
| Header | Value | Required |
|---|---|---|
Content-Type | application/json | Yes |
Accept | application/json | Yes |
X-Agency-Signature | {signature} | Yes |
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
email | string | Yes | Client email address |
password | string | Yes | Client password |
Example Request
curl -X POST https://api.daakey.com/api/v1/client/auth/login \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-H "X-Agency-Signature: {signature}" \
-d '{
"email": "client@example.com",
"password": "password123"
}'Response
Success (200)
{
"success": true,
"message": "Login successful",
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "client@example.com",
"phone": "+1234567890",
"phone_verified_at": "2024-01-01T00:00:00Z",
"email_verified_at": "2024-01-01T00:00:00Z"
},
"token": "1|abc123def456..."
},
"meta": {
"agency_id": 123,
"agency_code": "AGENCY123"
},
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Error (401)
{
"success": false,
"message": "Invalid credentials",
"errors": {
"email": ["These credentials do not match our records."]
},
"data": null,
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}Error (422) - Validation
{
"success": false,
"message": "Validation failed",
"errors": {
"email": ["The email field is required."],
"password": ["The password field is required."]
},
"data": null,
"request_id": "uuid",
"timestamp": "2024-01-01T00:00:00.000Z"
}