Skip to main content

Login Endpoint

Authenticates an active user belonging to the requesting partner and creates a Laravel Sanctum token.

  • Endpoint: /api/v1/auth/login
  • Method: POST
  • Authentication: Partner token.

Headers

HeaderValueRequiredDescription
Partner-Access-TokenBase64 StringYesShort-lived partner token.
Content-Typeapplication/jsonYes
Acceptapplication/jsonYes
Accept-LanguageLanguage CodeOptionalDefaults to English.

Payload Parameters

ParameterTypeRequiredDescription
credentialStringYesUser email address. The lookup is scoped to the requesting partner.
passwordStringYesUser password.

Sample Payload

{
"credential": "user@example.com",
"password": "secret123"
}

Sample Response

{
"result": 1,
"message": "success",
"data": {
"token": "1|sanctum-plain-text-token",
"expires_at": "2026-09-25T08:00:00.000000Z",
"user": {
"id": 42,
"name": "John Doe",
"profile": null,
"first_name": "John",
"last_name": "Doe",
"address": "Bangkok",
"date_of_birth": "1995-06-15T00:00:00.000000Z",
"country": "Thailand",
"email": "user@example.com",
"phone": "800000000",
"tel_dial": "66",
"email_verified_at": null,
"created_at": "2026-08-20T08:00:00.000000Z",
"updated_at": "2026-08-20T08:00:00.000000Z",
"is_active": true,
"partner_id": 12,
"gender": "male",
"line": null,
"whatsapp": null,
"selected_country": null,
"selected_dial_code": null
}
}
}

The same token is also returned in the Authorization response header.

Token Metadata

FieldTypeDescription
expires_atDateTimeToken expiration in ISO 8601 format, set to 30 days after the token is issued.

User tokens are valid for 30 days by default. The lifetime can be configured with SANCTUM_USER_TOKEN_EXPIRATION_DAYS.

Sample Failure Responses

{
"result": 0,
"message": "Wrong password"
}
{
"result": 0,
"message": "No user found with this credential"
}

These credential failures return HTTP 200; check result before using data.